compute: accept GLC, DLC and SLC on raw buffer loads and stores in direct compute #3253

Manually merged
github merged 2 commits from github-bot/gh-3251 into gh-pr/3251/base 2026-11-28 04:07:12 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-28 01:48 UTC · original
Leyukaka:raw-load-glc-dlc → main · +227 −6 · 8 files · 2 commits · merged 2026-11-28 04:02 UTC

Part of #2935, claimed in #3226 (item 3 of my third comment there). Target branch main. Two commits. This goes further than that claim: it also accepts SLC, and the second commit does the same for raw stores.

Change (src/gfx1013_compute_native.cpp, plus one sentence in docs/experiments/native-bytewin-store.md): the direct compute decoder no longer refuses raw buffer loads and stores for the cache-policy bits GLC (word 0 bit 14), DLC (word 0 bit 15) and SLC (word 1 bit 22).

  • These bits do not change the bytes loaded or stored within a dispatch. tools/startup/gfx2hlsl.py already treats them that way for MUBUF loads.
  • DXIL globallycoherent is not modelled.
  • IDXEN, LDS, TFE and the other bits stay refused with the same messages.
  • Buffer atomics and the graphics path keep their masks.
  • tests/native_global_srv_heap_replay_check.py retires its two GLC and SLC load refusal cases, which the new tests turn into positive coverage.

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 these commits.

  • New native_raw_load_cache_bits_hardware reads back, against a CPU reference:

    • OFFEN with GLC+DLC;
    • a scalar offset with GLC+DLC;
    • OFFEN with SLC.

    Its refusal controls are LDS and TFE.

  • New native_raw_store_cache_bits_hardware reads back:

    • dword and dwordx4 OFFEN stores with GLC;
    • a dword store with DLC;
    • a dwordx4 store with SLC.
  • New native_raw_store_cache_bits_controls checks the IDXEN, LDS and TFE refusals. tests/native_bytewin_store_check.py gains a checks= keyword so the new test reuses its fixture.

  • With main's compile_dxil, the load cases stop at "raw buffer load needs a linear byte offset and no modifiers".

  • Mutation checks by hand: putting GLC back into either mask fails the matching hardware test.

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

  • Local capture of 2,689 requests: 494 to 495 compile.
  • Requests of one start-up run (2,718): 507 to 508.
  • The 882 requests of #3226: no change (128).
  • More programs get past these two refusals and stop later: 22 on the capture, 28 on the run and 9 on the 882. A few now stop at "unsupported scalar memory destination range".
  • No program that compiled before stops compiling.
  • Counts and instruction shape only.

AI-assisted.

**@⁠Leyukaka** on GitHub · 2026-11-28 01:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3251) `Leyukaka:raw-load-glc-dlc` → `main` · +227 −6 · 8 files · 2 commits · merged 2026-11-28 04:02 UTC Part of #2935, claimed in #3226 (item 3 of my third comment there). Target branch `main`. Two commits. This goes further than that claim: it also accepts SLC, and the second commit does the same for raw stores. **Change** (`src/gfx1013_compute_native.cpp`, plus one sentence in `docs/experiments/native-bytewin-store.md`): the direct compute decoder no longer refuses raw buffer loads and stores for the cache-policy bits GLC (word 0 bit 14), DLC (word 0 bit 15) and SLC (word 1 bit 22). - These bits do not change the bytes loaded or stored within a dispatch. `tools/startup/gfx2hlsl.py` already treats them that way for MUBUF loads. - DXIL `globallycoherent` is not modelled. - IDXEN, LDS, TFE and the other bits stay refused with the same messages. - Buffer atomics and the graphics path keep their masks. - `tests/native_global_srv_heap_replay_check.py` retires its two GLC and SLC load refusal cases, which the new tests turn into positive coverage. **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 these commits. - New `native_raw_load_cache_bits_hardware` reads back, against a CPU reference: - OFFEN with GLC+DLC; - a scalar offset with GLC+DLC; - OFFEN with SLC. Its refusal controls are LDS and TFE. - New `native_raw_store_cache_bits_hardware` reads back: - dword and dwordx4 OFFEN stores with GLC; - a dword store with DLC; - a dwordx4 store with SLC. - New `native_raw_store_cache_bits_controls` checks the IDXEN, LDS and TFE refusals. `tests/native_bytewin_store_check.py` gains a `checks=` keyword so the new test reuses its fixture. - With `main`'s `compile_dxil`, the load cases stop at "raw buffer load needs a linear byte offset and no modifiers". - Mutation checks by hand: putting GLC back into either mask fails the matching hardware test. **Measured** with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`, `main` `7364e6a9` against these commits. - Local capture of 2,689 requests: 494 to 495 compile. - Requests of one start-up run (2,718): 507 to 508. - The 882 requests of #3226: no change (128). - More programs get past these two refusals and stop later: 22 on the capture, 28 on the run and 9 on the 882. A few now stop at "unsupported scalar memory destination range". - No program that compiled before stops compiling. - Counts and instruction shape only. AI-assisted.
The cache-policy bits GLC (word 0 bit 14), DLC (word 0 bit 15) and SLC
(word 1 bit 22) no longer refuse a raw buffer_load in the direct
compute decoder; they do not change the loaded value, as
tools/startup/gfx2hlsl.py already treats them for MUBUF loads. DXIL
globallycoherent is not modelled. LDS, TFE, IDXEN and the other
modifiers stay refused, and stores and atomics keep their masks.

