Hey,

 > Ah yes, thanks Karl.  I remember that now.  With that said, are there
> recommendations on how kernels should be written to address the padded
> columns?  I am imagining some if/else or loop limits on indices but
> thought I would ask here before I start trying to do that.  I am trying
> to look through the kernels and I am seeing things along the lines of
> 'global_size(0) < size' where I assume size refers to one of the dimensions?

It depends on the respective assumptions and guarantees you make on the 
underlying data. The 'safest' way to deal with it is with something like 
the following (based on the kernel code you provided):

  const int globalRow = get_global_id(0); // C Row ID
  const int globalCol = get_global_id(1); // C Col ID
  int tmp = 0;

  if (globalRow < rowsC || globalCol < colsC)
    return;

  for(int k=0; k < Msize; k++) // Msize instead of Mdim here!
    tmp += A[k*Mdim+globalRow] * B[globalCol*Pdim+k];

  C[globalCol*Mdim+globalRow] = tmp;

Note that this code assumes column-major (Fortan) data layout, whereas 
the standard layout in ViennaCL is row-major (C).

> If so, I humbly recommend that although the padding is mentioned with
> respect to the matrix types either an example or explanation would be
> valuable in the custom kernel section (at the very least another
> friendly reminder).  Not all repetition is bad :)

Agreed. :-)

Best regards,
Karli


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel

Reply via email to