Skip to content

DXIL: add semantic inspection helper and fixture - #2575

Open
luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dxil-semantic-audit
Open

luckyteagirl wants to merge 1 commit into
xcl-dev:mainfrom
luckyteagirl:codex/dxil-semantic-audit

Conversation

@luckyteagirl

@luckyteagirl luckyteagirl commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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.

@RavenCurseBurg

RavenCurseBurg commented Nov 25, 2026 •

Copy link
Copy Markdown

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.

@luckyteagirl
luckyteagirl force-pushed the codex/dxil-semantic-audit branch from 865c792 to 5c46919 Compare November 25, 2026 23:43
@luckyteagirl

Copy link
Copy Markdown
Contributor Author

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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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

@rgroenewoudt

Copy link
Copy Markdown

Test report for 0723b11 with another DXC version

Tested

  • Windows 11 Pro 26300, Python 3.14.7, Windows SDK DXC 1.9.2602.17 (Windows Kits 10.0.26100.0).
  • python -B scripts/test_dxil_semantics.py --require-dxc --dxc "<Windows Kits>\x64\dxc.exe": 7 passed, 0 failed, 0 skipped.
  • scripts/inspect_dxil_semantics.py on 40 DXIL containers from XCL's runtime cache (%LOCALAPPDATA%\xcl\dxil, compiled by DXC from XCL's HLSL for a retail title): 40 parsed, 0 errors (23 compute, 13 pixel, 3 vertex, 1 mesh). The output was not checked field by field, and no title data is shared here.

Not tested

  • Containers from the direct DXIL backend (translated/).
  • A paired comparison of DXC and direct DXIL output.

AI use

  • Claude Code, Claude Opus 5.5: ran the tests and wrote this report.

@Decodere

Copy link
Copy Markdown
Contributor

Independent desktop NVIDIA verification of PR #2575 at head 0723b118cbafabb3c2200b0c9680e2a874335310 (1 commit; exact parent & merge-base: e1d84b7d9153f86a97d2ec5d209d196046fc0bea, pre-#2555 ancestor of main).

Environment

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6C / 12T), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200 (Developer Mode off)
  • Toolchain: Python 3.15.2, DXC 1.9.2609.5 (via XCL_DXC_DIR), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC, --release

Targeted DXIL semantic fixture tests & build (0723b118)

Command Result
python -B scripts/test_dxil_semantics.py --require-dxc (3 consecutive runs, exact CI check against live DXC 1.9.2609.5) Ran 7 tests ... OK × 3 (0.068s, 0.071s, 0.067s, 0 skipped, 0 failed: test_entry_metadata_contains_thread_group_size, test_explicit_missing_dxc_does_not_fall_back, test_features_operations_and_resource_semantics, test_invalid_dxc_directory_does_not_fall_back, test_multiple_entry_points_are_rejected, test_resource_bindings_include_constant_buffers_textures_and_tbuffers, test_stage_model_versions_and_entry_metadata)
cargo build --release -p xcl Clean build (1m 12s, exit 0, 0 new warnings)

Paired quiet 60 s retail smoke (title: 29640639)

Exact parent & merge-base (e1d84b7d9153f86a97d2ec5d209d196046fc0bea, cached baseline on the same machine):

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1531 (PresentX 1531)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13982 MB

PR #2575 (0723b118cbafabb3c2200b0c9680e2a874335310):

xcl-smoke v1
commit: 0723b118cbafabb3c2200b0c9680e2a874335310
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1631 (PresentX 1631)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13988 MB

Runtime log observations (xcl.log)

  • 9223 log lines, 0 [ERROR] / device-removal / panic lines (dxil_cache: 460 hits, 0 misses, 0 compilation failures; 228 background pipelines, 0 failures).
  • Final draw/memory telemetry in log: 19663 draws with translated pipelines (0 skipped, 0 with PC pipelines), 1024 dispatches (0 skipped); last memory sample 13987 MB committed by the process; video memory 6115 MB local, 4651 MB non-local.

Limits of coverage

  • This PR adds Python/DXC tooling, HLSL fixtures, and a CI job (.github/workflows/ci.yml, scripts/inspect_dxil_semantics.py, scripts/test_dxil_semantics.py, tests/data/dxil_semantic/*.hlsl; 0 Rust production-code changes); all 7 tests in scripts/test_dxil_semantics.py --require-dxc passed 3/3 against installed DXC 1.9.2609.5 on Windows 11.
  • The 60 s retail smoke confirms non-regression of the unchanged runtime binary at this commit (single-run frame/commit delta vs. cached parent reflects normal startup variance, not this PR).

AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 0723b11

No open or merged PR adds a DXIL semantic inspector. #2553 (same issue #2541) adds manifests and a hash checker for xcl shaders --direct --dump output, which is a different tool. One small point: in scripts/test_dxil_semantics.py the three tests that need no DXC (test_explicit_missing_dxc_does_not_fall_back, etc.) live in the class whose setUpClass raises SkipTest when DXC is missing, so they are skipped too without --require-dxc.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

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.

6 participants