-
Notifications
You must be signed in to change notification settings - Fork 2
Implement addition between AbstractDeviceSparseMatrix and DenseMatrix #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement addition between AbstractDeviceSparseMatrix and DenseMatrix #21
Conversation
Co-authored-by: albertomercurio <61953577+albertomercurio@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #21 +/- ##
==========================================
- Coverage 85.92% 85.09% -0.84%
==========================================
Files 11 11
Lines 604 644 +40
==========================================
+ Hits 519 548 +29
- Misses 85 96 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot could you add also the benchmarks, following the same structure of the existing ones? |
Co-authored-by: albertomercurio <61953577+albertomercurio@users.noreply.github.com>
Added benchmarks in commit 93496de. The implementation follows the existing benchmark structure:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Adds support for
sparse + densematrix addition, returning a dense matrix consistent with standard Julia SparseArrays behavior.Implementation
Core interface (
src/core.jl): Generic+(A::AbstractDeviceSparseMatrix, B::DenseMatrix)with commutative variant, including dimension and backend compatibility checksFormat-specific kernels: Backend-agnostic kernels for CSC, CSR, and COO formats that efficiently iterate only over sparse elements:
kernel_add_sparse_to_dense_csc!- column-wise iterationkernel_add_sparse_to_dense_csr!- row-wise iterationkernel_add_sparse_to_dense_coo!- element-wise iterationHelper functions:
_add_sparse_to_dense!for each sparse format dispatches to appropriate kernelTests: 54 tests covering all formats (CSC, CSR, COO) and backends (Array, JLArray), including commutativity and dimension validation
Benchmarks: Added
benchmark_sparse_dense_add!function to measure performance across all sparse formats (CSC, CSR, COO) and backends (Array, JLArray) with N×N matrices at 1% density (default N=10000)Usage
Works identically across all sparse formats and backends (CPU, GPU, accelerators).
AbstractDeviceSparseMatrixandDenseMatrix#18Original prompt
AbstractDeviceSparseMatrixandDenseMatrix#18💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.