Repository navigation
compile_dxil: invalidate a published manifest when sidecar content changes with an older timestamp - #3137
compile_dxil: invalidate a published manifest when sidecar content changes with an older timestamp#3137lambirou wants to merge 2 commits into
Conversation
… mtime The watcher treated a pixel-input sidecar as current whenever its timestamp was not newer than the manifest, so a content change with a preserved or older mtime kept a stale accepted manifest. Publish an FNV-1a digest of the .psin/.ps57in bytes next to the manifest and compare it before a cache hit; the batch graphics path writes the same digest. Regression: native_startup_request_cache_check.py now covers an unchanged cache hit, a contradictory .ps57in both older and newer than the manifest, and a changed .psin with a preserved mtime. Refs R0Y00#3133. Refs R0Y00#3091.
|
Note: the Windows checks workflow triggers only for pull requests to |
|
CI-equivalent smoke receipt for this branch-targeted PR. The 41/41 passed, 0 failed (20.4 s). The 12 |
|
Migration impact measured on the reference rev-29 cache, to answer the expected review question. The cache at A manifest that does have a sidecar and no Note for context: that cache also carries 5,365 |
R0Y00
left a comment
There was a problem hiding this comment.
Two paths still allow a stale manifest by code inspection. In is_watch_request_pending, graphics_psin_path(req.marker) correctly resolves an .rtv request to the base sidecar for the mtime check, but pixel_sidecar_hash(req.marker, ...) hashes paths beside the variant marker itself. An older or preserved-mtime change on the base .psin/.ps57in can therefore keep an RTV variant as a cache hit. Please run the same invalidation control for both the base and a published .rtv variant.
The watch and batch writers also hash fresh filesystem reads after compiling from input.pixel_entry. If a sidecar changes during compilation, a digest of the new bytes can be published next to DXIL made from the old bytes. Persist an identity from the same snapshot that was validated and compiled, or verify that the new read matches that snapshot before publishing. #3138 uses the existing .psdep from the parsed request and has a base-plus-RTV control. Please coordinate so the shared watcher fix lands once while preserving both contributors’ test evidence.
pigalot
left a comment
There was a problem hiding this comment.
I reviewed 2ce9f112 merged over current codex/native-shader-modules a48d39dc, the PR's base. The merge is clean and git diff --cached --check is clean. #3138 fixes the same issue (#3133) by comparing against .psdep, so I ran each PR's new regressions against the other's build.
What I ran. I built compile_dxil native_compute_pack_check native_frozen_request_check native_pixel_ir_dump native_compute_ir_dump in dev, then ran
ctest --test-dir out/build/dev --no-tests=error -j 1 -R '^(native_compile_dxil_watch|native_startup_request_cache_controls|native_rtv_variant_controls|native_direct_container|native_frozen_request)$'5/5 pass.
Blocking: an RTV variant keeps a stale manifest. I ran #3138's tests/native_compile_dxil_watch_check.py against this build, and it fails in its RTV case:
- Publish a base
req_<b>.aand an RTV variantreq_<v>.rtv(put_graphics_requestandput_variant), then run--once. - Add a contradictory
req_<b>.ps57inwhose mtime is 60 s older than both manifests. - Run
--onceagain. The base is withdrawn (refused: conflicting stream and slot-57 pixel entry records), but<v>.txtis still served. The assert namesvariant.
The cause is that pixel_sidecar_hash(req.marker, ...) replaces the marker's own extension. For an .rtv marker that gives req_<v>.psin / req_<v>.ps57in, which never exist, so the digest step is skipped. A variant's sidecars are its base's, which is what graphics_psin_path resolves (and what the existing mtime check already uses). Hashing *graphics_psin_path(req.marker) in the pending check, and in compile_watch_item for variants, should close it. A variant case in native_startup_request_cache_check.py would pin it.
Cross-check the other way. #3138 also passes this PR's native_startup_request_cache_check.py regressions once the .psinh-file existence assert is removed (native_startup_request_cache_controls passes on #3138's build).
Non-blocking (not measured). The digest is computed from the sidecar on disk when the manifest is published, not from the bytes the compile read. If a sidecar is rewritten while a compile is running, the digest records the new bytes next to a manifest built from the old ones, and the stale manifest stays a cache hit. #3138 avoids this by comparing against .psdep, which is written from the description that was compiled.
Verdict: changes requested on 2ce9f112, for the RTV variant case. Since #3138 also passes this PR's four regressions, the branch owner may want to pick one of the two.
Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10. These are CPU-only checks.
This reply was AI-assisted.
…le snapshot An .rtv variant hashed paths beside its own marker, so a base .psin/.ps57in change with an older or preserved mtime kept the variant manifest. Resolve the base sidecars for the digest, like the mtime check, and add a variant regression to native_startup_request_cache_check. Also hash the sidecars before and after translation; a change during the compile refuses the publish instead of pairing new bytes with old DXIL.
Review update (2026-11-27,
|
|
#3138 is now approved by both reviewers and covers the same base-plus- |
pigalot
left a comment
There was a problem hiding this comment.
Re-reviewed 13c7cfab merged over current codex/native-shader-modules a48d39dc, the PR's base. The merge is clean and git diff --cached --check is clean.
The blocking finding from my review of 2ce9f112 is fixed. For an .rtv marker, pixel_sidecar_hash now hashes the base's sidecars through graphics_psin_path. The request-cache control has a variant case.
The non-blocking note is addressed too. Both the watch path (compile_watch_item) and the batch path now hash the sidecars before reading the request and again after both compiles. If the two hashes differ, the step throws and no manifest is published (the watch path also removes the stale one). The digest written to .psinh is the one taken before the read.
What I ran. I built compile_dxil native_compute_pack_check native_frozen_request_check native_pixel_ir_dump native_compute_ir_dump in dev, then ran
ctest --test-dir out/build/dev --no-tests=error -j 1 -R '^(native_compile_dxil_watch|native_startup_request_cache_controls|native_rtv_variant_controls|native_direct_container|native_frozen_request)$'5/5 pass.
Cross-check. #3138's tests/native_compile_dxil_watch_check.py (the RTV case that failed on 2ce9f112) now passes against this build. With the cross-check the other way from my first review, each PR's regressions pass on the other's build.
Mutants in tools/startup/compile_dxil.cpp. For each, I rebuilt compile_dxil in dev and ran the same 5 tests:
| Mutant | Result |
|---|---|
.rtv marker hashes its own (missing) sidecars again |
killed (native_startup_request_cache_controls) |
| watch path skips the before/after comparison | survives |
| watch path publishes the after-compile digest | survives, equivalent while the comparison stands (the two digests are equal) |
Restored and rebuilt afterwards; git diff --quiet is clean.
Non-blocking. The before/after comparison isn't pinned, because no test rewrites a sidecar while a compile is running. That's hard to do deterministically, and the code is small and reads correctly. I'm only noting it as unmeasured.
Verdict: approve on 13c7cfab. This PR and #3138 now both fix #3133, so as lambirou says, it's for R0Y00 to pick which one lands. R0Y00's changes request on 2ce9f112 still stands, and the base is a codex/* branch, so this is review only.
Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; DXC 1.9.2602.17; Python 3.12.10. These are CPU-only checks.
This reply was AI-assisted.
|
@R0Y00 pigalot approved |
|
Agree with both APPROVED reviews: FNV-1a sidecar digest in |
|
Thank you for this work, and for offering to close it if #3138 was the choice. #3138 fixes the same stale-manifest case on the same base and merged at 2026-11-28T06:15Z, so I'm closing this as its duplicate.
One part is still worth having on the base: section 7's check that an unchanged RTV variant stays a cache hit ( This comment was AI-assisted. |
Change
A watched pixel-input sidecar could change content while keeping a preserved or older timestamp.
is_watch_request_pendingcompared only the sidecar mtime against the manifest, so the request stayed a cache hit and the stale accepted manifest kept being served.The published manifest now records an FNV-1a digest of the sidecar bytes (
<key>.psinh, over the.psin/.ps57inextension, length and content). The watch path writes it before the manifest, the batch graphics path writes the same file, and the watcher withdraws the manifest when the digest differs. Unchanged bytes stay a cache hit. Existing manifests without a digest are retranslated once.Refs #3133. Refs #3091. Targets
codex/native-shader-moduleswhile #3091 is open.Verification
Windows 10 Pro 26H2 build 26300.10075, MSVC 19.51, Windows SDK and DXC 10.0.26100.0. These checks are CPU-only.
Commit
2ce9f112innative/stale-manifest-mtime.native_startup_request_cache controls: passed, including the new regressions:.psin-> cache hit, manifest not rewritten;.ps57inwith an mtime older than the manifest -> manifest withdrawn,conflicting stream and slot-57 pixel entry records;.failcontent;.psinwith a preserved mtime -> manifest withdrawn (invalid pixel input description).native_compile_dxil_watch: passed (--oncecontrols, resume/recheck, live watch retry/skip/recovery, CLI negative controls).Evidence and follow-up
The digest covers the sidecar extension, its length and its bytes, so moving bytes between
.psinand.ps57inchanges it. No public fixture or asset is added. The watch and batch paths share the same digest writer, so a cache built by either path is interoperable with the watcher.Review update (2026-11-27,
13c7cfab)Both R0Y00/pigalot findings are addressed.
pixel_sidecar_hashnow resolves an.rtvmarker to its base.psinpath, the same pathgraphics_psin_pathuses for the mtime check, and hashes the base.psin/.ps57inpair. A base sidecar change with an older or preserved mtime now withdraws the variant as well as the base.pixel input sidecar changed during compilation; no manifest or stage is published from the mismatched snapshot.native_startup_request_cache_check.pynow publishes a base plusreq_<base>.rtv, then checks unchanged hits, an older-mtime conflicting.ps57in, a newer-mtime conflict, and a preserved-mtime.psinchange. Both base and variant manifests must be withdrawn or restored together.Verification at
13c7cfab, dev and release:native_compile_dxil_watch,native_startup_request_cache_controlsandnative_rtv_variant_controlspass 3/3.docs_links_checkandbidi_controls_checkpass. This PR keeps the.psinhidentity; #3138 is the alternative.psdepimplementation. CI is not triggered for this branch target; the local receipt is above.