New test native_raw_load_cache_bits_hardware: OFFEN with GLC+DLC, a
scalar offset with GLC+DLC and OFFEN with SLC read back against a CPU
reference, with LDS and TFE refusal controls. The two refusal cases for
GLC and SLC in native_global_srv_heap_replay_check.py are retired.
Direct compute raw stores accept and ignore the GLC, DLC and SLC
cache-policy bits, as raw loads now do; graphics keeps its mask. IDXEN,
LDS, TFE and the other bits stay refused.

New tests native_raw_store_cache_bits_controls and _hardware: dword and
dwordx4 OFFEN stores with GLC, a dword with DLC and a dwordx4 with SLC
read back against expected words, plus IDXEN, LDS and TFE refusals.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 01:49:54 +00:00
github-bot changed target branch from main to gh-pr/3251/base 2026-11-28 04:07:09 +00:00
github manually merged commit 774646cfa6 into gh-pr/3251/base 2026-11-28 04:07:12 +00:00
Author
Owner

@⁠pigalot on GitHub · 2026-11-28 04:02 UTC · original · approved these changes

I reviewed 774646cf merged over main 152e93b4. The merge is clean (tree 2c73d46c) and git diff --cached --check is clean.

What I traced. In direct compute (direct && !graphics), the raw MUBUF masks now drop only the cache-policy bits:

  • Loads: word 0 goes from 0x0203e000 to 0x02032000, dropping GLC (bit 14) and DLC (bit 15). Word 1 goes from 0x00e00000 to 0x00a00000, dropping SLC (bit 22).
  • Stores: word 0 goes from 0x3e000 to 0x32000 and word 1 from 0xe00000 to 0xa00000, the same three bits.
  • Still refused: IDXEN (13), LDS (16), bit 17, bit 21 and TFE (23).
  • Unchanged: the graphics path keeps the full store mask, and buffer atomics are untouched.

The lowering does not read these bits. Raw loads lower to raw_vector_srv/byte_window_srv loads, and raw stores to raw_buffer_uav stores (gfx1013_direct_compute.inl around line 683), so the emitted DXIL is the same with or without them.

What I ran. I built compile_dxil native_store_replay native_global_srv_heap_replay native_compute_ir_dump native_compute_manifest_reasons in dev and release, then ran:

ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^native_' -E '_hardware'
python .agentic\scripts\with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(native_raw_(load|store)_cache_bits_hardware|native_bytewin_store_hardware|native_global_srv_heap_replay_hardware)$'
  • Non-hardware: 128 tests per preset. 111 pass and 17 _warp tests skip with 77 (WARP capability skips), in both Debug and Release /O2. The skips include native_global_srv_heap_replay_warp, native_image_store_exact_width_warp_* and native_descriptor_scc_warp. This PR's tests have no _warp variant.
  • Hardware: 4/4 pass in both presets, including native_global_srv_heap_replay_hardware with the two retired GLC/SLC refusal cases.
  • Negative control: with the decoder's load mask set back to main's, native_raw_load_cache_bits_hardware fails. With the store mask set back to main's, native_raw_store_cache_bits_hardware fails.

Mutants. Each was rebuilt in dev, then I ran the matching new test:

Mutant Test Result
load: GLC, DLC or SLC refused again (one at a time) native_raw_load_cache_bits_hardware 3/3 killed
load: LDS or TFE accepted native_raw_load_cache_bits_hardware (refusal controls) 2/2 killed
store: DLC or SLC refused again native_raw_store_cache_bits_hardware 2/2 killed
store: IDXEN, LDS or TFE accepted native_raw_store_cache_bits_controls 3/3 killed

