Repository navigation
CUDA: float4 gathers of dense-operand rows in the aligned kernels - #97
Merged
Merged
Conversation
…width % 4 == 0 Gathers one B row per nonzero with 128-bit loads instead of four 32-bit ones. Written once over a vector type; the split threshold counts dense columns so width 8 still splits. Misaligned atomic kernels stay scalar: float4 atomicAdd needs sm_90 and gained <10%.
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.
Closes #90.
What
The aligned kernels (
VCSR @ B,B @ VCSC) now load each dense-operand row withfloat4whenwidth % 4 == 0, so a quarter as many load instructions per nonzero. The inner loop is written once over a vector type (VT), compiled as a third variant axis alongside accumulator count and chunked/whole. Other widths keep scalar loads.width / 4lanes now cover the width, so_split_factorcounts dense columns (ww * vec) against_MIN_SPLIT_WW; width 8 still splits.atomicAddkernels stay scalar.atomicAdd(float4*)needs sm_90+ (not the 4090) and gained only 1-8% on a 5080 in a prototype; the atomics, not theBloads, dominate there.Measured (µs,
parafac2, 5% density;VCSR @ Bon 60k x 2k /B @ VCSCon 2k x 60k; before -> after)Whole
@calls, including the rank-1 correction and scratch reduction. Largest gains at widths 8-64 (up to ~2x on the 5080); on the 4090B @ VCSCgains little outside widths 16-32.Testing
tests/test_cuda.pypasses on both an RTX 4090 and an RTX 5080 (355 tests); added widths 4, 12 and 256 to the split test, plus launch-config tests._cuda.py.Note:
cuda-narrow-indicesalso touches the kernel signatures, so expect a mechanical conflict with whichever merges second.