@@ -23,7 +23,10 @@ for (fname, elty, intty) in ((:onemklSsparse_set_csr_data , :Float32 , :Int3
2323 m, n = dims
2424 nnzA = length (nzVal)
2525 queue = global_queue (context (nzVal), device (nzVal))
26- $ fname (sycl_queue (queue), handle_ptr[], m, n, ' O' , rowPtr, colVal, nzVal)
26+ # Don't update handle if matrix is empty
27+ if m != 0 && n != 0
28+ $ fname (sycl_queue (queue), handle_ptr[], m, n, ' O' , rowPtr, colVal, nzVal)
29+ end
2730 dA = oneSparseMatrixCSR {$elty,$intty} (handle_ptr[], rowPtr, colVal, nzVal, (m,n), nnzA)
2831 finalizer (sparse_release_matrix_handle, dA)
2932 return dA
@@ -38,8 +41,10 @@ for (fname, elty, intty) in ((:onemklSsparse_set_csr_data , :Float32 , :Int3
3841 onemklXsparse_init_matrix_handle (handle_ptr)
3942 m, n = dims
4043 nnzA = length (nzVal)
41- @show dims
42- $ fname (sycl_queue (queue), handle_ptr[], n, m, ' O' , colPtr, rowVal, nzVal) # CSC of A is CSR of Aᵀ
44+ # Don't update handle if matrix is empty
45+ if m != 0 && n != 0
46+ $ fname (sycl_queue (queue), handle_ptr[], n, m, ' O' , colPtr, rowVal, nzVal) # CSC of A is CSR of Aᵀ
47+ end
4348 dA = oneSparseMatrixCSC {$elty,$intty} (handle_ptr[], colPtr, rowVal, nzVal, dims, nnzA)
4449 finalizer (sparse_release_matrix_handle, dA)
4550 return dA
0 commit comments