cpp-migration: fix compile_lds_request.py's call to gfx2hlsl.load_compute_request #2944

Closed
opened 2026-11-26 22:33:58 +00:00 by SimSalabimse · 3 comments
SimSalabimse commented 2026-11-26 22:33:58 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T22:33:58Z.


Target branch cpp-migration, at e97c5c7c. Part of #2935 (Helper scripts).

Gap. tools/startup/compile_lds_request.py cannot run: main() calls gfx.load_compute_request(str(request), key, pipeline_type=partial(ComputePipeline, feedback=(('table', param), off))) at tools/startup/compile_lds_request.py:168-169, but load_compute_request is defined as load_compute_request(out_dir, key, refusals=None) at tools/startup/gfx2hlsl.py:10986 and always returns the base ComputePipeline(...) at :11008. The script's own ComputePipeline subclass (compile_lds_request.py:135-141, which needs the feedback= argument) is therefore never built. Reproduced on e97c5c7c with Python 3.13:

>>> inspect.signature(gfx2hlsl.load_compute_request)
(out_dir, key, refusals=None)
>>> gfx2hlsl.load_compute_request('.', 1, pipeline_type=None)
TypeError: load_compute_request() got an unexpected keyword argument 'pipeline_type'

No test reaches main(): tests/native_lds_control_flow_check.py only imports ComputeStage.

Proposed fix. Give gfx2hlsl.load_compute_request an optional pipeline_type=ComputePipeline keyword and build pipeline_type(code, parts['.root'], rsrc2, group, refusals=refusals). The default keeps every existing caller unchanged (gfx2hlsl.py:11015, :11042). Add a check that runs compile_lds_request.main() end to end.

Verification.

  • New Python check native_lds_request_cli (registered in a tests/cmake/ fragment). It writes a small synthetic compute request, using the existing write_request helper in tests/native_compute_clear_check.py if it fits, and runs main() with a fake compiler. It asserts that replay.json and the manifest are written, that the HLSL carries [WaveSize(32)] or [WaveSize(64)] as requested, and that the recorded SHA-256 values match the files.
  • Negative control: the same check fails on e97c5c7c with the TypeError above, and a request whose key does not match its files is refused with compute request files do not match the key in their name.
  • Regression: ctest --preset dev --no-tests=error -R "^native_lds_(warp|hardware|control_flow)$" -V on WARP and an RTX 4070 Ti, before and after the change.
  • The new check needs no GPU, so the WARP and RTX legs are regression runs only. I have not built the synthetic request yet.

Out of scope. Any change to the LDS lowering, to the feedback-image handling in ComputeStage, or to compile_sampled_pixel_request.py (#2935 says its manifest source is from reading only; I have not checked it).

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6636189033 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2944). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-26T22:33:58Z. --- Target branch `cpp-migration`, at `e97c5c7c`. Part of #2935 (Helper scripts). **Gap.** `tools/startup/compile_lds_request.py` cannot run: `main()` calls `gfx.load_compute_request(str(request), key, pipeline_type=partial(ComputePipeline, feedback=(('table', param), off)))` at `tools/startup/compile_lds_request.py:168-169`, but `load_compute_request` is defined as `load_compute_request(out_dir, key, refusals=None)` at `tools/startup/gfx2hlsl.py:10986` and always returns the base `ComputePipeline(...)` at `:11008`. The script's own `ComputePipeline` subclass (`compile_lds_request.py:135-141`, which needs the `feedback=` argument) is therefore never built. Reproduced on `e97c5c7c` with Python 3.13: ``` >>> inspect.signature(gfx2hlsl.load_compute_request) (out_dir, key, refusals=None) >>> gfx2hlsl.load_compute_request('.', 1, pipeline_type=None) TypeError: load_compute_request() got an unexpected keyword argument 'pipeline_type' ``` No test reaches `main()`: `tests/native_lds_control_flow_check.py` only imports `ComputeStage`. **Proposed fix.** Give `gfx2hlsl.load_compute_request` an optional `pipeline_type=ComputePipeline` keyword and build `pipeline_type(code, parts['.root'], rsrc2, group, refusals=refusals)`. The default keeps every existing caller unchanged (`gfx2hlsl.py:11015`, `:11042`). Add a check that runs `compile_lds_request.main()` end to end. **Verification.** - New Python check `native_lds_request_cli` (registered in a `tests/cmake/` fragment). It writes a small synthetic compute request, using the existing `write_request` helper in `tests/native_compute_clear_check.py` if it fits, and runs `main()` with a fake compiler. It asserts that `replay.json` and the manifest are written, that the HLSL carries `[WaveSize(32)]` or `[WaveSize(64)]` as requested, and that the recorded SHA-256 values match the files. - Negative control: the same check fails on `e97c5c7c` with the `TypeError` above, and a request whose key does not match its files is refused with `compute request files do not match the key in their name`. - Regression: `ctest --preset dev --no-tests=error -R "^native_lds_(warp|hardware|control_flow)$" -V` on WARP and an RTX 4070 Ti, before and after the change. - The new check needs no GPU, so the WARP and RTX legs are regression runs only. I have not built the synthetic request yet. **Out of scope.** Any change to the LDS lowering, to the feedback-image handling in `ComputeStage`, or to `compile_sampled_pixel_request.py` (#2935 says its manifest source is from reading only; I have not checked it). AI-Assisted
SimSalabimse commented 2026-11-26 22:34:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T22:34:01Z.


