shader: restore compilation of LDS replay requests #2941

Merged
sydney-0o merged 2 commits from upstream-pr/2941 into cpp-migration 2026-11-26 22:49:59 +00:00
sydney-0o commented 2026-11-26 22:31:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by sydney-0o on 2026-11-26T22:31:49Z.


On cpp-migration at e97c5c7c, the LDS replay CLI stops before compiling a valid slot 67 request with TypeError: load_compute_request() got an unexpected keyword argument 'pipeline_type'. The loader now constructs the requested pipeline after validating the input. Its compute stage can emit the native LDS and VOP2 pragmas and share VGPR write tracking with the standard stage. Returning LDS atomics validate their input operands before recording a write to the destination, including when address and destination alias.

The new CLI regression test compiles the source-built case F shader, inspects the bundle and checks that tampering with the request cannot publish another bundle. The control-flow test also exercises an atomic overwriting a partial d16 value and rejects an alias that reads undefined address bits.

Tested locally on Windows with MSVC and Windows SDK 10.0.26100 DXC at 71d468cf.

cmake --build --preset dev --target compile_dxil
ctest --preset dev --no-tests=error -R '^(native_lds_(request|control_flow)|startup_compute_request_offline)$'

3 passed, 0 skipped, 0 failed. The CLI test compiles the shader and checks its bundle. It does not dispatch it on a GPU.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5518037381 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2941). Originally posted by [sydney-0o](https://github.com/sydney-0o) on 2026-11-26T22:31:49Z. --- On `cpp-migration` at `e97c5c7c`, the LDS replay CLI stops before compiling a valid slot 67 request with `TypeError: load_compute_request() got an unexpected keyword argument 'pipeline_type'`. The loader now constructs the requested pipeline after validating the input. Its compute stage can emit the native LDS and VOP2 pragmas and share VGPR write tracking with the standard stage. Returning LDS atomics validate their input operands before recording a write to the destination, including when address and destination alias. The new CLI regression test compiles the source-built case F shader, inspects the bundle and checks that tampering with the request cannot publish another bundle. The control-flow test also exercises an atomic overwriting a partial d16 value and rejects an alias that reads undefined address bits. Tested locally on Windows with MSVC and Windows SDK 10.0.26100 DXC at `71d468cf`. ```powershell cmake --build --preset dev --target compile_dxil ctest --preset dev --no-tests=error -R '^(native_lds_(request|control_flow)|startup_compute_request_offline)$' ``` 3 passed, 0 skipped, 0 failed. The CLI test compiles the shader and checks its bundle. It does not dispatch it on a GPU. AI-assisted.
MasterDomino commented 2026-11-26 22:49:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T22:49:57Z.

Review: APPROVED


Review of head 71d468cf, tested merged onto cpp-migration 1cd48bd0. It merges cleanly. Approving and merging.

Code:

  • compile_lds_request.py now goes through load_compute_request(..., pipeline_type=...).
  • The DS path checks every input VGPR before it records the destination of a returning atomic, so an alias with the address or the data is checked first. Stage.u already walks every register of a v[a:b] range.
  • In gfx2hlsl.py, set_v is split into record_v_write plus set_v with the same steps. ComputePipeline.stage_type and the pipeline_type keyword default to the existing classes, so the runtime's translation path is unchanged.

Runs (Windows 11 26300.9974, AMD Radeon RX 9070 XT, release, Windows SDK 10.0.26100 DXC):

  • ctest --preset release --no-tests=error -R '^(native_lds_(request|control_flow|warp|hardware)|startup_compute_request_offline)$': 5/5 passed.
  • All 131 tests/startup_gfx2hlsl_*_check.py run bare: 129 passed. The two draw checks (export_null_draw, mul24_align_draw) need their CTest arguments and fail the same way on every branch when run bare.
  • Control: I restored compile_lds_request.py and gfx2hlsl.py from 1cd48bd0 and ran the new native_lds_request command, and it fails (the CLI exits non-zero). Restoring the PR files makes it pass.
  • No change to the runtime's translations: a copy of a cache written by the current runtime, translated with gfx2hlsl.py --pending and X2W_FXC= (translation only), with the base and with this PR. The outcome is identical for all 4,100 records, 321 ok on both.

The new test compiles and inspects the bundle but does not dispatch it, as the description says. native_lds_hardware still dispatches the DXC path.

AI-assisted; the commands above were run locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6081252940 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2941#pullrequestreview-6081252940). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T22:49:57Z. **Review:** APPROVED --- Review of head `71d468cf`, tested merged onto `cpp-migration` `1cd48bd0`. It merges cleanly. Approving and merging. **Code:** - `compile_lds_request.py` now goes through `load_compute_request(..., pipeline_type=...)`. - The DS path checks every input VGPR before it records the destination of a returning atomic, so an alias with the address or the data is checked first. `Stage.u` already walks every register of a `v[a:b]` range. - In `gfx2hlsl.py`, `set_v` is split into `record_v_write` plus `set_v` with the same steps. `ComputePipeline.stage_type` and the `pipeline_type` keyword default to the existing classes, so the runtime's translation path is unchanged. **Runs** (Windows 11 26300.9974, AMD Radeon RX 9070 XT, release, Windows SDK 10.0.26100 DXC): - `ctest --preset release --no-tests=error -R '^(native_lds_(request|control_flow|warp|hardware)|startup_compute_request_offline)$'`: 5/5 passed. - All 131 `tests/startup_gfx2hlsl_*_check.py` run bare: 129 passed. The two draw checks (`export_null_draw`, `mul24_align_draw`) need their CTest arguments and fail the same way on every branch when run bare. - **Control:** I restored `compile_lds_request.py` and `gfx2hlsl.py` from `1cd48bd0` and ran the new `native_lds_request` command, and it fails (the CLI exits non-zero). Restoring the PR files makes it pass. - **No change to the runtime's translations:** a copy of a cache written by the current runtime, translated with `gfx2hlsl.py --pending` and `X2W_FXC=` (translation only), with the base and with this PR. The outcome is identical for all 4,100 records, 321 `ok` on both. The new test compiles and inspects the bundle but does not dispatch it, as the description says. `native_lds_hardware` still dispatches the DXC path. AI-assisted; the commands above were run locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows!2941
No description provided.