tooling: support .rtv variant requests in compile_dxil --watch and --refusals #3003
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3003"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-27T04:05:16Z.
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.0Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-27T04:12:49Z.
Review: COMMENTED
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.native-compile-dxil-refusals.mdandnative-compile-dxil-watch.mdare accurate and concise.native_compile_dxil_refusals_check.pyis thorough: valid variants, forged headers, missing manifests, bad format codes, and same-key dedup all exercise the logic.--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_markersnoting the pre-sorted invariant. Otherwise this is clean and ready to land.🏷 Minor:
native_compile_dxil_watch_check.pyimportsput_variantbut the test also creates a live-watcher variant section — consider keeping it focused on the --watch lifecycle and moving the --once RTV compile test tonative_compile_dxil_refusals_check.py(or vice versa) for better separation.Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-27T04:17:16Z.
Thank you for the review, @KelboLive!
Added the explicit pre-sorted invariant comment on
dedupe_graphics_markersind53f8230(rebuiltcompile_dxiland re-rannative_compile_dxil_refusals,native_compile_dxil_watch, andnative_rtv_variant_controls— 3/3 passed).A few quick notes on the remaining observations:
token.size() > 20matchessrc/shader_compute_request.cppbecauseUINT64_MAXis 20 decimal digits (18446744073709551615), andstd::from_charsreturnsstd::errc::result_out_of_rangeon overflow.wchar_t name[32]withstd::swprintf(name, std::size(name), ...)safely bounds the fixed 27-characterreq_%016llx.psinoutput.--onceis a sub-mode ofcompile_dxil --watch, so testing--onceRTV behavior insidenative_compile_dxil_watch_check.pykeeps the--watchCLI coverage in one place.Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-27T04:36:19Z.
Review: APPROVED
Review of head
d53f8230. Its last commit only adds the sorted-input comment ondedupe_graphics_markers; the code was tested ate71272c0. CI on the head is green. This closes the.rtvgap I noted on #2992. Approving and merging.Code read:
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-migratione0d83759; 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_refusalsand the threenative_rtv_variant_*tests passed.Mutation here: letting
--watchignore.rtvmarkers failsnative_compile_dxil_watchon the variant'scompiled graphicsline. With it restored, it passes.I will close #3001 by hand.
AI-assisted; the commands above were run locally.