Skip to content

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

Draft
romn4rch wants to merge 2 commits into
R0Y00:mainfrom
romn4rch:copilot/pr-1994-wip-4dff51a0d
Draft

romn4rch wants to merge 2 commits into
R0Y00:mainfrom
romn4rch:copilot/pr-1994-wip-4dff51a0d

Conversation

@romn4rch

Copy link
Copy Markdown
Contributor

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.

ArnabSaga and others added 2 commits November 28, 2026 14:59
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 3682b34.

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 R0Y00#1412
Related to R0Y00#1954.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@Leyukaka Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • The documented cache-suite command fails since 4dff51a. tests/compute_native_cache_check.py:141 now hashes --llvm on the Windows host (77f9530 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants