Repository navigation
tooling: support .rtv variant requests in compile_dxil --watch and --refusals - #3003
Conversation
KelboLive
left a comment
There was a problem hiding this comment.
Good addition — wire-in with the RTV variant request system and solid test coverage across refusals, --watch dedup, and recheck paths.
Findings
✅ What works well
dedupe_graphics_markersmirrorsgfx2hlsl.py::request_sourcesemantics exactly: same stem,.a+.rtvpair → keep the variant.graphics_psin_pathcorrectly parses thertv1 <base hex>header and produces the matchingreq_<base>.psin.- Documentation updates for both
native-compile-dxil-refusals.mdandnative-compile-dxil-watch.mdare accurate and concise. - Test coverage in
native_compile_dxil_refusals_check.pyis thorough: valid variants, forged headers, missing manifests, bad format codes, and same-key dedup all exercise the logic. - Parallelism guard (
--jobs 2producing identical JSON output) is a nice defensive touch.
⚠️ Issues / observations
-
dedupe_graphics_markersassumes sorted adjacency — the function only compares consecutive elements. This is correct sincegraphics_inputsis sorted viaPathLess{}before dedup, but a comment like// inputs are PathLess-sorted before this callwould make the invariant explicit for future readers. -
std::from_charsinteger overflow — thertv1header token is validated for ASCII digit-only, but no length cap. You checktoken.size() > 20which is fine (max0xFFFFFFFFFFFFFFFFis 16 hex digits = 10 decimal digits). However, if someone writes00000000000000000000(20 zeros),from_charsparses it without issue. No overflow risk, but worth a note if the parsing logic changes later. -
std::swprintfbuffer size —wchar_t name[32]accommodatesreq_(4) +%016llx(16) +.psin(5) + null (1) = 27 wide chars, so 32 is fine. However, consider usingstd::formatorsnwprintfif this module starts accepting wider inputs. -
--watchlive recheck path — the test shows.bfile mutation followed by.psintouch triggering variant recheck. The production code should propagate the.bchange to the variant.psinpaths throughgraphics_psin_path. The test asserts 3 refused after.bmismatch — make sure both the base and variant.psinpaths converge correctly.
Recommendation
Consider adding a brief comment at the top of dedupe_graphics_markers noting the pre-sorted invariant. Otherwise this is clean and ready to land.
🏷 Minor: native_compile_dxil_watch_check.py imports put_variant but the test also creates a live-watcher variant section — consider keeping it focused on the --watch lifecycle and moving the --once RTV compile test to native_compile_dxil_refusals_check.py (or vice versa) for better separation.
|
Thank you for the review, @KelboLive! Added the explicit pre-sorted invariant comment on A few quick notes on the remaining observations:
|
MasterDomino
left a comment
There was a problem hiding this comment.
Review of head d53f8230. Its last commit only adds the sorted-input comment on dedupe_graphics_markers; the code was tested at e71272c0. CI on the head is green. This closes the .rtv gap I noted on #2992. Approving and merging.
Code read:
- Shared dedupe:
dedupe_graphics_markersis now used by--requests,--refusalsand--watch, with the variant winning for a key with both markers. .psinfor variants:graphics_psin_pathresolves a variant's.psinto its base's, asgfx2hlsl.py::request_sourcedoes, so--watchrechecks a variant when the base description changes.--refusals: a variant now also needs a runtime manifest, the same rule--requestsapplies.--watch: variants are compiled with their formats and publish thertv1manifest line.
Run on AMD: Windows 11 26300.9974, AMD Radeon RX 9070 XT (driver 32.0.32029.2010), plus WARP, release. This was tested together with #2975, #2986, #2996 and #2998 merged onto cpp-migration e0d83759; all five merge cleanly with each other. ctest --preset release --no-tests=error -R '^(native_.*|startup_compute_dispatch(_.*)?_(warp|hardware)|startup_slot67_indirect_dispatch_warp|startup_compute_translate_e2e_warp|startup_stream_draw.*|startup_native_graphics.*)$' gives 94 tests, 90 passed and 4 skipped (77, WARP has no 32-lane waves). native_compile_dxil_watch, native_compile_dxil_refusals and the three native_rtv_variant_* tests passed.
Mutation here: letting --watch ignore .rtv markers fails native_compile_dxil_watch on the variant's compiled graphics line. With it restored, it passes.
I will close #3001 by hand.
AI-assisted; the commands above were run locally.
Target branch
cpp-migration. Fixes #3001. Refs #2935.Behavior
Wire
req_<key>.rtvvariant requests (#2989) into bothcompile_dxil --refusalsandcompile_dxil --watch(tools/startup/compile_dxil.cpp):.psinresolution:dedupe_graphics_markersso--requests,--refusals, and--watchall give.rtvprecedence when.aand.rtvshare a key (matchingtools/startup/gfx2hlsl.py::request_source).graphics_psin_pathto resolvereq_<base>.psinfrom an.rtvfile'srtv1 <base> ...header so--watchtracks base.psin/.psdepchanges for RTV variants too.compile_dxil --refusals:req_<key>.rtvalongsidereq_<key>.a, runs read-onlyprepare_direct_graphics(..., /*write_cache=*/false, input.rtv_formats), and validatesformat_graphics_runtime_manifest(pair, input.rtv_request)without invoking DXC or writing files.compile_dxil --watch:req_<key>.rtvalongside.a/.c67, passesinput.rtv_formatsandinput.rtv_request, and publishes<variant>.{vs.cso,ps.cso,psdep,txt}(with trailingrtv1 ...line) or<variant>.failon refusal.tests/native_compile_dxil_refusals_check.pyandtests/native_compile_dxil_watch_check.pywith.rtvpositive/negative controls and updatesdocs/experiments/native-compile-dxil-{refusals,watch}.md.Verification
e71272c0(based onorigin/cpp-migratione0d83759)10.0.26100.0