Repository navigation
Conversation
Share request hashing and .psin/.rtv parsing helpers in shader_compute_request, add `compile_dxil --rekey OLD_CACHE_DIR NEW_REQUEST_DIR [--jobs N]`, register `native_compile_dxil_rekey`, and document verification. Fixes R0Y00#3012 Refs R0Y00#2935
R0Y00
left a comment
There was a problem hiding this comment.
A merge trial of 50d53508 with #3006 5c49bbe3 conflicts in tools/startup/compile_dxil.cpp. Please coordinate the landing order and rebase the second PR, preserving both rekey behavior and the native output revision checks. After resolving, the focused integration coverage is native_compile_dxil_rekey, native_compile_dxil_watch, and the published-dispatch refusal controls.
KelboLive
left a comment
There was a problem hiding this comment.
What works
- Clean extraction of shared helpers (fnv1a_64, request key
computations, psin/rtv parsing) into shader_compute_request.{h,} and
reuse ofread_rekey_bytesandread_rekey_stringin the compile_dxil
--rekey mode. The C++ rekey is a proper parity match with the Python
original. - Atomic publishing of rewritten requests (ready markers written last) +
exit code 1 failure before any writes on incomplete/malformed requests.
This avoids partial-cache corruption on rekey failure. - Parallel processing with configurable job count (defaulting to
hardware_concurrency, capped at 64) -- sensible defaults and good CLI. - The Python test verifies byte-for-byte parity with the Python rekey,
idempotency, read-only preservation, and all incomplete-request / CLI
negative controls.
Issues
shader_compute_request.hadds several top-level declarations (fnv1a_64,
request key functions, parse_pixel_input_description, etc.) as
non-namespaced C functions but also declaresx2w::PixelInputDescription
andx2w::RtvVariantDescriptioninside thex2wnamespace. The mixed
namespace placement could be confusing -- the helper functions should
likely live inside x2w:: too.rekey_request_pathuses a hardcodedreq_prefix string literal.
This is consistent with the marker format but should ideally reference a
shared constant if marker parsing is done elsewhere.- No test case for
.m86(already-present) vs.a/.c67/.m57) marker
counting. The doc mentions counting.m86markers but the test doesn't
explicitly verify this count (good that it preserves already-present files,
but a dedicated test would help).
Recommendations
- Consider moving the standalone C functions (fnv1a_64, format/parse_*)
into the x2w namespace or into an internal detail namespace. - Rekey test could add a dedicated check for the .m86 counter.
Overall
Excellent utility function: a native rekey parity match with the Python
original, with proper atomicity, parallelism, and error handling.
Approvable after the namespace note.
|
@R0Y00 Happy to let #3006 land first since it touches more files. As soon as #3006 merges into @KelboLive Thanks for reviewing! Two quick clarifications from the diff:
|
Adds
--rekeytocompile_dxilas the native C++ equivalent oftools/startup/shader_cache_rekey.py.Changes
src/shader_compute_request.{h,cpp}: Expose sharedfnv1a_64,graphics_request_key,compute_request_key,mesh57_request_key,.psinparser/formatter, and.rtvparser/formatter helpers reused byread_graphics_request,read_compute_request, andcompile_dxil --rekey.tools/startup/compile_dxil.cpp: Implementcompile_dxil --rekey OLD_CACHE_DIR NEW_REQUEST_DIR [--jobs N](noSDK_DIRECTORYor DXC required):OLD_CACHE_DIRforreq_<16-hex>markers (.a,.c67,.m57,.rtv), counts.m86markers, and ignores result/diagnostic files (.txt,.fail,.cso,.psdep).NEW_REQUEST_DIR; incomplete/unreadable/malformed requests exit1without writing anything, and invalid CLI usage orOLD_CACHE_DIR == NEW_REQUEST_DIRexits2..a,.c67,.m57written last), rewrites.psinand.rtvpayloads with the updated keys, skips already-present files inNEW_REQUEST_DIR, and leavesOLD_CACHE_DIRuntouched.tests/native_compile_dxil_rekey_check.py&tests/cmake/native_compile_dxil_rekey.cmake: Registernative_compile_dxil_rekeytesting revision-constant parity across C++ and Python, byte-for-byte parity withshader_cache_rekey.py,gfx2hlsl.pending_keyscompatibility,--jobs 1vs--jobs 2determinism, idempotency, source-directory immutability, 7 incomplete/corrupted negative controls, and 8 CLI negative controls.docs/experiments/native-compile-dxil-rekey.md: Document--rekeyusage and verification.Verification (commit
50d53508)Result:
5/5passed (native_compile_dxil_refusals,native_compile_dxil_rekey,native_compile_dxil_watch,native_rtv_variant_controls,native_startup_request_cache_controls).Result: all passed (
54Markdown files /571links,2170tracked files checked).Fixes #3012
Refs #2935