Repository navigation
CUDA kernels: nnz-balanced chunking for skewed matrices (#92) - #100
Merged
Merged
Conversation
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the uniform
_split_factor(decided from slice count and average nnz) with a work list: every slice is cut intoceil(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_csrin benchmarks):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.