Skip to content

Include shader-lowering switches in cache identity - #112

Open
andrewDoing wants to merge 2 commits into
DexNom:mainfrom
andrewDoing:fix/interpolation-cache-key
Open

andrewDoing wants to merge 2 commits into
DexNom:mainfrom
andrewDoing:fix/interpolation-cache-key

Conversation

@andrewDoing

@andrewDoing andrewDoing commented Nov 26, 2026 •

Copy link
Copy Markdown

VICTORY_FIRST_HALF and VICTORY_FIRSTLANE_OWN affect shader translation but were absent from disk-cache identity. A translation produced under one setting could be reused under another, including bypassing a refusal.

Include both settings in the cache switches. For FIRST_HALF, four warm CLI processes toggling 0/1/0/1 each translated two synthetic programs; cache entries accumulated 2/4/4/4 instead of baseline 2/2. A synthetic pixel program refused with the setting at 0 and emitted DXIL at 1. For FIRSTLANE_OWN, fresh processes using unset/1/0/1 created 1/2/3/3 entries, confirming isolation and repeat reuse.

Pinned Rust 1.98.1: both workspace Clippy configurations and asset policy passed; serial workspace tests: 683 passed, 0 failed, 12 ignored with CI's software-adapter setting. No gameplay run.

Thanks to @retrope13 for independently testing the PR and identifying the missing FIRSTLANE_OWN switch. GPT-6.2 Astra implemented and tested the changes.

@retrope13

Copy link
Copy Markdown

Independent hardware-GPU Windows verification and env-var audit of #112 (83a49c66) against main (64bd58f5): both Clippy configs, shader_cache tests (debug + release), and full real-GPU workspace suite pass with 0 failures — plus one sibling missing switch spotted in lower.rs.

Tested

  • Hardware / Env: NVIDIA GeForce RTX 4060 Laptop GPU (8 GB, driver 32.0.16.2140), Intel Core i5-14500HX (14C/20T), 24 GB RAM, Windows 11 26H2 (build 26300.9818), pinned rustc 1.98.1 (x86_64-pc-windows-msvc), verified BCPack tables via Initialize-FormatTables.ps1.
  • Targeted shader_cache tests:
    • cargo test --locked -p victory-gpu shader_cache: 2 passed, 0 failed in both debug (0.02 s) and --release (0.02 s).
  • Clippy (both CI configs):
    • cargo clippy --workspace --all-targets --locked -- -D warnings: pass (exit 0)
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass (exit 0)
  • Full workspace suite (real hardware GPU, VICTORY_TESTS_ALLOW_SOFTWARE_SKIP unset):
    • cargo test --workspace --locked --no-fail-fast -- --test-threads=1: 683 passed, 0 failed, 12 ignored.

Diff & Env-Var Audit (crates/victory-shader/ vs. crates/victory-gpu/src/shader_cache.rs:81-90)

  • Confirmed "VICTORY_FIRST_HALF" (lower.rs:1543) is cleanly hashed by raw var_os value in shader_cache::build().
  • Sibling missing switch found — VICTORY_FIRSTLANE_OWN (crates/victory-shader/src/emit/lower.rs:7683): Auditing every std::env::var* in crates/victory-shader/ turned up one remaining translation-affecting switch that is not in shader_cache.rs:81-90:
    • With VICTORY_FIRSTLANE_OWN=1, lower.rs:7683-7684 takes the host wave's own first lane (return int(self, mine)) and caches DXIL.
    • With VICTORY_FIRSTLANE_OWN unset or 0, lower.rs:7687 refuses translation (Err("a first-lane read where not every lane runs")).
    • Without "VICTORY_FIRSTLANE_OWN" in shader_cache.rs:81-90, a shader cached under =1 can still be served on a later run with it unset (bypassing the refusal, same class of issue as VICTORY_FIRST_HALF).
  • All other translation-affecting switches in crates/victory-shader/ (VICTORY_SHADER_LOOP_LIMIT, VICTORY_GROUP_SYNC, VICTORY_RAY_TRACING / VICTORY_AMBIENT_FALLBACK, VICTORY_SHADER_OPT, VICTORY_WAVE_*, VICTORY_F16_NEAREST, VICTORY_STRICT_JOINS, VICTORY_MESH_OUTPUT_STRICT) are accounted for in shader_cache::build(), and the capture probes bypass the cache in host_shader().

Not Tested

  • Live retail gameplay runs, AMD GPUs, and the 12 #[ignore] tests.

AI disclosure: Antigravity (Gemini 4 Neon, High) ran the checks, audited all victory-shader env switches, and drafted this report.

@andrewDoing andrewDoing changed the title Include interpolation mode in shader cache identity Include shader-lowering switches in cache identity Nov 26, 2026
@andrewDoing

Copy link
Copy Markdown
Author

Thanks @retrope13 for the independent hardware run and for finding VICTORY_FIRSTLANE_OWN. Confirmed: it changes the first-lane lowering/refusal path and was missing from the key. Pushed 8669c76 to include it.

Fresh CLI processes with the setting unset / 1 / 0 / 1 produced 1 / 2 / 3 / 3 cache entries, confirming isolation and repeat reuse. Targeted shader-cache tests, both workspace Clippy configurations and asset policy passed; the full serial workspace suite passed with 683 passed and 12 ignored using the CI software-adapter setting. No gameplay run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants