Repository navigation
Optimize RMSNorm with block-parallel kernels - #20
Merged
Merged
Conversation
This was referenced Jul 25, 2026
This was referenced Aug 4, 2026
Merged
Merged
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.
Summary
SPEC.mdRoot cause
The old forward and input-backward kernels launched one thread per output element, but every thread rescanned all
Dfeatures. AtN=32,768,D=1,536, this made both pathsO(N*D^2)and consumed about 252 ms of the step before weight-gradient time.The optimized kernels cooperatively calculate each row's reductions once and then write strided columns, reducing the work to
O(N*D).Performance
B200, same-container baseline/candidate comparison at
B=32,T=1024,D=1536:Non-norm rows were essentially unchanged.
Validation
./run.sh llama-ops: CPU -> naive GPU -> optimized GPU parity passed on B200N=259,D=261crosses both 256-wide row and column boundaries./run.sh llama-model: full forward/backward and AdamW CPU parity passed1.540382 -> 0.000002)BASELINE_REF=acc8ce4a7e39b9e6e501e597f74b9949da1538c6 ./run.sh llama-model profile: same-container performance gate passedgit diff --checkpassedSANITIZE=synccheck ./run.sh llama-opscannot build because cuda-oxide's legacy NVVM sanitizer target rejects the pre-existing atomic embedding kernel (atomic read-modify-write operations); normal Blackwell PTX builds and execution pass.