DPCT1016#
Note
This diagnostic message is no longer generated by SYCLomatic.
Message#
The <API name> was not migrated, because parameter(s) <parameter name a> and/or <parameter name b> could not be evaluated, or because <parameter name a> is not equal to <parameter name b>. Rewrite this code manually.
Detailed Help#
The cublasSetMatrix
can be migrated by SYCLomatic only when
lda
and ldb
have the same constant value. In cases where the migration
did not occur, rewrite the code manually.
If the values of
lda
andldb
are the same, you can use the following code:dpct::dpct_memcpy((void*)(B), (void*)(A), lda*cols*elemSize, dpct::host_to_device); // For cublasGetMatrix, use dpct::device_to_host
Otherwise, you can copy the columns of the matrix or elements of the vector one by one.
The equivalent of
cublasSetMatrix(rows, cols, elemSize, A, lda, B, ldb)
is:1 auto A_backup = A; 2 auto B_backup = B; 3 A = A - lda; 4 B = B - ldb; 5 for (int c = 0; c < cols; ++c) { 6 A = A + lda; 7 B = B + ldb; 8 dpct::dpct_memcpy( 9 (void *)(B), (void *)(A), rows * elemSize, 10 dpct::host_to_device); // For cublasGetMatrix, use dpct::device_to_host 11 } 12 A = A_backup; 13 B = B_backup;
SYCLomatic can migrate the cublasSetVector
only when incx
and incy
have the same constant value. In cases where the migration does not
occur, rewrite the code manually.
If the values of
incx
andincy
are the same, you can use the following code:dpct::dpct_memcpy((void*)(B), (void*)(A), n*incx*elemSize, dpct::host_to_device); // For cublasGetVector, use dpct::device_to_host
Otherwise, you can copy the elements of the vector one by one:
To replace
cublasGetVector(n, elemSize, x, incx, y, incy)
, use the following snippet:1 auto x_backup = x; 2 auto y_backup = y; 3 x = x - incx; 4 y = y - incy; 5 for (int c = 0; c < n; ++c) { 6 x = x + incx; 7 y = y + incy; 8 dpct::dpct_memcpy( 9 (void *)(y), (void *)(x), elemSize, 10 dpct::device_to_host); // for cublasSetVector, use dpct::host_to_device 11 } 12 x = x_backup; 13 y = y_backup;
Suggestions to Fix#
Review the logic and adjust it.