d3d12: the PSV0 part's name table holds a copy of a name per element (SHADER-PSV0-NAME-PER-ELEMENT) #2864
Closed
github-bot
wants to merge 1 commit from
github-bot/gh-2864 into main
AGit
pull from: github-bot/gh-2864
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2864
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2864"
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?
@Neutron-0 on GitHub · 2026-12-01 10:43 UTC · original
Neutron-0:fix/psv0-name-per-element→main· +72 −11 · 1 files · 1 commits · closed without mergingClaimed in the coordination issue as: SHADER-PSV0-NAME-PER-ELEMENT (#2570)
What and why
d3d12/crates/leonida-shader/src/emit/container.rswrites thePSV0part of the DXIL container. Its name table held one copy of a semantic's name for all the elements that shared it, while the validator compares this part with the one it computes from the module - and that one's table holds a copy per element. Every element after the first then carried a name offset the module's table does not have, and the validator refused the program:Every program with an arbitrary semantic (
POSITION,TEXCOORD, ...) has such elements, so this is not a corner case.The fix writes one copy per element, in element order, as DXC writes it (the
ISG1/OSG1part above already did). ThePSV0of a geometry stage built by hand is now byte for byte the one DXC 1.7 writes for the same signature, apart from the dependency-mask table, which the validator does not compare.Where this shows, and where it does not. The validator runs in
validate()(emit/mod.rs), which is#[cfg(windows)]and only validates when adxil.dllloads; without one it returns without validating, and the test passes. On a machine with the Windows SDK'sdxil.dllthe four tests that validate such a program fail (the same message with DXC 1.5.2005, 1.6.2104, 1.6.2112 and 1.7.2308 - not a version quirk). The CI'swindows-latestrunner has nodxil.dllthat loads, so its job is green and cannot see this: the four tests readokthere without validating anything.So the CI is not the place this is caught; a developer machine with the SDK is. The container the translator writes is what the host's own D3D12 runtime validates, and a container the validator refuses is a pipeline the host refuses, so making the part byte for byte the one DXC writes is the safe shape regardless of which validator version the host has.
The shader cache key follows the translator's sources (
build.rs), so the key changes with this change and the caches built before it are rebuilt once.This touches
emit/container.rs, which #2581 also touches, but in another part of the file: #2581 changes theISG1/OSG1writer and the geometry block ofpsv(), this changes the name table further down in the same function.Tested
cargo test -p leonida-shader --locked- fails onmain60f7dcd90in the 4 validator tests (the message above, withdxil.dll101.7.2308.24) and 415 tests OK, 0 failed, 5 ignored with the change on this pull request's head.emit::container::tests::the_psv_name_table_holds_a_copy_of_a_name_per_element- fails onmain(both elements share the name offset 1) and passes with the change.PSV0part of the geometry stage the test builds is now byte for byte DXC 1.7's own for the same signature (compared part by part; only the dependency-mask table differs).cargo test -p leonida-gpu --lib --locked -- --test-threads=1- 644 passed, 0 failed, 59 ignored.cargo test --workspace --locked --exclude leonida-gpu- everything green exceptxtask'spolicy::tests::repository_passes_policy, which fails onmainas well (3 violations aboutleonida-gpu/src/host.rs,emit/lower.rsandemit/indirect/amplify_dxil.rs; #2815 is the fix for that, and this change touches none of those files).dxil.dll).GPUs tested: n/a (the validator is the Windows SDK's
dxil.dll; no GPU, no game files)AI-assisted: yes - OpenCode (MiniMax M3.1 Flash)
Checklist
main(60f7dcd90).docs/design.md, with how it was confirmed.Not applicable: no translator rule; the change is in the container the translator writes.
@Neutron-0 on GitHub · 2026-12-01 10:52 UTC · original
One note about this account's side of it: GitHub allows this account one open pull request in this repository, so this pull request holds the slot that #2837 (the census fix, reviewed and verified) had to give up. #2837 is closed with the reason on the record and is reopened as soon as this one is merged; three other fixes (a switch page with a test that keeps it in step, a reported skip instead of a silent one, and a retry for a dropped connection in the conflict labeler) are queued behind it, each with its branch pushed and tested.
Nothing about the four changes depends on each other, so they can be merged in any order; only the account's one-at-a-time limit orders them.
ec12f9d743to571bd0cf88@Neutron-0 on GitHub · 2026-12-01 11:54 UTC · original · edited 2026-12-01 11:55 UTC
Two practical notes for whoever looks at this:
The workflow run is waiting for an approval (
action_required): a fork run of a first-time contributor needs a maintainer to approve it before the job runs. Approving it would let thed3d12 (windows-latest)job run on this head.The job cannot see what this fixes, and that is worth knowing before reading it as green.
validate()(d3d12/crates/leonida-shader/src/emit/mod.rs) is#[cfg(windows)]and only validates when adxil.dllloads; without one it returns without validating and the test passes. Nodxil.dllloads on the runner - it is in the log ofmain's run 46634364807:emit::rect::tests::rectangles_are_drawn_whole ... okandemit::rect::tests::the_rectangle_stage_is_a_geometry_shader ... ok, i.e. the tests pass without validating anything.On a machine with the Windows SDK's
dxil.dllthe same two fail onmainwith "Container part 'Pipeline State Validation' does not match expected for module" (DXC 1.5.2005, 1.6.2104, 1.6.2112 and 1.7.2308 all give it), and they pass on this head.LEONIDA_DXILpoints the validator at a specificdxil.dll, so a reviewer with one can check it in a minute:The finding about the job not seeing this at all is in the coordination issue (#2570).
571bd0cf88tof615daf74e@KelboLive on GitHub · 2026-12-01 13:20 UTC · original · reviewed
Confirmed against DXC:
SetPSVSigElement()appends a name for every arbitrary element, and pre-1.8 validators compare the PSV0 part byte-for-byte with a regenerated one, so the oldfind()shared offset was the rejection. The new writer matches DXC's input/output/prim order and keeps system values at offset 0, with offsets relative to the string-table start (including its leading NUL) and lengths including the terminator — I checked base, terminator and count againstdocs/design.md:745-752andtools/ps_interp_modes.py:116-171, and both read either form correctly.The new test is a real guard: reverting only the writer fails it at
container.rs:536(assert_ne!(name_of(0), name_of(1)),left: 1, right: 1), andleonida-shader --libis 410/0/5 here, withtests/test_ps_interp_modes.py32/32. This is a writer, not a parser, so there is no name-table read to overrun; the production readers are bounded (emit/mod.rs:1628-1637withsplit_at_checked,ps_interp_modes.py:150-153with0 < noff < len).Two notes, neither blocking:
O(sum(len+1))): twoTEXCOORDs go 12 → 20 bytes. Bounded by D3D signature limits and no unbounded input, but worth one sentence in the commit message since it is the deliberate trade for byte-identity with DXC.\0and give an empty arbitrary name offset 1 instead of 0. Unreachable for valid modules (arbitrary semantics must be named), so not a blocker — but if the writer is ever used on a hand-built signature, that is the one case where it would differ again.docs/design.md:745describes the layout but not whether the table may be deduplicated; a clause saying it need not be would keep the next writer from reintroducingfind().f615daf74eto3199126800@merzleckeier on GitHub · 2026-12-01 15:44 UTC · original
I ran an explicit DXIL validator comparison at
31991268+0ff8a532f. The synthetic rectangle geometry stage had SV_Position, TEXCOORD0, COLOR0 and TEXCOORD1, with and without a primitive-ID output. The fixture requires the validator to load and validates each result directly, rather than silently skipping if the DLL cannot be found.With the PR, both cases passed the x64 dxil.dll from Microsoft DXC v1.7.2308 and the newer validator used by the local harness. In a local control I restored only PSV0 name deduplication. The v1.7.2308 validator rejected both variants with “Pipeline State Validation” not matching the module. The newer validator accepted both control variants. The stock name-table test also passed with the PR. Win64 target under Wine 11.22, synthetic code only.
Microsoft DXC v1.7.2308 release · MEASURED, AI-assisted (Codex).
3199126800toc8644393d7c8644393d7tod9bc50cf81d9bc50cf81to0c39f33773@Neutron-0 on GitHub · 2026-12-02 05:36 UTC · original
Closed to hand the slot over, not because of anything in the review.
GitHub allows this account one open pull request in this repository, and this one has been holding that slot while its workflow run waits for a maintainer's approval (
action_required, a first-time contributor's fork run). The next pull request is ready and measured, so the slot goes there instead of idling here.Nothing is lost: this pull request keeps its discussion and its review, and the opener reopens it - on a fresh
main- as soon as the next one is merged. The queue is the census fix, the texture recheck switch, this one, then the page check, the hard-link skip and the label retry.@Neutron-0 on GitHub · 2026-12-02 05:39 UTC · original
Reopened: the slot this account may hold in this repository is free again.
Pull request closed