[Fix][DLight] Localize private scalar reduction buffers - #20160
Open
SamJSui wants to merge 1 commit into
Open
Conversation
SamJSui
marked this pull request as ready for review
August 19, 2026 05:29
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.
DLight's scalar-output path returns before the normal reduction-buffer
scope assignment. For length-one
argmin, the paired index and valuetemporaries therefore remain global. The index is read by the final
result block and must remain global, while the value temporary ends in
the producer kernel and becomes an illegal internal global allocation
during CUDA code generation.
This change assigns local scope only to root-allocated global buffers
that are produced under unit-extent loops and are not accessed by
another block. The index temporary therefore retains global scope.
A focused regression covers the length-one case and verifies that
non-unit reductions retain global scope.
Fixes #20060.
Testing:
python -m pytest tests/python/s_tir/dlight/test_gpu_general_reduction.py -q— 8 passedpython -m pytest tests/python/s_tir/dlight -q— 101 passed, 1 skipped, 1 xfailed