Taking this one. Environment: Windows 11 25H2 (26200), WARP and an NVIDIA GeForce RTX 4070 Ti (driver 32.0.16.2135), dev preset. The PR will target cpp-migration and link this issue.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7204792732 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2944#issuecomment-7204792732). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-26T22:34:01Z. --- Taking this one. Environment: Windows 11 25H2 (26200), WARP and an NVIDIA GeForce RTX 4070 Ti (driver 32.0.16.2135), `dev` preset. The PR will target `cpp-migration` and link this issue. AI-Assisted
MasterDomino commented 2026-11-26 22:51:40 +00:00 (Migrated from github.com)
Author
Contributor

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


@SimSalabimse this looks already fixed on cpp-migration by #2941 (@sydney-0o), merged as a990f323 about an hour ago. Worth checking before you start:

  • gfx2hlsl.load_compute_request now takes *, pipeline_type=ComputePipeline and builds pipeline_type(code, parts['.root'], rsrc2, group, refusals=refusals). The default leaves every existing caller unchanged.
  • compile_lds_request.main() gets an end-to-end check, native_lds_request (tests/native_lds_request_check.py, registered in tests/cmake/native_lds_request.cmake). It compiles a source-built request, inspects the bundle and refuses a tampered request.

Checked here on the merged tip: native_lds_request passes, and it fails with the gfx2hlsl.py and compile_lds_request.py from before #2941. If that covers it, this can be closed; if you see something #2941 missed, please add the detail here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7205047803 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2944#issuecomment-7205047803). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T22:51:40Z. --- @SimSalabimse this looks already fixed on `cpp-migration` by #2941 (@sydney-0o), merged as `a990f323` about an hour ago. Worth checking before you start: - `gfx2hlsl.load_compute_request` now takes `*, pipeline_type=ComputePipeline` and builds `pipeline_type(code, parts['.root'], rsrc2, group, refusals=refusals)`. The default leaves every existing caller unchanged. - `compile_lds_request.main()` gets an end-to-end check, `native_lds_request` (`tests/native_lds_request_check.py`, registered in `tests/cmake/native_lds_request.cmake`). It compiles a source-built request, inspects the bundle and refuses a tampered request. Checked here on the merged tip: `native_lds_request` passes, and it fails with the `gfx2hlsl.py` and `compile_lds_request.py` from before #2941. If that covers it, this can be closed; if you see something #2941 missed, please add the detail here. AI-assisted.
SimSalabimse commented 2026-11-26 22:59:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T22:59:22Z.


This is fixed on cpp-migration by #2941, which gives load_compute_request a keyword-only pipeline_type=ComputePipeline argument. I'm dropping my claim and won't open a PR for it.

As a check, I ran a GPU-free test of compile_lds_request.main() on ea07313b, with a stand-in compiler and a synthetic request. It exited 0: a mismatched key is refused, wave 32 and wave 64 each write replay.json, the manifest and [WaveSize(...)] with matching SHA-256 values, and the LDS subclass gets its feedback. Closing as fixed.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7205157466 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2944#issuecomment-7205157466). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-26T22:59:22Z. --- This is fixed on `cpp-migration` by #2941, which gives `load_compute_request` a keyword-only `pipeline_type=ComputePipeline` argument. I'm dropping my claim and won't open a PR for it. As a check, I ran a GPU-free test of `compile_lds_request.main()` on `ea07313b`, with a stand-in compiler and a synthetic request. It exited 0: a mismatched key is refused, wave 32 and wave 64 each write `replay.json`, the manifest and `[WaveSize(...)]` with matching SHA-256 values, and the LDS subclass gets its feedback. Closing as fixed. AI-Assisted
Sign in to join this conversation.
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#2944
No description provided.