Skip to content

Add SparseMatricesCSR.jl Ext#906

Open
Abdelrahman912 wants to merge 1 commit into
JuliaGPU:mainfrom
Abdelrahman912:csr-ext
Open

Add SparseMatricesCSR.jl Ext#906
Abdelrahman912 wants to merge 1 commit into
JuliaGPU:mainfrom
Abdelrahman912:csr-ext

Conversation

@Abdelrahman912
Copy link
Copy Markdown
Contributor

Add support to CPU CSR matrices, e.g., ROCSparseMatrixCSR(::SparseMatrixCSR)

@luraess
Copy link
Copy Markdown
Member

luraess commented May 18, 2026

Thanks for the contribution! The structure closely mirrors what CUDA.jl does in lib/cusparse/ext/SparseMatricesCSRExt.jl.

One thing to consider (unless I am wrong): SparseMatricesCSR.SparseMatrixCSR{Bi,Tv,Ti} has a type parameter Bi for the index base (0 or 1). The CPU→GPU constructors currently use Mat.rowptr/Mat.colval directly without checking Bi, which would silently produce incorrect index arrays for a 0-based SparseMatrixCSR{0}; ROCSPARSE expects 1-based pointers in the Julia wrappers (matching the SparseMatrixCSR{1} used in the GPU→CPU direction). Restricting the dispatch to {1} would turn this into a clear error instead:

ROCSparseMatrixCSR{T}(Mat::SparseMatrixCSR{1}) where {T} = ...

Note that CUDA.jl has the same gap, but this could be also fixed there if needbe.

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.

2 participants