Skip to content

[Fix][DLight] Localize private scalar reduction buffers - #20160

Open
SamJSui wants to merge 1 commit into
apache:mainfrom
SamJSui:fix/dlight-scalar-reduction-scope
Open

[Fix][DLight] Localize private scalar reduction buffers#20160
SamJSui wants to merge 1 commit into
apache:mainfrom
SamJSui:fix/dlight-scalar-reduction-scope

Conversation

@SamJSui

@SamJSui SamJSui commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

DLight's scalar-output path returns before the normal reduction-buffer
scope assignment. For length-one argmin, the paired index and value
temporaries 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 passed
  • python -m pytest tests/python/s_tir/dlight -q — 101 passed, 1 skipped, 1 xfailed
  • Adjacent Relax tests — 52 passed
  • Exact issue reproducer — passed
  • Changed-file pre-commit hooks — passed

@SamJSui
SamJSui marked this pull request as ready for review August 19, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CUDA Check failed: scope != "global" when using argmin

1 participant