Read PSV0 wave lane bounds when selecting the guest wave size #65

Closed
github-bot wants to merge 1 commit from gh-pr/65/head into gh-pr/65/base
Owner

@⁠philip-roy-jones on GitHub · 2026-11-21 22:16 UTC · original
fix/psv-wave-size-metadata → main · +127 −6 · 13 files · 1 commits · closed without merging

Library / area: tombox-xshader shader metadata

Exports changed (exports.txt rows): None

Source of the behaviour: Microsoft's PSVRuntimeInfo0 layout, DXC writer for compute shaders and HLSL wave size range specification.

On 0fc7295, extraction discarded both lane bounds. A synthetic ds_append program without a wave64-specific instruction passed the translator's wave32-only check even when PSV0 required 64 lanes. The reader now retains the bounds, xshader reports them, and the existing width check selects among the permitted RDNA2 widths. When both widths are allowed, the instruction-based decision still applies.

I compiled empty compute shaders with DXC 1.8.2502.11 and used their unmodified PSV0 chunks with the same synthetic guest ISA. DXC and the updated reader agreed.

HLSL attribute PSV0 bounds Counter translation on this branch
WaveSize(64) 64 to 64 Reaches the existing wave64 refusal
WaveSize(32) 32 to 32 Translates
WaveSize(32,64) or WaveSize(32,64,64) 32 to 64 Translates. The two PSV0 chunks are byte-identical
WaveSize(64,128) 64 to 128 Wave64 refusal. The reader preserves the range
No attribute 0 to UINT32_MAX Reports no requirement. A missing chunk also permits the existing fallback

Verification

  • cargo test --locked -p tombox-xshader --no-fail-fast on Windows/WARP gave 134 passed, 0 failed, 12 ignored on 0fc7295 and 136 passed, 0 failed, 12 ignored on 1d6b5a4.

  • cargo test --locked -p tombox-xshader --test synthetic passed 9/9 upstream and 11/11 on the branch. A translation-only replay of the new regression failed on upstream because fixed 64 was accepted, and passed on this branch.

  • cargo check --locked -p d3d12_xs --tests passed with the updated fixture.

  • In a temporary merge with #56, I retained this branch's metadata check and #56's refusal message at their one overlapping guard. The two PSV regressions and all four focused GDS tests passed together. A separate clean merge with #62 at d5f5881 passed both PSV regressions and its lane-numbering test. That PR's new lane operations can use ex.guest_wave_size(&insns)? for the same metadata-aware decision.

  • cargo test -p tombox-xshader passes

  • No game or console files and no binaries included

  • No fake success; anything not possible is left missing with a note

**@⁠philip-roy-jones** on GitHub · 2026-11-21 22:16 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/65) `fix/psv-wave-size-metadata` → `main` · +127 −6 · 13 files · 1 commits · closed without merging **Library / area:** `tombox-xshader` shader metadata **Exports changed (exports.txt rows):** None **Source of the behaviour:** Microsoft's [PSVRuntimeInfo0 layout](https://github.com/microsoft/DirectXShaderCompiler/blob/915bf4f93a254d920b4bcab75b6b1c622eacd816/include/dxc/DxilContainer/DxilPipelineStateValidation.h#L103-L118), [DXC writer for compute shaders](https://github.com/microsoft/DirectXShaderCompiler/blob/915bf4f93a254d920b4bcab75b6b1c622eacd816/lib/DxilContainer/DxilPipelineStateValidation.cpp#L226-L235) and [HLSL wave size range specification](https://microsoft.github.io/hlsl-specs/proposals/0013-wave-size-range/). On `0fc7295`, extraction discarded both lane bounds. A synthetic `ds_append` program without a wave64-specific instruction passed the translator's wave32-only check even when PSV0 required 64 lanes. The reader now retains the bounds, `xshader` reports them, and the existing width check selects among the permitted RDNA2 widths. When both widths are allowed, the instruction-based decision still applies. I compiled empty compute shaders with DXC 1.8.2502.11 and used their unmodified PSV0 chunks with the same synthetic guest ISA. DXC and the updated reader agreed. | HLSL attribute | PSV0 bounds | Counter translation on this branch | | --- | --- | --- | | `WaveSize(64)` | 64 to 64 | Reaches the existing wave64 refusal | | `WaveSize(32)` | 32 to 32 | Translates | | `WaveSize(32,64)` or `WaveSize(32,64,64)` | 32 to 64 | Translates. The two PSV0 chunks are byte-identical | | `WaveSize(64,128)` | 64 to 128 | Wave64 refusal. The reader preserves the range | | No attribute | 0 to UINT32_MAX | Reports no requirement. A missing chunk also permits the existing fallback | **Verification** - `cargo test --locked -p tombox-xshader --no-fail-fast` on Windows/WARP gave 134 passed, 0 failed, 12 ignored on `0fc7295` and 136 passed, 0 failed, 12 ignored on `1d6b5a4`. - `cargo test --locked -p tombox-xshader --test synthetic` passed 9/9 upstream and 11/11 on the branch. A translation-only replay of the new regression failed on upstream because fixed 64 was accepted, and passed on this branch. - `cargo check --locked -p d3d12_xs --tests` passed with the updated fixture. - In a temporary merge with #56, I retained this branch's metadata check and #56's refusal message at their one overlapping guard. The two PSV regressions and all four focused GDS tests passed together. A separate clean merge with #62 at `d5f5881` passed both PSV regressions and its lane-numbering test. That PR's new lane operations can use `ex.guest_wave_size(&insns)?` for the same metadata-aware decision. - [x] `cargo test -p tombox-xshader` passes - [x] No game or console files and no binaries included - [x] No fake success; anything not possible is left `missing` with a note
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:09:02 +00:00
github-bot closed this pull request 2026-11-26 06:09:02 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.