Skip to content

Conversation

@alonsoC1s
Copy link

Aims to fix #647 by extending the signature of scatter! to work with AbstractCuSparseArray, a CUDA array type notably excluded by the original method. With the proposed patch, calling scatter! with sparse arrays from CUDA.CUSPARSE will correctly call the CUDA-specialized method instead of calling the generic CPU method, which triggered a scalar indexing error. In my testing the existing CUDA kernels work perfectly fine with CuSparseArrayCSC.

The proposed implementation, perhaps inelegantly, just expands the types in the signature with Union{...}. I am open to discussing more beautiful ways of implementing this. Ideally, AbstractCuSparseArray would be a subtype of AnyCuArray.

PR Checklist

  • Tests are added
  • Documentation, if applicable

@alonsoC1s
Copy link
Author

The integration test with Lux fail because always_inliner! is not defined, and what look like Enzyme internal errors. Not sure if this is unrelated

@mcabbott
Copy link
Member

Seems fine. Is it possible to add a test on CI somehow, perhaps in https://github.com/FluxML/NNlib.jl/blob/master/test/ext_cuda/scatter.jl ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specialized scatter! dispatch for CUSPARSE.CuSparseMatrix

2 participants