gpu: check that the built array-atomics probe keeps nonUniformIndex #435

Manually merged
github merged 1 commit from gh-pr/435/head into gh-pr/435/base 2026-11-26 21:51:47 +00:00
Owner

@⁠roansystemlabs on GitHub · 2026-11-22 02:48 UTC · original
roansystemlabs:gpu/369-nonuniform-atomic-guard → main · +183 −0 · 2 files · 1 commits · merged 2026-11-22 05:25 UTC

Refs #369

What

This adds one CTest, array_atomics_dxil (tests/array_atomics_dxil_check.py), registered with the other DXIL checks in the INTAKE_PYTHON block. It runs in the existing Windows job under ctest --preset dev -E '_hardware$' and needs DXC only, no GPU.

  1. Built probe. It disassembles ProbeArrayAtomics.cso from the build directory with dxc -dumpbin. That is the cs_6_0 output of the same DXC command that writes the ProbeArrayAtomics.h that offscreen_check embeds. Locally the two hold the same 3360 bytes. The check finds the single dx.op.atomicBinOp/atomicCompareExchange and follows its handle operand back to the createHandle that defines it. It then checks three things:
    • the handle is a UAV whose range in !dx.resources is the Aliases binding (u0, space1, 8 descriptors);
    • the index is computed from dx.op.threadId, traced through its defining instructions;
    • nonUniformIndex is true.
  2. Synthetic control. It compiles a temporary copy of tests/gpu_alias_writes.hlsl as cs_6_0 with NonUniformResourceIndex( removed. It runs the same trace and requires the same handle and dynamic index, now with nonUniformIndex false.

The check follows operands by value and never matches SSA numbers or fixed line text. It prints the compiler identification (!llvm.ident) of each module it measures and the dxc --version it ran.

A pass establishes only that the compiled probe kept the flag. #332 still checks the actual per-device counts and fails on incorrect results. The probe, the write path, gpu_alias_lookup_writes_* and the workflow are unchanged.

Verification

Commit 292281d, Windows 11 build 26200, VS 2022 Build Tools, Windows SDK 10.0.26100.0 dxc.exe, DXC 1.9.2602.17 (21d28f727):

ctest --preset dev --no-tests=error -R '^array_atomics_dxil$' -V
dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727)
ProbeArrayAtomics.cso: compiler=dxcoob 1.9.2602.17 (21d28f727) creation=createHandle aliases_uav=True dynamic_index=True nonUniformIndex=true
control without NonUniformResourceIndex: compiler=dxcoob 1.9.2602.17 (21d28f727) creation=createHandle aliases_uav=True dynamic_index=True nonUniformIndex=false
1/1 Test #138: array_atomics_dxil ...............   Passed

The existing device test is unchanged and still passes on WARP: gpu_alias_lookup_writes_warp passed, with array_atomics ... expected=64 actual=64,64,64,64 and debug_layer=unavailable. No hardware GPU run was made for this change.

Negative checks: I passed a probe .cso built from a modified source as the probe argument. Both cases failed with exit 1:

  • without NonUniformResourceIndex: nonUniformIndex=false, "the built probe lost nonUniformIndex on the atomic's handle";
  • with Aliases[0] instead of the dynamic index: dynamic_index=False, "the atomic does not use the probe's dynamic Aliases index".

Manual diagnostics (not in CTest)

The built probe targets cs_6_0, so cs_6_6 and other compilers stay manual. Compile the probe yourself and pass it as the .cso argument:

dxc -T cs_6_6 -E ProbeArrayAtomics -I src -Fo probe66.cso tests\gpu_alias_writes.hlsl
out\pe-env\Scripts\python.exe -B tests\array_atomics_dxil_check.py <dxc.exe> probe66.cso tests\gpu_alias_writes.hlsl src
DXC used Probe target Handle creation nonUniformIndex Control
1.9.2602.17 (21d28f727), Windows SDK 10.0.26100.0 cs_6_0 createHandle true false
1.9.2602.17 (21d28f727), Windows SDK 10.0.26100.0 cs_6_6 createHandleFromBinding + annotateHandle true false
1.8.2502.8 (b4711839e), GitHub release v1.8.2502 cs_6_0 createHandle true false
1.8.2502.8 (b4711839e), GitHub release v1.8.2502 cs_6_6 createHandleFromBinding + annotateHandle true false

The control always compiles cs_6_0 with the DXC given. 1.8.2502.8 is not the report's 1.8.2502.11 (239921522). That build ships with the Windows SDK and is not published as a GitHub release, and I have not measured it. The cs_6_6 rows also show that the trace does not depend on SSA numbering or on the creation form: the values are numbered differently there and the handle goes through annotateHandle.

AI-assisted: prepared and submitted with the support of Roan System (AI-assisted development), reviewed before posting.

