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

Closed
opened 2026-11-24 15:42:47 +00:00 by pickles976 · 3 comments
pickles976 commented 2026-11-24 15:42:47 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-24T15:42:47Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:6585618689 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/1412). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-24T15:42:47Z. --- ## 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.
KarolKurzyna commented 2026-11-24 17:06:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by KarolKurzyna on 2026-11-24T16:27:46Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7137703467 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/issues/1412#issuecomment-7137703467). Originally posted by [KarolKurzyna](https://github.com/KarolKurzyna) on 2026-11-24T16:27:46Z. --- 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.
pickles976 commented 2026-11-24 17:06:28 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-24T16:31:32Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7137800924 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/issues/1412#issuecomment-7137800924). Originally posted by [pickles976](https://github.com/pickles976) on 2026-11-24T16:31:32Z. --- 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.
KarolKurzyna commented 2026-11-24 17:06:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ivall/xcl. Originally posted by KarolKurzyna on 2026-11-24T16:38:39Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7137985916 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/issues/1412#issuecomment-7137985916). Originally posted by [KarolKurzyna](https://github.com/KarolKurzyna) on 2026-11-24T16:38:39Z. --- 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).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl#1402
No description provided.