SparseArrays vs CUSPARSE

I have no idea if this is intentional or not, at the moment there is an inconstency in the julia and or CUDA stack when dense and sparse vectors are interacting:

using SparseArrays, CUDA
N=10
x_cpu=randn(N);
x_sparse=sparse(x_cpu);
x_gpu=cu(x_cpu);
x_sparse_gpu=cu(x_sparse);
res_cpu=@. x_sparse * x_cpu;
res_gpu=@. x_sparse_gpu * x_gpu;
@show issparse(res_cpu) #true
@show issparse(res_gpu) #false

I have a custom array library and honestly I have no idea what to return in case of sparse arrays (CPU or GPU doesn’t matter), I would like to know to what to give precedence, hence:

  • Dense op Sparse = Sparse

or

  • Dense op Sparse = Dense

The original issue is here.