[patch] General dispatch, use BLAS for dot- and matrix-matrix products

Jules Bergmann jules at codesourcery.com
Tue Oct 11 20:00:06 UTC 2005


This patch adds a general dispatch mechanism based on 
Serial_expr_dispatch.  Like serial dispatch, it dispatches an operation 
to an appropriate implementation using compile-time and run-time checks 
for applicability.

This dispatch is used to implement dot-product and matrix-matrix product.

For dot-product, three implementations are provided: a generic 
implementation for all types and blocks, a BLAS implementation for BLAS 
types and direct data access blocks, and a BLAS implementation that 
specializes handling of a conjugated vector (for cvjdot).  By using the 
block type to determine if conjugation is necessary, the expressions 
'cvjdot(x, y)' and 'dot(x, conj(y))' are evaluated identically.

For matrix-matrix product, two implementations are provided: a generic 
impl for all types and blocks, and a BLAS implementation for BLAS types 
and direct access blocks.

The attached graphs show performance locally.  For the mm-product graph, 
three lines are shown:  green is generic VSIPL++ performance (this is 
also the current library performance), red is VSIPL++ performance using 
BLAS, and blue is VSIPL++ performance using BLAS, but without the 
overhead of copying the result matrix.

Why define General_dispatch and not use Serial_expr_dispatch for these? 
  Serial_expr_dispatch is designed to take an expression for the RHS, as 
opposed to a list of operand block types that General_dispatch takes. 
Wrapping multiple arguments as an expression is possible, but would 
likely be cumbersome.

				-- Jules
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: prod.diff
URL: <http://sourcerytools.com/pipermail/vsipl++/attachments/20051011/31d57341/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prod.png
Type: image/png
Size: 5382 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/vsipl++/attachments/20051011/31d57341/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dot.png
Type: image/png
Size: 5643 bytes
Desc: not available
URL: <http://sourcerytools.com/pipermail/vsipl++/attachments/20051011/31d57341/attachment-0001.png>


More information about the vsipl++ mailing list