DXIL: add semantic inspection helper and fixture #2575

Open
github-bot wants to merge 1 commit from github-bot/gh-2575 into main AGit
Owner

@⁠luckyteagirl on GitHub · 2026-11-25 23:26 UTC · original
luckyteagirl:codex/dxil-semantic-audit → main · +470 −0 · 5 files · 1 commits · open

Part of #2541. This adds a read-only baseline for comparing DXC and XCL DXIL container semantics; it does not change the emitter.

What is in it

  • scripts/inspect_dxil_semantics.py emits schema-versioned JSON with shader stage/model, DXIL module and validator versions, entry-point flags and thread-group dimensions, SFI0 feature flags and DXC feature names, called dx.op names/opcodes/overloads/counts, resource bindings and handle annotations, and target layout. disassembler_dxc_version identifies the inspection tool, not the container producer.
  • The report sorts semantic collections and omits shader hashes, resource names, DXC resource IDs, SSA names, and instruction order.
  • tests/data/dxil_semantic/compute_store.hlsl is a minimal compute reference with an 8×4×2 group, WaveActiveSum, and one byte-address UAV store. resource_bindings.hlsl exercises a constant buffer, two-element texture array, unbounded texture array, sampler, UAV, and legacy TBuffer across register spaces 3, 12, and 15.
  • scripts/test_dxil_semantics.py compiles both fixtures with DXC and checks the expected semantic fields, including entry-point metadata and all six resource bindings and counts. It also checks that invalid explicit and XCL_DXC_DIR overrides cannot fall back silently and that multi-entry containers are rejected. CI requires DXC and fails if it is absent.

Tested

  • Branch base: e1d84b7; current upstream main is 08db802. The intervening changes are confined to README.md and crates/xcl/src/gpu/recomp/{dxc.rs,emit.rs,link_tests.rs,mod.rs} and do not overlap this PR's inspector, fixture, or CI workflow.
  • Windows 11, pinned DXC 1.9.2609.5 from XCL_DXC_DIR.
  • python -B scripts/test_dxil_semantics.py --require-dxc --dxc C:\Users\Luma\Documents\ChatGPT\XCL-test\dxc-1.9.2609\bin\x64\dxc.exe: 7 passed, 0 failed, 0 skipped. DXC compiled both fixtures and -dumpbin inspected them successfully.
  • The same final seven-test suite with Windows SDK DXC 1.8.2502.11 at C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxc.exe and Vulkan SDK DXC 1.9.0.5399 at C:\VulkanSDK\1.4.357.0\Bin\dxc.exe: 7 passed, 0 failed, 0 skipped on each toolchain. CI requires DXC and fails if it is absent.
  • python -B scripts/inspect_dxil_semantics.py --dxc C:\Users\Luma\Documents\ChatGPT\XCL-test\dxc-1.9.2609\bin\x64\dxc.exe ..\dxc-output\compute_store.dxil: emitted disassembler_dxc_version 1.9.2609.5, cs_6_6, DXIL 1.6 / validator 1.9, 8×4×2, SFI0 0x4000, waveActiveOp.i32 opcode 119, rawBufferStore.i32 opcode 140, and the UAV u0 binding with byte format and read/write dimension.
  • The resource fixture exposed missing cb2,space3 and t1,space3 entries. Independent DXC probes then found that a TBuffer appears as texture in DXC's type column and tbuffer in its dimension column, and that DXC can concatenate unbounded directly to the register/space token. The final parser reports all six bindings, including t2,space12 as TBUFFER, the texture array count of 2, and t11,space15 with count unbounded, on all three DXC versions.
  • The final inspector also parsed two XCL-emitted DXIL containers saved from a prior local smoke run: a vs_6_6 vertex shader (7 dx.op groups, 5 bindings) and a ps_6_6 pixel shader (9 dx.op groups, 0 bindings). DXC -dumpbin accepted both. No title data or containers were uploaded.
  • git diff --check: passed.

Regression run

Not required: this changes scripts, a test fixture, and CI only; it does not change runtime code.

Not tested

  • A paired report from an XCL-emitted container and this DXC reference fixture; the helper accepts either input, and this contribution establishes the reference-side inspector and fixture.
  • Containers with multiple entry points; the helper rejects these rather than reporting incomplete entry metadata.
  • GPU execution or validator behavior on other DXC versions.

AI use

OpenAI Codex (GPT-6.2-sol) wrote the inspector, fixture, test, and CI step, and ran the DXC/Python verification described above.

**@⁠luckyteagirl** on GitHub · 2026-11-25 23:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/2575) `luckyteagirl:codex/dxil-semantic-audit` → `main` · +470 −0 · 5 files · 1 commits · open Part of #2541. This adds a read-only baseline for comparing DXC and XCL DXIL container semantics; it does not change the emitter. **What is in it** - `scripts/inspect_dxil_semantics.py` emits schema-versioned JSON with shader stage/model, DXIL module and validator versions, entry-point flags and thread-group dimensions, SFI0 feature flags and DXC feature names, called `dx.op` names/opcodes/overloads/counts, resource bindings and handle annotations, and target layout. `disassembler_dxc_version` identifies the inspection tool, not the container producer. - The report sorts semantic collections and omits shader hashes, resource names, DXC resource IDs, SSA names, and instruction order. - `tests/data/dxil_semantic/compute_store.hlsl` is a minimal compute reference with an 8×4×2 group, `WaveActiveSum`, and one byte-address UAV store. `resource_bindings.hlsl` exercises a constant buffer, two-element texture array, unbounded texture array, sampler, UAV, and legacy TBuffer across register spaces 3, 12, and 15. - `scripts/test_dxil_semantics.py` compiles both fixtures with DXC and checks the expected semantic fields, including entry-point metadata and all six resource bindings and counts. It also checks that invalid explicit and `XCL_DXC_DIR` overrides cannot fall back silently and that multi-entry containers are rejected. CI requires DXC and fails if it is absent. **Tested** - Branch base: `e1d84b7`; current upstream main is `08db802`. The intervening changes are confined to `README.md` and `crates/xcl/src/gpu/recomp/{dxc.rs,emit.rs,link_tests.rs,mod.rs}` and do not overlap this PR's inspector, fixture, or CI workflow. - Windows 11, pinned DXC `1.9.2609.5` from `XCL_DXC_DIR`. - `python -B scripts/test_dxil_semantics.py --require-dxc --dxc C:\Users\Luma\Documents\ChatGPT\XCL-test\dxc-1.9.2609\bin\x64\dxc.exe`: **7 passed, 0 failed, 0 skipped**. DXC compiled both fixtures and `-dumpbin` inspected them successfully. - The same final seven-test suite with Windows SDK DXC `1.8.2502.11` at `C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\dxc.exe` and Vulkan SDK DXC `1.9.0.5399` at `C:\VulkanSDK\1.4.357.0\Bin\dxc.exe`: **7 passed, 0 failed, 0 skipped** on each toolchain. CI requires DXC and fails if it is absent. - `python -B scripts/inspect_dxil_semantics.py --dxc C:\Users\Luma\Documents\ChatGPT\XCL-test\dxc-1.9.2609\bin\x64\dxc.exe ..\dxc-output\compute_store.dxil`: emitted `disassembler_dxc_version` 1.9.2609.5, `cs_6_6`, DXIL 1.6 / validator 1.9, `8×4×2`, SFI0 `0x4000`, `waveActiveOp.i32` opcode 119, `rawBufferStore.i32` opcode 140, and the UAV `u0` binding with byte format and read/write dimension. - The resource fixture exposed missing `cb2,space3` and `t1,space3` entries. Independent DXC probes then found that a TBuffer appears as `texture` in DXC's type column and `tbuffer` in its dimension column, and that DXC can concatenate `unbounded` directly to the register/space token. The final parser reports all six bindings, including `t2,space12` as TBUFFER, the texture array count of 2, and `t11,space15` with count `unbounded`, on all three DXC versions. - The final inspector also parsed two XCL-emitted DXIL containers saved from a prior local smoke run: a `vs_6_6` vertex shader (7 `dx.op` groups, 5 bindings) and a `ps_6_6` pixel shader (9 `dx.op` groups, 0 bindings). DXC `-dumpbin` accepted both. No title data or containers were uploaded. - `git diff --check`: passed. **Regression run** Not required: this changes scripts, a test fixture, and CI only; it does not change runtime code. **Not tested** - A paired report from an XCL-emitted container and this DXC reference fixture; the helper accepts either input, and this contribution establishes the reference-side inspector and fixture. - Containers with multiple entry points; the helper rejects these rather than reporting incomplete entry metadata. - GPU execution or validator behavior on other DXC versions. **AI use** OpenAI Codex (GPT-6.2-sol) wrote the inspector, fixture, test, and CI step, and ran the DXC/Python verification described above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:34:12 +00:00
Author
Owner

@⁠luckyteagirl on GitHub · 2026-11-25 23:45 UTC · original

Thanks for the independent DXC check. I reproduced the missing cb and texture rows locally before seeing your completed report, then amended this PR at 5c469198623984b02bc2dd5bcbefef4221d71dcd. The new four-resource fixture checks that the inspector reports CBUFFER, SRV, SAMPLER, and UAV bindings with their register spaces. Its seven tests pass on local DXC 1.9.2609.5, 1.9.0.5399, and 1.8.2502.11. The amended Windows CI is running. Your array/count and multi-space checks add useful independent coverage.

AI use: OpenAI Codex (GPT-6.2-sol) reproduced the parser gap, amended this PR, ran the tests, and drafted this reply.

**@⁠luckyteagirl** on GitHub · 2026-11-25 23:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/2575#issuecomment-7178003186) Thanks for the independent DXC check. I reproduced the missing `cb` and `texture` rows locally before seeing your completed report, then amended this PR at `5c469198623984b02bc2dd5bcbefef4221d71dcd`. The new four-resource fixture checks that the inspector reports CBUFFER, SRV, SAMPLER, and UAV bindings with their register spaces. Its seven tests pass on local DXC 1.9.2609.5, 1.9.0.5399, and 1.8.2502.11. The amended Windows CI is running. Your array/count and multi-space checks add useful independent coverage. AI use: OpenAI Codex (GPT-6.2-sol) reproduced the parser gap, amended this PR, ran the tests, and drafted this reply.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 23:45 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-25 23:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/2575#issuecomment-7178008510) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 26 ignored. Thanks! — Devin
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 23:36 UTC · original · edited 2026-11-26 00:14 UTC

