Repository navigation
Conversation
lukaslw-lab
approved these changes
Nov 30, 2026
lukaslw-lab
left a comment
Contributor
There was a problem hiding this comment.
Reviewed a5a2eb57 (draft) by reading the diff; not built or run.
Verdict: approve. The runtime reads .csir with the same key, file checks and decoder that compile_dxil and the pack already use, and every result except hit falls back to the same translate_compute call. No MUST.
- SHOULD Rebase:
src/startup_stubs/d3d12_compute_dispatch.inlconflicts with main on thetranslated natively ... (frontend %s)log line (9fcfe0d, native shader totals). It is a small merge, but the new log suffix your test checks lives there. - NIT The runtime never publishes a
.csirafter a live translation; the test asserts this (tests/native_compute_csir_check.py:42). So a warm run still needs an offlinecompile_dxilbatch. If the runtime stays read-only on purpose (keeping cache writes offdraw_lock, a single writer), say so indocs/experiments/native-startup-request-cache.md, so nobody "fixes" it later. - Checked, no finding:
- The key is
slot67_digest, the same one the pack andprepare_direct_computeuse, and the frontend revision comes from the sharedx2w_shader_compilersources. - A heap view contract cannot reach a non-container
.csir(prepare_direct_computethrows). - Refusals are never cached, so refused keys behave as before.
- Any open error other than not-found counts as
invalidand goes live. lookupkeeps its old result forcached_compute_irand the pack builder.- It merges cleanly with #3472.
- The key is
Tests: native_compute_csir_hardware proves the hit (with the bytecode deleted, so the frontend really came from .csir), the identity, checksum and decode fallbacks, and that every route gives the same 320 words. The three mutations show each check is reached. CI did not run it: it is not in the Windows pr filter, and it needs wave32 hardware. The only results are the author's local run and the sandbox run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #2935
What changes
At the first Dispatch of a slot-67 request,
translate_compute_natively(src/startup_stubs/d3d12_compute_dispatch.inl) now looks for a cached frontend result in<cache>\nativebefore it callstranslate_compute. The lookup runs after a pack miss or when no pack is loaded. A pack hit or a pack refusal behaves as before.lookup_compute_frontend(src/direct_compute_cache.cpp) builds the key withslot67_digest, the function the pack andprepare_direct_computealready use: frontend revision, entry offset, SHA-256 of the six request parts. It reads<key>.csironly. It never publishes.lookupintolookup_frontend_payload: size bounds, stored identity equal to the key, SHA-256 of the payload.lookupis now a wrapper around it, andcached_compute_irgoes through the same reader (lookup_compute_ir), which also runsdecode.hit,missing,identity_mismatchorinvalid. Anything buthitgoes to the sametranslate_compute(*frozen, entry, true)call as before.<cache>\nativeis the directory the route already passed to the DXC bytecode compile.compile_dxilfills it when it gets that directory asCACHE_DIRECTORY(documented indocs/experiments/native-startup-request-cache.md).(frontend cached), or with(frontend live)plus the reason. The heartbeat gains acompute frontend cache: hits, misses, identity mismatches, invalidline.With no
.csirpresent, the route does one extra file open per key at first Dispatch, then translates live as before.Why
On
ff9dcef0the route translated live at first Dispatch unlessX2W_NATIVE_COMPUTE_PACKheld the key. The.csirfiles thatcompile_dxilwrites were never read there, so an offlinecompile_dxilbatch over saved requests did not shorten a later run unless a pack was also built.Evidence
Local build of
compile_dxil,native_compute_pack_check,startup_stream_consumerandd3d12_xs_shim, thenctest -R '^(native_compute_csir_hardware|native_compute_pack(_hardware)?|native_compile_dxil_watch|startup_compute_dispatch_native_(hardware|warp))$':native_compute_csir_hardware(new)native_compute_packnative_compute_pack_hardwarenative_compile_dxil_watchstartup_compute_dispatch_native_hardwarestartup_compute_dispatch_native_warpThe same filter gives the same results in a clean Windows Sandbox build (dev preset, MSVC, network off).
The WARP test skips because the adapter has no 32-lane waves. Before it exits 77 it still checks the refusal and the published-translation fallback (320 words).
native_compute_csir_hardwaredoes the following on a hardware adapter, comparing all 320 words with the CPU reference and with the live run each time:(frontend live) (frontend cache miss), and no.csiris left behind.compile_dxilbuilds the same request offline into<cache>\native. The bytecode.binfiles are deleted. A fresh runtime process logs(frontend cached).(frontend live) (frontend cache identity mismatch).(frontend live) (invalid frontend cache entry).(frontend live) (invalid frontend cache entry).In 3 and 4 the damaged file is byte-identical after the run.
Mutations, each built and run alone, each fails
native_compute_csir_hardware:missing: fails on the(frontend cached)check.lookup_frontend_payload: fails on the identity-mismatch check.return Result::hit): fails on the damaged-entry check.Not covered
--jobs(compute: prepare the compute pack on several threads (--jobs) #3472).direct_compute_cache.cppchanges the frontend revision, so.csirfiles and packs built before this commit miss and need regenerating.