[WIP] shader: offline native compute cache follow-up #3350

Draft
github-bot wants to merge 2 commits from github-bot/gh-3348 into main AGit
Owner

@⁠romn4rch on GitHub · 2026-11-28 11:23 UTC · original
romn4rch:copilot/pr-1994-wip-4dff51a0d → main · +3377 −0 · 5 files · 2 commits · draft

Draft replacement for #1994; this is intentionally incomplete and is not ready to merge. The branch contains partial toolchain-fingerprint and unit-regression work. Still outstanding: the one-program/#1441 artifact-boundary rescope and a fenced GPU readback of the offline-produced artifact with an identity-refusal control. Required cache/GPU validation could not run because the configured CTest suite, DXC, LLVM, probe binaries, and offline-artifact GPU harness are unavailable.

The original PR remains open. This draft overlaps its scope and is published only to preserve the partial work; please keep only one submission if this work later becomes complete.

**@⁠romn4rch** on GitHub · 2026-11-28 11:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3348) `romn4rch:copilot/pr-1994-wip-4dff51a0d` → `main` · +3377 −0 · 5 files · 2 commits · draft Draft replacement for #1994; this is intentionally incomplete and is not ready to merge. The branch contains partial toolchain-fingerprint and unit-regression work. Still outstanding: the one-program/#1441 artifact-boundary rescope and a fenced GPU readback of the offline-produced artifact with an identity-refusal control. Required cache/GPU validation could not run because the configured CTest suite, DXC, LLVM, probe binaries, and offline-artifact GPU harness are unavailable. The original PR remains open. This draft overlaps its scope and is published only to preserve the partial work; please keep only one submission if this work later becomes complete.
Add a bounded offline translation pipeline and revision-2 cache for two source-built gfx1013 compute programs.

- Reuse pixel_aot and compute_store_aot for native instruction decoding and lowering.
- Compile generated HLSL into validated and signed desktop DXIL.
- Add canonical records, deterministic cache keys and SHA-256 artifact verification.
- Enforce dependency identity, root-signature compatibility and backend PSO evidence.
- Implement ownership-aware publication, request quarantine and cache refusal handling.
- Add source-built fixtures, negative controls and reproducible Windows/WSL documentation.

Verification:
- Native machine-code preflight: PASS.
- Offline native cache: 156/156 checks passed.
- WARP and Intel Iris Xe root/PSO creation: PASS.
- Selected upstream regression tests: 9/9 passed.
- Fresh native code, records, HLSL and CSOs match the previously accepted vectors.
- Stale validated manifests are rejected.
- Documentation, bidi and diff checks passed.

Tested against upstream commit 3682b34f.

This contribution is offline-only. It introduces no slot 62 loader, C++ runtime integration, production slot 67 parsing, Dispatch or ExecuteIndirect implementation.

The verification scripts are manually invoked and are not registered in CTest.

Refs #1412
Related to #1954.
Co-authored-by: Copilot App <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 11:27:33 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 08:36 UTC · original · reviewed

Comment on 4dff51a0 (draft). Evidence: reading the diff and the head blobs, plus git merge-tree against main 1341bd6b (clean). Nothing was built or run.

  • The documented cache-suite command fails since 4dff51a0. tests/compute_native_cache_check.py:141 now hashes --llvm on the Windows host (77f9530d called expected_identity() with no library). Its default (:32, :113) is the Linux path /usr/lib/llvm-15/lib/libLLVM-15.so.1, and the command at docs/experiments.md:18106-18108 passes no --llvm. The read fails, :148 sets identity = {}, and :152 identity["translator"] raises KeyError. The same string is passed to the WSL translate stage (:257), so one value has to name the library on both sides. Fix: hash the library inside the WSL worker and carry the hash back, or take separate host and WSL paths.
  • The compile stage does not detect an LLVM change. stage_compile builds expected without library (tools/startup/compute_native.py:1274), so it has no llvm key. inspect_entry (:957) and verify_translation_receipt (:1161) compare only fields present in expected, and the manifest's llvm is copied from the receipt (:1327) or from the old manifest (:1315). docs/experiments.md:18078-18080 says a manifest from another LLVM library is stale and the compile stage rebuilds it. Only the translate stage can see that.
  • Refusals carry no identity (publish_refusal, :1086), inspect_entry returns refused without comparing one (:930-948), and all three stages skip refused keys (:1183, :1216, :1282). docs/experiments.md:18053-18055 documents this as permanent per revision. The effect is that a translator change which would accept the program is not retried until REVISION changes or the cache is deleted. Recording translator and pipeline in the refusal manifest would let the translate stage retry.
  • docs/experiments.md:18011 says both programs store to a RWTexture2D<uint>. The required HLSL is RWByteAddressBuffer outputData : register(u0); (tests/compute_native_check.py:199), with the root signature SRV(t0),UAV(u0),... (:115).
  • CI runs tests/compute_native_check.py --unit only, which is tool_unit_checks (:479): the group-product refusal, and that the llvm/compiler/validator hashes change with their files. The second check still passes if the validator argument is ignored, because its dxil.dll sits beside dxc.exe (:498-500), which is the fallback path (compute_native.py:212). serialize/parse, cache_key, parse_manifest, writer_lock, stage_request, publish_refusal/publish_error/publish_corrupt and the missing, stale, refused and corrupt branches of inspect_entry use only the standard library and repository files, so they can run in the Linux job without LLVM, DXC or WSL. So can translate_text (:176) and controls (:223), which lower authored text.
  • Scope: easier to review split into (a) the record/manifest/cache library with toolchain-free tests in CI, and (b) the WSL/DXC/probe orchestration and manual suites. docs/experiments.md:18119-18120 says the measured results do not verify this revision; rerun them on the head that lands.
