Cache refused programs and failed compiles — boot pays for the same refusals every run; markers must be capability-keyed #1412

Closed
opened 2026-11-26 04:53:08 +00:00 by github-bot · 3 comments
Owner

@⁠pickles976 on GitHub · 2026-11-24 15:42 UTC · original

The problem: refusals are permanent customers of boot time

Marvisak/VIctory#1089 filed this for their translator; we have the gap twice, in two different layers:

  1. DXC compile failures are not cached. compile_cached_in_with (dxc.rs:768) writes only on success; a deterministically failing compile (unsupported construct reaching DXIL, poisoned diagnostic) re-pays the full DXC invocation every run. The counters even count it (counters.failure), so report.json shows the same failures every boot — nobody is saving the answer.
  2. Translator refusals never reach the cache at all. … is not supported errors (64-bit image atomic, untracked-mask select — the classes populating #675 logs) are emitted upstream of compile_cached_in_with, so a refused program is re-lowered from scratch every launch forever. On story-load titles the refusal set is stable run-to-run, which means a stable, pointless multi-second slice of every cold boot — and it scales with the corpus, i.e. worst exactly on the mesh-heavy runs (#675) where boot time is already the user complaint.

Constraint: negative entries are capability-scoped, not content-scoped

A refusal is only as durable as the capability set that produced it — our own BCPack merge flipped 512 refusals into successes (first field confirmation #1337: 512 → 0). A naive content-keyed marker file would then poison the cache against the fix. Requirements for any implementation:

  • Marker key = current positive cache key ∪ translator/lowering revision ∪ lowering-affecting config (wave mode per #1407, post-#1398 GVN state) — or equivalent: store the digest of exactly the capability inputs and invalidate markers whose digest drifted at load time.
  • Markers must be skipped (and deleted) when an env override is in play that changes capability (XCL_DEBUG_PS_SUB, wave knobs) — a debugging session must never write or read them.
  • Keep the refusal reason text in the marker: the counters/log line today re-derives it; a marker hit should reproduce the identical log line so cohort triage is unchanged.

Acceptance: two consecutive runs with an unchanged corpus re-run zero DXC invocations and zero re-lowerings for previously refused programs (counters prove it: second-run compilations and refusal counts flat), and adding one instruction to the spec (or removing it) invalidates exactly the affected markers, per the digest.

**@⁠pickles976** on GitHub · 2026-11-24 15:42 UTC · [original](https://github.com/xcl-dev/xcl/issues/1412) ## The problem: refusals are permanent customers of boot time Marvisak/VIctory#1089 filed this for their translator; we have the gap **twice**, in two different layers: 1. **DXC compile failures are not cached.** `compile_cached_in_with` (`dxc.rs:768`) writes only on success; a deterministically failing compile (unsupported construct reaching DXIL, poisoned diagnostic) re-pays the full DXC invocation every run. The counters even count it (`counters.failure`), so `report.json` shows the same failures every boot — nobody is saving the answer. 2. **Translator refusals never reach the cache at all.** `… is not supported` errors (64-bit image atomic, untracked-mask select — the classes populating #675 logs) are emitted upstream of `compile_cached_in_with`, so a refused program is **re-lowered from scratch every launch forever**. On story-load titles the refusal set is stable run-to-run, which means a stable, pointless multi-second slice of every cold boot — and it scales with the corpus, i.e. worst exactly on the mesh-heavy runs (#675) where boot time is already the user complaint. ## Constraint: negative entries are capability-scoped, not content-scoped A refusal is only as durable as the capability set that produced it — our own BCPack merge flipped 512 refusals into successes (first field confirmation #1337: 512 → 0). A naive content-keyed marker file would then **poison the cache against the fix**. Requirements for any implementation: - Marker key = current positive cache key **∪** translator/lowering revision **∪** lowering-affecting config (wave mode per #1407, post-#1398 GVN state) — or equivalent: store the digest of exactly the capability inputs and invalidate markers whose digest drifted at load time. - Markers must be skipped (and deleted) when an env override is in play that changes capability (`XCL_DEBUG_PS_SUB`, wave knobs) — a debugging session must never write or read them. - Keep the refusal *reason text* in the marker: the counters/log line today re-derives it; a marker hit should reproduce the identical log line so cohort triage is unchanged. Acceptance: two consecutive runs with an unchanged corpus re-run **zero** DXC invocations and zero re-lowerings for previously refused programs (counters prove it: second-run `compilations` and refusal counts flat), and adding one instruction to the spec (or removing it) invalidates exactly the affected markers, per the digest.
github-bot 2026-11-26 04:53:08 +00:00
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:53:08 +00:00
Author
Owner

@⁠KarolKurzyna on GitHub · 2026-11-24 16:27 UTC · original

I'll take this on a clean branch off main.

Plan:

  1. Add capability-keyed negative cache markers for deterministic DXC compile failures in crates/xcl/src/gpu/recomp/dxc.rs and for translator refusals upstream of DXC in crates/xcl/src/gpu/recomp/pso.rs, keyed on the content/translation inputs plus translator revision and capability-affecting config (wave mode, GVN/extra flags), storing the exact refusal reason text so log and counter reporting stay identical on subsequent runs.
  2. Bypass negative marker reads and writes whenever capability-changing env/debug overrides are set (XCL_DEBUG_*, XCL_SAFE_BARRIER, forced wave knobs), deleting any stale or mismatched markers cleanly.
**@⁠KarolKurzyna** on GitHub · 2026-11-24 16:27 UTC · [original](https://github.com/xcl-dev/xcl/issues/1412#issuecomment-7137703467) I'll take this on a clean branch off `main`. Plan: 1. Add capability-keyed negative cache markers for deterministic DXC compile failures in `crates/xcl/src/gpu/recomp/dxc.rs` and for translator refusals upstream of DXC in `crates/xcl/src/gpu/recomp/pso.rs`, keyed on the content/translation inputs plus translator revision and capability-affecting config (wave mode, GVN/extra flags), storing the exact refusal reason text so log and counter reporting stay identical on subsequent runs. 2. Bypass negative marker reads and writes whenever capability-changing env/debug overrides are set (`XCL_DEBUG_*`, `XCL_SAFE_BARRIER`, forced wave knobs), deleting any stale or mismatched markers cleanly.
Author
Owner

@⁠pickles976 on GitHub · 2026-11-24 16:31 UTC · original

Go ahead — plan matches the acceptance. Two traps to save a round-trip, both from the #1147/#1086 evidence trail this issue came out of: ① capability inputs must include the lowering-affecting env knobs — XCL_SPLIT_WAVE64, wave options, XCL_DEBUG_PS_SUB: a marker written under a debug override must never be read (or written) in a clean run; the cheap invariant is override present ⇒ markers off entirely, not "override folded into the key" (the key space silently explodes and every debug session forks the cache). ② a marker hit must reproduce the identical refusal log line the live translation emits today (same reason string, same call site) — half this issue's value is cohort triage from log tails, and a marker that logs differently makes run-2 reports incomparable with run-1 corpus. Third, smaller: on digest-drift invalidation, delete stale markers rather than ignore them, or refusals counts stay flat forever after the translator changes and the counters stop being honest.

**@⁠pickles976** on GitHub · 2026-11-24 16:31 UTC · [original](https://github.com/xcl-dev/xcl/issues/1412#issuecomment-7137800924) Go ahead — plan matches the acceptance. Two traps to save a round-trip, both from the #1147/#1086 evidence trail this issue came out of: ① **capability inputs must include the lowering-affecting env knobs** — `XCL_SPLIT_WAVE64`, wave options, `XCL_DEBUG_PS_SUB`: a marker written under a debug override must never be read (or written) in a clean run; the cheap invariant is *override present ⇒ markers off entirely*, not "override folded into the key" (the key space silently explodes and every debug session forks the cache). ② a marker hit must **reproduce the identical refusal log line** the live translation emits today (same reason string, same call site) — half this issue's value is cohort triage from log tails, and a marker that logs differently makes run-2 reports incomparable with run-1 corpus. Third, smaller: on digest-drift invalidation, **delete** stale markers rather than ignore them, or `refusals` counts stay flat forever after the translator changes and the counters stop being honest.
Author
Owner

@⁠KarolKurzyna on GitHub · 2026-11-24 16:38 UTC · original

Opened #1472 implementing capability-keyed negative cache markers for both deterministic DXC failures (XCLFAIL1 <key>.fail in dxc.rs) and upstream translator refusals (XCLTRNF1 <stem>.fail in pso.rs), skipping/deleting markers under capability-changing and debug env overrides and preserving compilation_errors / counter reporting. Verified on RTX 3070 Ti with .\scripts\test.ps1 (776 passed, 0 failed, 41 ignored) and a 60 s xcl-smoke run (1656 frames shown, 0 device removals / crashes).

**@⁠KarolKurzyna** on GitHub · 2026-11-24 16:38 UTC · [original](https://github.com/xcl-dev/xcl/issues/1412#issuecomment-7137985916) Opened #1472 implementing capability-keyed negative cache markers for both deterministic DXC failures (`XCLFAIL1` `<key>.fail` in `dxc.rs`) and upstream translator refusals (`XCLTRNF1` `<stem>.fail` in `pso.rs`), skipping/deleting markers under capability-changing and debug env overrides and preserving `compilation_errors` / counter reporting. Verified on RTX 3070 Ti with `.\scripts\test.ps1` (`776 passed, 0 failed, 41 ignored`) and a 60 s `xcl-smoke` run (`1656` frames shown, `0` device removals / crashes).
This discussion has been locked. Commenting is limited to contributors.
No description provided.