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

Merged
roansystemlabs merged 1 commit from upstream-pr/435 into main 2026-11-22 05:25:23 +00:00
roansystemlabs commented 2026-11-22 02:48:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-22T02:48:02Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6537552073 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/435). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-22T02:48:02Z. --- 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.
upstream-sync closed this pull request 2026-11-24 06:43:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!429
No description provided.