Skip to content

compute: accept EXEC as a 64-bit scalar operand in direct compute - #3245

Merged
R0Y00 merged 2 commits into
R0Y00:mainfrom
Leyukaka:wave64-exec-salu
Nov 28, 2026
Merged

R0Y00 merged 2 commits into
R0Y00:mainfrom
Leyukaka:wave64-exec-salu

Conversation

@Leyukaka

Copy link
Copy Markdown
Collaborator

Part of #2935, claimed in #3224 (item 1 of my third comment there). Target branch main.

Change (src/gfx1013_direct_compute.inl): direct compute accepts EXEC (126) as a 64-bit scalar operand.

  • It is accepted as the even source pair of s_bcnt0/s_bcnt1, s_ff0/s_ff1, s_flbit_i32_b64 and s_flbit_i32_i64, which were refused as "invalid s_bcnt1_i32_b64 source" and the like.
  • It is accepted as the s_bfm_b64 destination, which was refused as "invalid s_bfm_b64 destination".
  • With the wave64 model from shader: read the wave size of slot 67 compute requests from .sa #3006, each host half holds both EXEC words. Both are set at entry (wave64 requires complete guest waves), lane-mask writers publish both words through the exchange, and scalar writes are identical in both halves. So a replicated scalar read or write of the pair is correct in both halves.
  • VCC stays refused as such a source and as the s_bfm_b64 destination. Nothing guarantees both of its words in wave64, for example after a write to vcc_lo alone.
  • tests/native_salu_bitscan64_check.py: its EXEC-source refusal control now uses exec_hi (127), which stays refused, because EXEC (126) is accepted.

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on main 7364e6a9 plus this commit.

  • New native_wave64_exec_salu_hardware covers wave64 requests with 64 and 128 threads, two groups each:
    • s_bcnt1_i32_b64 on a sparse EXEC that spans both halves, giving 15 in the first guest wave and 16 in the second;
    • s_bfm_b64 exec, 16, 0, after which only guest lanes 0-15 store;
    • s_bfm_b64 exec, 32, 32, after which only lanes 32-63 store;
    • a wave32 s_bcnt1_i32_b64 on EXEC with an explicit exec_hi.
  • Refusal controls: s_bcnt1_i32_b64 on VCC, s_bfm_b64 into VCC, and an odd source pair.
  • Against main's compile_dxil, the new test stops at "invalid s_bcnt1_i32_b64 source".
  • 17 tests pass with -R "native_wave64|native_salu|native_slot67|native_direct_container".
  • Mutation check by hand: refusing EXEC as a source again fails the new test.

Measured with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, main 7364e6a9 against this commit.

AI-assisted.

EXEC (126) is accepted as the even source pair of s_bcnt0/s_bcnt1,
s_ff0/s_ff1 and s_flbit *_b64, and as the s_bfm_b64 destination. In the
wave64 model each host half holds both EXEC words: both are set at entry,
lane-mask writers publish both through the exchange, and scalar writes are
identical in both halves; VCC has no such guarantee and stays
refused as a source and as the s_bfm_b64 destination.

New test native_wave64_exec_salu (wave64 64 and 128 threads, wave32 32):
a sparse EXEC count, s_bfm_b64 exec, 16, 0 and exec, 32, 32, with three
refusal controls. Depends on R0Y00#3006 for the wave64 model.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 01dc357 on main 4d7265c (trial 6d0c144a788d0ef1a9dc8ac099d3f5fecdcce2de). The EXEC low and high words are read as a pair for the bit operations, and the mask instruction writes both words. The 64- and 128-thread fixtures tested masks spanning both host halves, write suppression outside EXEC, and the wave32 high-word control. VCC and odd pairs still refuse in the affected operations. Both Debug and Release /O2 passed 7/7, no skips.

ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^native_(direct_container|wave_request_hardware|wave64_exec_salu_hardware|salu_bitscan64_(controls|hardware)|salu64_(controls|hardware))$"

RTX 4060 Laptop, driver 32.0.16.1656, Windows 11 26200.9974, standalone replay without the debug layer. Required Windows CI passed.

Please update docs/experiments/native-direct-salu-bitscan64.md and docs/experiments/native-salu64-ops.md before merge. The former still lists EXEC as a source refusal (the control is now EXEC_HI), and the latter says EXEC destinations are refused without listing the new s_bfm_b64 case. Please include the new fixture command and keep the unrelated CSELECT/NOT limits for #3262.

native-direct-salu-bitscan64 lists EXEC as a valid S0 and explains why
its source refusal control now uses exec_hi; native-salu64-ops lists
s_bfm_b64 into EXEC, keeps the s_cselect_b64 / s_not_b64 EXEC
destination refusal, and adds the native_wave64_exec_salu_hardware
command.
@Leyukaka

Copy link
Copy Markdown
Collaborator Author

Thanks for testing it. Pushed 08b6cff5, docs only:

  • docs/experiments/native-direct-salu-bitscan64.md now lists EXEC (both words, in wave32 and wave64) as a valid S0. It says the fixture reads it back with s_bcnt1_i32_b64 only. It explains that the source refusal control uses exec_hi because of that, and gives the native_wave64_exec_salu_hardware command.
  • docs/experiments/native-salu64-ops.md now lists s_bfm_b64 into EXEC. The s_cselect_b64 / s_not_b64 EXEC destination refusal is kept, and that limit is left to compute: accept VCC and EXEC in direct 64-bit s_not and s_cselect #3262. The note also covers what the new fixture checks: exec, 16, 0 and exec, 32, 32 in wave64 64- and 128-thread groups, through a per-lane store. It gives the command as well.

No code change.

AI-assisted.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 08b6cff. Its change from 01dc357 is limited to the two experiment notes. Both describe accepted EXEC pairs, the EXEC_HI negative and the coverage actually run. The CSELECT and NOT limits remain documented for #3262.

I reran the seven focused cases on main c827d8b plus this head (tree 6fc3db43c84b2e1098808c23e27f98a07cf164ba). Debug and Release /O2 each passed 7/7, zero skips. The docs link check passed. Main a0b45d4 adds only the staging guard and its documentation/preset fixture, giving clean tree 2d76d3f3e7a4ac7a175fe15f5f712c5dd8784649 with the same compiler and EXEC fixture files.

ctest --test-dir <build> --no-tests=error --output-on-failure -j 1 -R "^native_(direct_container|wave_request_hardware|wave64_exec_salu_hardware|salu_bitscan64_(controls|hardware)|salu64_(controls|hardware))$"
python -B tests/docs_links_check.py

RTX 4060 Laptop, driver 32.0.16.1656, Windows 11 26200.9974, standalone replay without the debug layer. Required Windows CI passed on 08b6cff.

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.

2 participants