**@⁠Leyukaka** on GitHub · 2026-11-29 08:36 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3348#pullrequestreview-6102107408) · **reviewed** Comment on 4dff51a0 (draft). Evidence: reading the diff and the head blobs, plus `git merge-tree` against main 1341bd6b (clean). Nothing was built or run. - The documented cache-suite command fails since 4dff51a0. `tests/compute_native_cache_check.py:141` now hashes `--llvm` on the Windows host (77f9530d called `expected_identity()` with no library). Its default (:32, :113) is the Linux path `/usr/lib/llvm-15/lib/libLLVM-15.so.1`, and the command at docs/experiments.md:18106-18108 passes no `--llvm`. The read fails, :148 sets `identity = {}`, and :152 `identity["translator"]` raises KeyError. The same string is passed to the WSL translate stage (:257), so one value has to name the library on both sides. Fix: hash the library inside the WSL worker and carry the hash back, or take separate host and WSL paths. - The compile stage does not detect an LLVM change. `stage_compile` builds `expected` without `library` (tools/startup/compute_native.py:1274), so it has no `llvm` key. `inspect_entry` (:957) and `verify_translation_receipt` (:1161) compare only fields present in `expected`, and the manifest's `llvm` is copied from the receipt (:1327) or from the old manifest (:1315). docs/experiments.md:18078-18080 says a manifest from another LLVM library is stale and the compile stage rebuilds it. Only the translate stage can see that. - Refusals carry no identity (`publish_refusal`, :1086), `inspect_entry` returns `refused` without comparing one (:930-948), and all three stages skip refused keys (:1183, :1216, :1282). docs/experiments.md:18053-18055 documents this as permanent per revision. The effect is that a translator change which would accept the program is not retried until REVISION changes or the cache is deleted. Recording `translator` and `pipeline` in the refusal manifest would let the translate stage retry. - docs/experiments.md:18011 says both programs store to a `RWTexture2D<uint>`. The required HLSL is `RWByteAddressBuffer outputData : register(u0);` (tests/compute_native_check.py:199), with the root signature `SRV(t0),UAV(u0),...` (:115). - CI runs `tests/compute_native_check.py --unit` only, which is `tool_unit_checks` (:479): the group-product refusal, and that the `llvm`/`compiler`/`validator` hashes change with their files. The second check still passes if the `validator` argument is ignored, because its dxil.dll sits beside dxc.exe (:498-500), which is the fallback path (compute_native.py:212). `serialize`/`parse`, `cache_key`, `parse_manifest`, `writer_lock`, `stage_request`, `publish_refusal`/`publish_error`/`publish_corrupt` and the missing, stale, refused and corrupt branches of `inspect_entry` use only the standard library and repository files, so they can run in the Linux job without LLVM, DXC or WSL. So can `translate_text` (:176) and `controls` (:223), which lower authored text. - Scope: easier to review split into (a) the record/manifest/cache library with toolchain-free tests in CI, and (b) the WSL/DXC/probe orchestration and manual suites. docs/experiments.md:18119-18120 says the measured results do not verify this revision; rerun them on the head that lands.
This pull request has changes conflicting with the target branch.
  • docs/experiments.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3350/head:github-bot/gh-3348'
git switch 'github-bot/gh-3348'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3348'
git switch 'github-bot/gh-3348'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3348'
git switch 'github-bot/gh-3348'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3348'
git switch 'main'
git merge --squash 'github-bot/gh-3348'
git switch 'main'
git merge --ff-only 'github-bot/gh-3348'
git switch 'main'
git merge 'github-bot/gh-3348'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.