**@⁠roansystemlabs** on GitHub · 2026-11-22 02:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/435) `roansystemlabs:gpu/369-nonuniform-atomic-guard` → `main` · +183 −0 · 2 files · 1 commits · merged 2026-11-22 05:25 UTC Refs #369 ## What This adds one CTest, `array_atomics_dxil` (`tests/array_atomics_dxil_check.py`), registered with the other DXIL checks in the `INTAKE_PYTHON` block. It runs in the existing Windows job under `ctest --preset dev -E '_hardware$'` and needs DXC only, no GPU. 1. **Built probe.** It disassembles `ProbeArrayAtomics.cso` from the build directory with `dxc -dumpbin`. That is the `cs_6_0` output of the same DXC command that writes the `ProbeArrayAtomics.h` that `offscreen_check` embeds. Locally the two hold the same 3360 bytes. The check finds the single `dx.op.atomicBinOp`/`atomicCompareExchange` and follows its handle operand back to the `createHandle` that defines it. It then checks three things: - the handle is a UAV whose range in `!dx.resources` is the `Aliases` binding (`u0, space1`, 8 descriptors); - the index is computed from `dx.op.threadId`, traced through its defining instructions; - `nonUniformIndex` is `true`. 2. **Synthetic control.** It compiles a temporary copy of `tests/gpu_alias_writes.hlsl` as `cs_6_0` with `NonUniformResourceIndex(` removed. It runs the same trace and requires the same handle and dynamic index, now with `nonUniformIndex` `false`. The check follows operands by value and never matches SSA numbers or fixed line text. It prints the compiler identification (`!llvm.ident`) of each module it measures and the `dxc --version` it ran. A pass establishes only that the compiled probe kept the flag. #332 still checks the actual per-device counts and fails on incorrect results. The probe, the write path, `gpu_alias_lookup_writes_*` and the workflow are unchanged. ## Verification Commit `292281d`, Windows 11 build 26200, VS 2022 Build Tools, Windows SDK 10.0.26100.0 `dxc.exe`, **DXC 1.9.2602.17 (21d28f727)**: ```text ctest --preset dev --no-tests=error -R '^array_atomics_dxil$' -V dxcompiler.dll: 1.9(5184-21d28f72)(1.9.2602.17) - 1.9.2602.17 (21d28f727) ProbeArrayAtomics.cso: compiler=dxcoob 1.9.2602.17 (21d28f727) creation=createHandle aliases_uav=True dynamic_index=True nonUniformIndex=true control without NonUniformResourceIndex: compiler=dxcoob 1.9.2602.17 (21d28f727) creation=createHandle aliases_uav=True dynamic_index=True nonUniformIndex=false 1/1 Test #138: array_atomics_dxil ............... Passed ``` The existing device test is unchanged and still passes on WARP: `gpu_alias_lookup_writes_warp` passed, with `array_atomics ... expected=64 actual=64,64,64,64` and `debug_layer=unavailable`. No hardware GPU run was made for this change. Negative checks: I passed a probe `.cso` built from a modified source as the probe argument. Both cases failed with exit 1: - without `NonUniformResourceIndex`: `nonUniformIndex=false`, "the built probe lost nonUniformIndex on the atomic's handle"; - with `Aliases[0]` instead of the dynamic index: `dynamic_index=False`, "the atomic does not use the probe's dynamic Aliases index". ## Manual diagnostics (not in CTest) The built probe targets `cs_6_0`, so `cs_6_6` and other compilers stay manual. Compile the probe yourself and pass it as the `.cso` argument: ```powershell dxc -T cs_6_6 -E ProbeArrayAtomics -I src -Fo probe66.cso tests\gpu_alias_writes.hlsl out\pe-env\Scripts\python.exe -B tests\array_atomics_dxil_check.py <dxc.exe> probe66.cso tests\gpu_alias_writes.hlsl src ``` | DXC used | Probe target | Handle creation | nonUniformIndex | Control | |---|---|---|---|---| | 1.9.2602.17 (21d28f727), Windows SDK 10.0.26100.0 | cs_6_0 | createHandle | true | false | | 1.9.2602.17 (21d28f727), Windows SDK 10.0.26100.0 | cs_6_6 | createHandleFromBinding + annotateHandle | true | false | | 1.8.2502.8 (b4711839e), GitHub release `v1.8.2502` | cs_6_0 | createHandle | true | false | | 1.8.2502.8 (b4711839e), GitHub release `v1.8.2502` | cs_6_6 | createHandleFromBinding + annotateHandle | true | false | The control always compiles `cs_6_0` with the DXC given. **1.8.2502.8 is not the report's 1.8.2502.11 (239921522).** That build ships with the Windows SDK and is not published as a GitHub release, and I have not measured it. The `cs_6_6` rows also show that the trace does not depend on SSA numbering or on the creation form: the values are numbered differently there and the handle goes through `annotateHandle`. AI-assisted: prepared and submitted with the support of Roan System (AI-assisted development), reviewed before posting.
Disassemble the cs_6_0 ProbeArrayAtomics.cso built for the device test,
follow the atomic's handle to its creation and require the dynamic
Aliases UAV index with nonUniformIndex=true. In the same CTest, compile
the probe without NonUniformResourceIndex and require that the same
trace reports false. Operands are followed by value, not by SSA number.

Refs #369
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:51:46 +00:00
github manually merged commit 292281d9c9 into gh-pr/435/base 2026-11-26 21:51:47 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.