Direct DXIL: audit metadata and legalization against DXC and LLVM references #2541
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#2541
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mokkamokacaffe on GitHub · 2026-11-25 22:24 UTC · original
Summary
XCL directly emits DXIL in
crates/xcl/src/gpu/dxil/. The current implementation is primarily checked through XCL unit tests,dxil.dllvalidation and hardware execution.Add a structured audit comparing XCL’s emitted modules with minimal equivalent shaders produced by DXC, using LLVM’s DirectX backend as an independent architectural reference. The goal is not to replace XCL’s emitter or introduce LLVM as a dependency. It is to identify metadata, legalization and container inconsistencies that can cause validator-version differences, driver rejection or unnecessary driver compilation work.
Part of #1269.
Motivation
A module can be valid LLVM-derived bitcode while still violating DXIL-specific requirements. It can also pass one validator version yet expose inconsistent metadata or feature flags to another validator or GPU driver.
Recent work has encountered areas where exact DXIL declarations matter, including:
DXC is the practical Microsoft reference. LLVM’s documented DirectX backend provides a useful independent model of the lowering stages and invariants:
https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst
https://github.com/microsoft/DirectXShaderCompiler/blob/main/utils/hct/hctdb.py
https://llvm.org/docs/DirectX/DXILArchitecture.html
Proposed scope
Audit these XCL areas:
crates/xcl/src/gpu/dxil/ops.rsdx.opopcode, overload and argument signaturescrates/xcl/src/gpu/dxil/module.rscrates/xcl/src/gpu/dxil/shader.rscrates/xcl/src/gpu/dxil/kernel.rscrates/xcl/src/gpu/dxil/compact.rscontainer/PSV/signature construction used by the direct emitter
Proposed method
For each representative shader family:
dxil.dllversions.Initial shader families:
Test infrastructure
Add a semantic inspection helper that reports stable properties such as:
@mokkamokacaffe on GitHub · 2026-11-25 22:26 UTC · original
Notes for AI-assisted contributors
Please treat this issue as an audit and coordination tracker, not as a proposal to replace XCL’s direct-DXIL emitter.
Reference priority
Use these sources in this order:
hctdb.py)dxil.dllvalidator behaviorLLVM documentation is useful for comparing lowering stages and invariants, but it is not more authoritative than Microsoft’s specification, DXC or the validator.
Candidate XCL areas
crates/xcl/src/gpu/dxil/ops.rscrates/xcl/src/gpu/dxil/module.rscrates/xcl/src/gpu/dxil/shader.rscrates/xcl/src/gpu/dxil/kernel.rscrates/xcl/src/gpu/dxil/compact.rsRecommended first contribution
Start with a small, read-only semantic inspection helper and one minimal compute-shader fixture covering:
dx.opoperations and overloads;Avoid byte-for-byte DXIL comparisons. Declaration order, value numbering and instruction ordering may change without changing semantics.
Process
Before implementing a fix:
dxil.dllversion.Evidence template