tooling: translate requests written during a watch pass first #3396
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3396"
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 Leyukaka on 2026-11-28T19:39:01Z.
Change
gfx2hlsl.py --watchsorted pending requests by key (pending_keys) and translated the whole list before it scanned again, so a request written during a pass waited for the entire backlog. Within a watch pass, requests whose ready marker is newer than the watcher's start now go first, newest first. They run in batches of up to four keys per worker, with a rescan between batches at most once per second. The worker pool is sized by--jobsonce and reused across batches. A request written after the pass has used its last snapshot, within a second of the last scan, waits for the next pass, as before.--pendingkeeps its order. The first-pass retry of earlier failures and--skip-failedare unchanged, and each key's outputs are the same.Refs #3392 (the
gfx2hlsl.pyhalf;compile_dxil --watchis not changed here).Verification
Commit
d6c879a1onmain543c250c, Windows 11, Python fromout/pe-env.python -B tests/startup_gfx2hlsl_watch_order_check.py: passes. It uses a synthetic cache with 8 old requests, 1 new request and 1 request written during the pass, with translation stubbed and the clock faked. The new request is in the first batch, the mid-pass one is taken by the first rescan, older requests keep their key order, and both orders write byte-identical files.python -B tests/startup_gfx2hlsl_watch_order_check.py --negative-control: fails on purpose (the old order puts the new request last).python -B tests/startup_gfx2hlsl_watch_check.py: passes.measure_watch_order.py, a local script), 3,500 old requests and 5 new ones present when the pass starts, 2 ms per stubbed translation, one worker:The table covers requests present when the pass starts; a request written during the pass is covered by the test only. Rescanning after every batch of one key per worker would rescan about 220 times per 3,513 requests with 16 workers, hence the once-per-second limit.
Evidence and follow-up
Synthetic requests only, written by the test; no application data. Not measured: a real run with
-Translate, and passes with several worker processes (the stub cannot cross process boundaries). Thecompile_dxil --watchhalf of #3392 is left for a follow-up.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-28T20:33:47Z.
Review: APPROVED
LGTM — clean, well-tested.
Updates gfx2hlsl.py watch pass to prioritize fresh requests by timestamp. Adds pending_batches for rate-limited batch processing (up to 4×jobs keys per batch, 1s scan interval). pending_keys now returns recent requests (written since watch start) in newest-first order, followed by older ones. Handles retry of earlier failures only once. New test startup_gfx2hlsl_watch_order_check.py verifies priority, batch boundaries, and parity with legacy ordering. Minimal diff, no behavioral regressions.
Ready to land.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-28T21:02:32Z.
Review: APPROVED
LGTM — substantial but well-structured.
tools/startup/compute_native.py implements the offline native gfx1013 compute adapter and cache (Stage 4B.2) with clear stage separation (request, translate, compile). Record serialization/parsing with strict validation, translation through existing translator (machine code -> HLSL via LLVM), DXC compilation with embedded root signature, dxil.dll validation, intrinsic gate, PSO probing, and integrity-checked manifest publication. Single-writer cache with O_EXCL lock, atomic writes, and token-based ownership. Exit codes properly distinguish permanent refusals, retryable failures, and cache hits.
Ready to land.
Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-28T21:56:52Z.
Review: APPROVED
LGTM — targeted, well-tested change.
tools/startup/gfx2hlsl.py --watchnow prioritizes requests written during a pass ahead of the older backlog.pending_keyssplits results into recent (newest-first) and legacy order;translate_pendingbatches them at four keys per worker and rescans between batches at most once per second; the worker pool is sized by--jobsonce and reused.watch_since_nstracks the pass start so only newer-than-pass markers get priority. New teststartup_gfx2hlsl_watch_order_check.pyvalidates priority, batch boundaries, and byte-identical outputs against the legacy order. Non-breaking — same keys translated, different order.Ready to land.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T21:57:38Z.
Review: COMMENTED
Reviewed head
d6c879a1.Code read:
translate_pendingnow takes batches frompending_batches; a watch pass puts ready markers newer than the watcher start first (newest first), rescans at most once per second, and reuses one pool. Each key is attempted once per pass (attempted), so first-pass retries are unchanged. Withoutwatch_since_nsthe old single-snapshot order is kept (--pendingunchanged). No issue found.Verification (Win2025, dev and release, this head):
x2w_pipe.py win2025 3396 --regex 'gfx2hlsl_watch':startup_gfx2hlsl_watch_orderandstartup_gfx2hlsl_watch2/2 passed on dev and 2/2 on release; the pipeline's Windows Python checks passed.AI-assisted; commands listed were executed locally.