Restored and rebuilt afterwards; git diff --quiet is clean.

Non-blocking. A GLC load that expects to see another workgroup's store from the same dispatch used to be refused. Now it compiles, and it reads through an SRV with no cross-group visibility guarantee. The description says globallycoherent is not modelled. And a load through an SRV could not be coherent anyway, so this doesn't change what the lowering can express. But a spin-wait on a flag written by another group would now fail silently instead of being refused. If that pattern turns up in the request sets, a refusal or a globallycoherent UAV path for it would be a follow-up.

Verdict: approve on 774646cf.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0 DXC, Python 3.12.10, wave32; I did not check the debug-layer status.
CI: Build and test on Windows passes on 774646cf.

This reply was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-28 04:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3251#pullrequestreview-6095649930) · **approved these changes** I reviewed `774646cf` merged over `main` `152e93b4`. The merge is clean (tree `2c73d46c`) and `git diff --cached --check` is clean. **What I traced.** In direct compute (`direct && !graphics`), the raw MUBUF masks now drop only the cache-policy bits: - **Loads:** word 0 goes from `0x0203e000` to `0x02032000`, dropping GLC (bit 14) and DLC (bit 15). Word 1 goes from `0x00e00000` to `0x00a00000`, dropping SLC (bit 22). - **Stores:** word 0 goes from `0x3e000` to `0x32000` and word 1 from `0xe00000` to `0xa00000`, the same three bits. - **Still refused:** IDXEN (13), LDS (16), bit 17, bit 21 and TFE (23). - **Unchanged:** the graphics path keeps the full store mask, and buffer atomics are untouched. The lowering does not read these bits. Raw loads lower to `raw_vector_srv`/`byte_window_srv` loads, and raw stores to `raw_buffer_uav` stores (`gfx1013_direct_compute.inl` around line 683), so the emitted DXIL is the same with or without them. **What I ran.** I built `compile_dxil native_store_replay native_global_srv_heap_replay native_compute_ir_dump native_compute_manifest_reasons` in `dev` and `release`, then ran: ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 4 -R '^native_' -E '_hardware' python .agentic\scripts\with_gpu_lock.py ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(native_raw_(load|store)_cache_bits_hardware|native_bytewin_store_hardware|native_global_srv_heap_replay_hardware)$' ``` - **Non-hardware:** 128 tests per preset. 111 pass and 17 `_warp` tests skip with 77 (WARP capability skips), in both Debug and Release `/O2`. The skips include `native_global_srv_heap_replay_warp`, `native_image_store_exact_width_warp_*` and `native_descriptor_scc_warp`. This PR's tests have no `_warp` variant. - **Hardware:** 4/4 pass in both presets, including `native_global_srv_heap_replay_hardware` with the two retired GLC/SLC refusal cases. - **Negative control:** with the decoder's load mask set back to `main`'s, `native_raw_load_cache_bits_hardware` fails. With the store mask set back to `main`'s, `native_raw_store_cache_bits_hardware` fails. **Mutants.** Each was rebuilt in `dev`, then I ran the matching new test: | Mutant | Test | Result | |---|---|---| | load: GLC, DLC or SLC refused again (one at a time) | `native_raw_load_cache_bits_hardware` | 3/3 killed | | load: LDS or TFE accepted | `native_raw_load_cache_bits_hardware` (refusal controls) | 2/2 killed | | store: DLC or SLC refused again | `native_raw_store_cache_bits_hardware` | 2/2 killed | | store: IDXEN, LDS or TFE accepted | `native_raw_store_cache_bits_controls` | 3/3 killed | Restored and rebuilt afterwards; `git diff --quiet` is clean. **Non-blocking.** A GLC load that expects to see another workgroup's store from the same dispatch used to be refused. Now it compiles, and it reads through an SRV with no cross-group visibility guarantee. The description says `globallycoherent` is not modelled. And a load through an SRV could not be coherent anyway, so this doesn't change what the lowering can express. But a spin-wait on a flag written by another group would now fail silently instead of being refused. If that pattern turns up in the request sets, a refusal or a `globallycoherent` UAV path for it would be a follow-up. **Verdict:** approve on `774646cf`. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Windows SDK 10.0.28000.0 DXC, Python 3.12.10, wave32; I did not check the debug-layer status. CI: `Build and test on Windows` passes on `774646cf`. This reply was AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.