cleanup: Remove dead mask variable and make bounds checking explicit in GELU kernel#99
Merged
hannahli-nv merged 1 commit intomainfrom Apr 8, 2026
Merged
Conversation
Collaborator
Author
|
/ok to test 4ce95c8 |
xjmxyt
approved these changes
Apr 8, 2026
The GELU cuTile kernel computed a bounds mask but never applied it, causing out-of-bounds memory reads on gather and out-of-bounds writes on scatter when n_elements is not a multiple of BLOCK_SIZE. Fix by adding padding_value=0 to ct.gather (safe OOB reads) and check_bounds=True to ct.scatter (skip OOB writes), consistent with other cuTile kernels in the codebase.
4ce95c8 to
14f1a00
Compare
Collaborator
Author
|
/ok to test 14f1a00 |
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
Clean up the GELU cuTile kernel (
gelu_kernel_ct):maskvariable — it was computed viact.less(offsets, n_elements)but never passed togatherorscatterpadding_value=0toct.gatherandcheck_bounds=Truetoct.scatterNote:
ct.gatherandct.scatterboth default tocheck_bounds=True, so the kernel was already safe from out-of-bounds access. This change just removes dead code and makes the intent explicit, consistent with other cuTile kernels in the codebase (e.g.,swiglu,softmax,silu_and_mul).Closes #93
CI Configuration