Skip to content

Add GPU norm_sq/slice_norms, normalized sum/mean, sampled_dot, and as_linear_operator - #113

Merged
aarmey merged 2 commits into
mainfrom
feat/upstream-sc-bench-ops
Nov 28, 2026
Merged

aarmey merged 2 commits into
mainfrom
feat/upstream-sc-bench-ops

Conversation

@aarmey

@aarmey aarmey commented Nov 28, 2026

Copy link
Copy Markdown
Member

Upstreams general sparse/normalized-view operations needed by sc-factor-bench (and other downstream consumers):

  • CudaNormalizedView.norm_sq() and CudaNormalizedView.slice_norms(condition_idxs, n_cond): Warp-parallel CUDA kernels in float64 accumulation supporting both VCSR and VCSC and narrowed device index/pointer dtypes (uint16/uint32, int32/int64).
  • .sum(axis=None) and .mean(axis=None) on NormalizedViewBase and CudaNormalizedView: Exact reductions along axis=0, axis=1, or overall (None) without materializing the dense/transformed matrix.
  • sampled_dot(x, u, v, *, gpu=False) (and VCSRArray/VCSCArray.sampled_dot): Sampled dense-dense dot product (SDDMM, u[i] @ v[j] at every stored nonzero) with parallel Numba CPU kernels and a warp-parallel CUDA kernel (zero (nnz, k) temporary allocation).
  • as_linear_operator() on VCSRArray, VCSCArray, NormalizedViewBase, and CudaNormalizedView: Wraps arrays/views in scipy.sparse.linalg.LinearOperator with matvec/rmatvec/matmat/rmatmat.

Verification

  • ruff check ., ruff format --check ., codespell, and ty check passed.
  • pytest tests/test_upstreamed_ops.py tests/test_cuda.py (396 tests on RTX 5080) passed.

@aarmey
aarmey merged commit 9a43b7d into main Nov 28, 2026
8 checks passed
@aarmey
aarmey deleted the feat/upstream-sc-bench-ops branch November 28, 2026 20:00
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.

1 participant