Repository navigation
Compute TG_SIZE: a partial last wave counts - #136
Merged
Merged
Conversation
TG_SIZE (the SGPR after the group ids) held threads / wave size, truncated: a 96-thread group reported 1 wave of 64 instead of 2, and a 40-thread group 1 wave of 32 instead of 2. The count is now the ceiling, computed when the HLSL is made. Test: gpu_compute_tg_size_counts_a_partial_last_wave (96 / 64 / 40 / 128 threads, wave64 and wave32; every thread stores TG_SIZE). Co-Authored-By: Claude Opus 5.5 <[email protected]>
tiagonleal
force-pushed
the
fix/compute-tg-size-partial-wave
branch
from
November 23, 2026 14:48
3805ce2 to
1058c0b
Compare
Contributor
|
Tested #136
No new failures vs main. The PR's new test passes on RDNA2. The one failure on both, |
Collaborator
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.
From #105's "also noticed": "
Mode::Computetg_sizeuses truncating division instead ofdiv_ceil".TG_SIZE (the SGPR after the group ids, wave count | wave index << 6) was emitted as
threads / lanes, truncated. A group that is not a multiple of the wave size has a last, partial wave, so:A program that uses the count (to size a cross-wave reduction, or to know how many waves reach an LDS slot) skipped the last wave. The count is now the ceiling, computed when the HLSL is made (a constant, as before).
The retail pack never enables TG_SIZE (
CsInterface::tg_sizedoc), so no translated pack program changes. Only compute programs that enable it get different HLSL.Test:
gpu_compute_tg_size_counts_a_partial_last_wave. Every thread stores TG_SIZE, for 96 / 64 / 128 threads in wave64 and 96 / 40 in wave32 (split wave64 on 32-lane GPUs). Before:96 threads, wave64: thread 0 – left: 1, right: 2. After: all pass.Run: RTX 5070 Ti, driver 32.0.16.1742.
cargo test --workspace --no-fail-fast -- --test-threads=4onmain95bda11: 549 passed, 0 failed, 37 ignored.AI-assisted.
🤖 Generated with Claude Code