Skip to content

CUDA kernels: nnz-balanced chunking for skewed matrices (#92) - #100

Merged
aarmey merged 2 commits into
mainfrom
cuda-92-nnz-balanced
Nov 15, 2026
Merged

aarmey merged 2 commits into
mainfrom
cuda-92-nnz-balanced

Conversation

@aarmey

@aarmey aarmey commented Nov 15, 2026

Copy link
Copy Markdown
Member

Replaces the uniform _split_factor (decided from slice count and average nnz) with a work list: every slice is cut into ceil(nnz_slice / chunk) chunks, with the chunk size from _chunk_nnz. Giant slices (a gene in most cells) no longer set the kernel tail. Aligned kernels write partial rows to scratch only for slices that were actually cut, then a small fixed-order reduce kernel sums them (still deterministic). If no slice is cut, the original whole-slice kernel runs unchanged.

Measured on RTX 5080, 60,000x2,000 (µs, before -> after). Skewed = Zipf(1.1) gene popularity, log-normal cell depth, mostly-1 counts (new skewed_counts_csr in benchmarks):

skewed w=1 w=4 w=16 w=64
B @ VCSC 450->137 506->163 365->174 1135->370
VCSC @ B 537->113 1499->151 1073->271 2351->799
B @ VCSR 546->428 451->356 639->669 1112->1085
VCSR @ B unchanged (±9%)

Uniform 5% matrices: all within ±5% except B @ VCSR (w=1 358->196, w=4 155->135, w=16 306->278). Added skewed CUDA benchmark cases (ungated; no baseline recorded). Caveat: synthetic skew, one GPU; no real matrices were available.

Tests: forced-chunk-size tests replace the forced-split ones (including one-nonzero chunks); a new test checks a giant slice is cut at every width.

Closes #92.

@aarmey
aarmey merged commit 5c08e38 into main Nov 15, 2026
8 checks passed
@aarmey
aarmey deleted the cuda-92-nnz-balanced branch November 15, 2026 14:10
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.

CUDA kernels: re-tune the split/accumulator heuristics on real skewed matrices; nnz-balanced work decomposition

1 participant