Confirmed the author’s independent binding-parser fix on 0723b118cbafabb3c2200b0c9680e2a874335310. I reran the earlier four-resource shader matrix with DXC 1.9.2609.5: two shader profiles, three register-space/array-size combinations, six compiled containers. All 24 JSON binding rows matched the compiler’s own disassembly on register class, register, format, dimension and count. python -B scripts/test_dxil_semantics.py --require-dxc passed 7/7, including the upstream fixture with its tbuffer and unbounded array; full Python discovery passed 32/32. Windows 11, Core i7-13700. No GPU dispatch or XCL-generated container was used. OpenAI Codex (GPT-6) ran the checks.

Earlier verification

I reproduced two missing resource bindings on 865c792a2e824b784f8842f7f1b65eb51667bb8f with DXC 1.9.2609.5. A small compute shader uses four resources. dxc -dumpbin lists all four, but the original inspector's JSON contains only the sampler and UAV. The omitted rows are the constant buffer at cb2,space1 and the two-element texture array at t3,space2.

Fix and compiled regression fixture. The inspector now reads DXC’s cb binding prefix and its texture type for shader-resource views. With the fix, the four JSON rows match the dump, including counts and spaces. I also compared six small containers at cs_6_0 and cs_6_6, using spaces 0, 7 and 23 and array sizes 1, 2 and 4. All 24 binding rows matched DXC on class, register, format, dimension and count.

With XCL_DXC_DIR set to the local compiler directory, python -B scripts/test_dxil_semantics.py --require-dxc passed 6/6 on the original head and 7/7 with the patch. The new fixture failed against the original inspector. python -B -m unittest discover -s scripts -p "test_*.py" passed 32/32 with the patch. Windows 11, Core i7-13700, Python 3.14.3. CPU-side compilation and disassembly only. XCL-generated containers and GPU execution remain untested here. OpenAI Codex (GPT-6) wrote the patch and ran these checks.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 23:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/2575#issuecomment-7177800931) · edited 2026-11-26 00:14 UTC Confirmed the author’s independent binding-parser fix on `0723b118cbafabb3c2200b0c9680e2a874335310`. I reran the earlier four-resource shader matrix with DXC 1.9.2609.5: two shader profiles, three register-space/array-size combinations, six compiled containers. All 24 JSON binding rows matched the compiler’s own disassembly on register class, register, format, dimension and count. `python -B scripts/test_dxil_semantics.py --require-dxc` passed 7/7, including the upstream fixture with its tbuffer and unbounded array; full Python discovery passed 32/32. Windows 11, Core i7-13700. No GPU dispatch or XCL-generated container was used. OpenAI Codex (GPT-6) ran the checks. <details> <summary>Earlier verification</summary> I reproduced two missing resource bindings on `865c792a2e824b784f8842f7f1b65eb51667bb8f` with DXC 1.9.2609.5. A small compute shader uses four resources. `dxc -dumpbin` lists all four, but the original inspector's JSON contains only the sampler and UAV. The omitted rows are the constant buffer at `cb2,space1` and the two-element texture array at `t3,space2`. [Fix and compiled regression fixture](https://github.com/RavenCurseBurg/xcl/commit/9f9871ba0ee654e0cf9e34d43d21f0d2a9fae9f2). The inspector now reads DXC’s `cb` binding prefix and its `texture` type for shader-resource views. With the fix, the four JSON rows match the dump, including counts and spaces. I also compared six small containers at `cs_6_0` and `cs_6_6`, using spaces 0, 7 and 23 and array sizes 1, 2 and 4. All 24 binding rows matched DXC on class, register, format, dimension and count. With `XCL_DXC_DIR` set to the local compiler directory, `python -B scripts/test_dxil_semantics.py --require-dxc` passed 6/6 on the original head and 7/7 with the patch. The new fixture failed against the original inspector. `python -B -m unittest discover -s scripts -p "test_*.py"` passed 32/32 with the patch. Windows 11, Core i7-13700, Python 3.14.3. CPU-side compilation and disassembly only. XCL-generated containers and GPU execution remain untested here. OpenAI Codex (GPT-6) wrote the patch and ran these checks. </details>
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 01:36 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 01:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/2575#issuecomment-7179942014) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2575/head:github-bot/gh-2575'
git switch 'github-bot/gh-2575'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2575'
git switch 'github-bot/gh-2575'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2575'
git switch 'github-bot/gh-2575'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2575'
git switch 'main'
git merge --squash 'github-bot/gh-2575'
git switch 'main'
git merge --ff-only 'github-bot/gh-2575'
git switch 'main'
git merge 'github-bot/gh-2575'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.