Offline warm marks pipelines as done even when no host pipeline was created #188

Closed
opened 2026-11-27 07:25:59 +00:00 by github-bot · 2 comments
Owner

@⁠NotADonky43 on GitHub · 2026-11-27 07:25 UTC · original

What happens

victory warm receives made <index> <ms> 0 when a recipe cannot create a host pipeline (e.g. its shader is missing from the local recipe book). It nevertheless appends that key to warm-done.txt. A normal subsequent warm skips the recipe even after the shader is available. This is distinct from #185 (shader-cache writes) and #184 (explicit shader skips).

Verified on Windows, no game files needed

The included CLI regression creates two synthetic compute recipes but initially records only one shader. Stock bcbb7959 reports one refusal and puts both keys in warm-done.txt. After appending the missing shader, stock attempts zero pipelines. With the patch, the first run records one success; the next invocation attempts and creates the repaired pipeline, then the next invocation skips the two actual successes. The regression also exercises an old ambiguous success entry. The app suite, recorded-pipeline tests and repository policy test passed.

The patch records success only when the worker really created a pipeline. It versions success records because old lines cannot distinguish successes from refusals. It leaves explicitly skipped shaders and the existing timeout/device-loss quarantine unchanged. Permanently unsupported recipes can be attempted again on a later invocation, not in a loop during the same warm-up. This is not a runtime FPS claim.

Source patch and synthetic regression (apply with git apply)
diff --git a/apps/victory/src/warm.rs b/apps/victory/src/warm.rs
index 6b49bb8d..cd7aed99 100644
--- a/apps/victory/src/warm.rs
+++ b/apps/victory/src/warm.rs
@@ -38,6 +38,9 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t
     let began = Instant::now();
     victory_hle::known_pipelines::use_translations(dir.with_file_name("shaders"));
     let fingerprint = known::fingerprint();
+    // Earlier entries did not distinguish a successful creation from a refusal.
+    // Retry that history once; only this marker certifies a created pipeline.
+    let success_key = format!("made-v1:{fingerprint}");
     let done_file = dir.join("warm-done.txt");
     let bad_file = dir.join("warm-bad.txt");
     let entries = known::warm_entries(&dir);
@@ -45,7 +48,7 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t
     let mut done: HashSet<&str> = HashSet::new();
     for line in listed.lines() {
         if let Some((of, key)) = line.split_once(' ')
-            && of == fingerprint
+            && of == success_key
         {
             done.insert(key);
         }
@@ -95,7 +98,12 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t
                 println!("{count} of {}, {:.0} s", all.len(), began.elapsed().as_secs_f64());
             }
             drop(state);
-            writeln!(lock(&done_out), "{fingerprint} {}", entries[n].key).context("writing warm-done.txt")
+            // A recipe can be missing a shader or the driver can refuse it.
+            // Neither case warmed a pipeline. Leave it eligible next time.
+            if there {
+                writeln!(lock(&done_out), "{success_key} {}", entries[n].key).context("writing warm-done.txt")?;
+            }
+            Ok(())
         },
         |n, why| {
             println!("pipeline {n} {}: {why}", entries[n].key);
@@ -108,8 +116,8 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t
     times.sort_by(f64::total_cmp);
     let at = |q: f64| times.get((times.len() as f64 * q) as usize).copied().unwrap_or(0.0);
     println!(
-        "{} made in {:.0} s ({refused} have no host pipeline, {crashed} ended their process); ms each: median {:.1}, p90 {:.1}, p99 {:.1}, most {:.0}, sum {:.0} s",
-        times.len(),
+        "{} made in {:.0} s ({refused} have no host pipeline, {crashed} ended their process); ms per completed attempt: median {:.1}, p90 {:.1}, p99 {:.1}, most {:.0}, sum {:.0} s",
+        times.len() - refused,
         began.elapsed().as_secs_f64(),
         at(0.5),
         at(0.9),
diff --git a/apps/victory/tests/warm_refused.rs b/apps/victory/tests/warm_refused.rs
new file mode 100644
index 00000000..62a995e0
--- /dev/null
+++ b/apps/victory/tests/warm_refused.rs
@@ -0,0 +1,101 @@
+#![cfg(all(windows, feature = "diagnostics"))]
+
+use std::fs;
+use std::io::Write;
+use std::path::Path;
+use std::process::Command;
+
+fn compute_shader() -> Vec<u8> {
+    // A native wave32 compute group whose only instruction is s_endpgm.
+    let words = [
+        u32::from_le_bytes(*b"FSPX"), 1, 3, 120,
+        0, 64, 28, 0, 6, 92, 4, 0, 7, 96, 24, 0,
+        0, 0, 0, 0x0001_0020, 0x0010_0001, 0, 0,
+        0xBF81_0000, 0x403, 4, 1, 0, 0, 0x40,
+    ];
+    let program: Vec<_> = words.into_iter().flat_map(u32::to_le_bytes).collect();
+    let mut bytes = b"DXBC".to_vec();
+    bytes.extend([0; 16]); // digest unused by the parser
+    for word in [1, 44 + program.len() as u32, 1, 36] {
+        bytes.extend(word.to_le_bytes());
+    }
+    bytes.extend(b"ACCC");
+    bytes.extend((program.len() as u32).to_le_bytes());
+    bytes.extend(program);
+    bytes
+}
+
+fn write_recipe(dir: &Path, key: u8, shader: &[u8]) {
+    let mut recipe = vec![key; 16];
+    recipe.extend([1, 5]); // one stage, compute
+    recipe.extend(blake3::hash(shader).as_bytes());
+    recipe.push(0); // no graphics state
+    let mut file = fs::OpenOptions::new().create(true).append(true)
+        .open(dir.join("known-pipelines.bin")).unwrap();
+    file.write_all(&(recipe.len() as u32).to_le_bytes()).unwrap();
+    file.write_all(&recipe).unwrap();
+}
+
+fn shader_record(shader: &[u8]) -> Vec<u8> {
+    let mut record = vec![5];
+    record.extend(blake3::hash(shader).as_bytes());
+    record.extend((shader.len() as u32).to_le_bytes());
+    record.extend(shader);
+    record
+}
+
+fn warm(root: &Path) -> String {
+    let mut command = Command::new(env!("CARGO_BIN_EXE_victory"));
+    // Isolate the fixture from the operator's adapter and translation settings.
+    for (key, _) in std::env::vars_os() {
+        if key.to_string_lossy().to_ascii_uppercase().starts_with("VICTORY_") {
+            command.env_remove(key);
+        }
+    }
+    let output = command
+        .args(["warm", "--jobs", "1"])
+        .current_dir(root)
+        .env("VICTORY_CACHE_DIR", root)
+        .env("VICTORY_DATA_DIR", root.join("data"))
+        // The debug-only switch also works on hosts without a discrete GPU.
+        .env("VICTORY_D3D12_WARP", "1")
+        .output()
+        .unwrap();
+    assert!(output.status.success(), "{output:?}");
+    String::from_utf8(output.stdout).unwrap()
+}
+
+#[test]
+fn a_pipeline_with_a_missing_shader_is_retried_after_the_book_is_repaired() {
+    let cache = tempfile::tempdir().unwrap();
+    let root = cache.path();
+    let dir = root.join("pipelines");
+    fs::create_dir(&dir).unwrap();
+    let shader = compute_shader();
+    let mut other = shader.clone();
+    other[4] = 1; // distinguish the recorded containers without changing the program
+    write_recipe(&dir, 0x11, &shader);
+    write_recipe(&dir, 0x22, &other);
+    let book = dir.join("known-shaders.bin");
+    fs::write(&book, shader_record(&shader)).unwrap();
+
+    let first = warm(root);
+    let done = dir.join("warm-done.txt");
+    let recorded = fs::read_to_string(&done).unwrap();
+    assert!(first.contains("1 made in") && first.contains("1 have no host pipeline"), "{first}");
+    assert_eq!(recorded.lines().count(), 1, "{recorded}");
+    assert!(recorded.trim_end().ends_with(&"11".repeat(16)), "{recorded}");
+    assert!(fs::read(dir.join("warm-bad.txt")).unwrap().is_empty());
+
+    let fingerprint = recorded.split_whitespace().next().unwrap().strip_prefix("made-v1:").unwrap();
+    let mut history = fs::OpenOptions::new().append(true).open(&done).unwrap();
+    writeln!(history, "{fingerprint} {}", "22".repeat(16)).unwrap();
+    drop(history);
+    fs::OpenOptions::new().append(true).open(&book).unwrap().write_all(&shader_record(&other)).unwrap();
+    let repaired = warm(root);
+    assert!(repaired.contains("1 to make") && repaired.contains("1 made in"), "{repaired}");
+    let recorded = fs::read_to_string(&done).unwrap();
+    assert_eq!(recorded.lines().filter(|line| line.starts_with("made-v1:")).count(), 2, "{recorded}");
+    assert!(recorded.trim_end().ends_with(&"22".repeat(16)), "{recorded}");
+    assert!(warm(root).contains("0 to make"));
+}
\ No newline at end of file
**@⁠NotADonky43** on GitHub · 2026-11-27 07:25 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/188) ### What happens `victory warm` receives `made <index> <ms> 0` when a recipe cannot create a host pipeline (e.g. its shader is missing from the local recipe book). It nevertheless appends that key to `warm-done.txt`. A normal subsequent warm skips the recipe even after the shader is available. This is distinct from #185 (shader-cache writes) and #184 (explicit shader skips). ### Verified on Windows, no game files needed The included CLI regression creates two synthetic compute recipes but initially records only one shader. Stock `bcbb7959` reports one refusal and puts **both** keys in `warm-done.txt`. After appending the missing shader, stock attempts **zero** pipelines. With the patch, the first run records **one** success; the next invocation attempts and creates the repaired pipeline, then the next invocation skips the two actual successes. The regression also exercises an old ambiguous success entry. The app suite, recorded-pipeline tests and repository policy test passed. The patch records success only when the worker really created a pipeline. It versions success records because old lines cannot distinguish successes from refusals. It leaves explicitly skipped shaders and the existing timeout/device-loss quarantine unchanged. Permanently unsupported recipes can be attempted again on a later **invocation**, not in a loop during the same warm-up. This is not a runtime FPS claim. <details> <summary>Source patch and synthetic regression (apply with git apply)</summary> ```diff diff --git a/apps/victory/src/warm.rs b/apps/victory/src/warm.rs index 6b49bb8d..cd7aed99 100644 --- a/apps/victory/src/warm.rs +++ b/apps/victory/src/warm.rs @@ -38,6 +38,9 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t let began = Instant::now(); victory_hle::known_pipelines::use_translations(dir.with_file_name("shaders")); let fingerprint = known::fingerprint(); + // Earlier entries did not distinguish a successful creation from a refusal. + // Retry that history once; only this marker certifies a created pipeline. + let success_key = format!("made-v1:{fingerprint}"); let done_file = dir.join("warm-done.txt"); let bad_file = dir.join("warm-bad.txt"); let entries = known::warm_entries(&dir); @@ -45,7 +48,7 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t let mut done: HashSet<&str> = HashSet::new(); for line in listed.lines() { if let Some((of, key)) = line.split_once(' ') - && of == fingerprint + && of == success_key { done.insert(key); } @@ -95,7 +98,12 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t println!("{count} of {}, {:.0} s", all.len(), began.elapsed().as_secs_f64()); } drop(state); - writeln!(lock(&done_out), "{fingerprint} {}", entries[n].key).context("writing warm-done.txt") + // A recipe can be missing a shader or the driver can refuse it. + // Neither case warmed a pipeline. Leave it eligible next time. + if there { + writeln!(lock(&done_out), "{success_key} {}", entries[n].key).context("writing warm-done.txt")?; + } + Ok(()) }, |n, why| { println!("pipeline {n} {}: {why}", entries[n].key); @@ -108,8 +116,8 @@ pub fn run(jobs: Option<usize>, limit: Option<usize>, again: bool, used: bool, t times.sort_by(f64::total_cmp); let at = |q: f64| times.get((times.len() as f64 * q) as usize).copied().unwrap_or(0.0); println!( - "{} made in {:.0} s ({refused} have no host pipeline, {crashed} ended their process); ms each: median {:.1}, p90 {:.1}, p99 {:.1}, most {:.0}, sum {:.0} s", - times.len(), + "{} made in {:.0} s ({refused} have no host pipeline, {crashed} ended their process); ms per completed attempt: median {:.1}, p90 {:.1}, p99 {:.1}, most {:.0}, sum {:.0} s", + times.len() - refused, began.elapsed().as_secs_f64(), at(0.5), at(0.9), diff --git a/apps/victory/tests/warm_refused.rs b/apps/victory/tests/warm_refused.rs new file mode 100644 index 00000000..62a995e0 --- /dev/null +++ b/apps/victory/tests/warm_refused.rs @@ -0,0 +1,101 @@ +#![cfg(all(windows, feature = "diagnostics"))] + +use std::fs; +use std::io::Write; +use std::path::Path; +use std::process::Command; + +fn compute_shader() -> Vec<u8> { + // A native wave32 compute group whose only instruction is s_endpgm. + let words = [ + u32::from_le_bytes(*b"FSPX"), 1, 3, 120, + 0, 64, 28, 0, 6, 92, 4, 0, 7, 96, 24, 0, + 0, 0, 0, 0x0001_0020, 0x0010_0001, 0, 0, + 0xBF81_0000, 0x403, 4, 1, 0, 0, 0x40, + ]; + let program: Vec<_> = words.into_iter().flat_map(u32::to_le_bytes).collect(); + let mut bytes = b"DXBC".to_vec(); + bytes.extend([0; 16]); // digest unused by the parser + for word in [1, 44 + program.len() as u32, 1, 36] { + bytes.extend(word.to_le_bytes()); + } + bytes.extend(b"ACCC"); + bytes.extend((program.len() as u32).to_le_bytes()); + bytes.extend(program); + bytes +} + +fn write_recipe(dir: &Path, key: u8, shader: &[u8]) { + let mut recipe = vec![key; 16]; + recipe.extend([1, 5]); // one stage, compute + recipe.extend(blake3::hash(shader).as_bytes()); + recipe.push(0); // no graphics state + let mut file = fs::OpenOptions::new().create(true).append(true) + .open(dir.join("known-pipelines.bin")).unwrap(); + file.write_all(&(recipe.len() as u32).to_le_bytes()).unwrap(); + file.write_all(&recipe).unwrap(); +} + +fn shader_record(shader: &[u8]) -> Vec<u8> { + let mut record = vec![5]; + record.extend(blake3::hash(shader).as_bytes()); + record.extend((shader.len() as u32).to_le_bytes()); + record.extend(shader); + record +} + +fn warm(root: &Path) -> String { + let mut command = Command::new(env!("CARGO_BIN_EXE_victory")); + // Isolate the fixture from the operator's adapter and translation settings. + for (key, _) in std::env::vars_os() { + if key.to_string_lossy().to_ascii_uppercase().starts_with("VICTORY_") { + command.env_remove(key); + } + } + let output = command + .args(["warm", "--jobs", "1"]) + .current_dir(root) + .env("VICTORY_CACHE_DIR", root) + .env("VICTORY_DATA_DIR", root.join("data")) + // The debug-only switch also works on hosts without a discrete GPU. + .env("VICTORY_D3D12_WARP", "1") + .output() + .unwrap(); + assert!(output.status.success(), "{output:?}"); + String::from_utf8(output.stdout).unwrap() +} + +#[test] +fn a_pipeline_with_a_missing_shader_is_retried_after_the_book_is_repaired() { + let cache = tempfile::tempdir().unwrap(); + let root = cache.path(); + let dir = root.join("pipelines"); + fs::create_dir(&dir).unwrap(); + let shader = compute_shader(); + let mut other = shader.clone(); + other[4] = 1; // distinguish the recorded containers without changing the program + write_recipe(&dir, 0x11, &shader); + write_recipe(&dir, 0x22, &other); + let book = dir.join("known-shaders.bin"); + fs::write(&book, shader_record(&shader)).unwrap(); + + let first = warm(root); + let done = dir.join("warm-done.txt"); + let recorded = fs::read_to_string(&done).unwrap(); + assert!(first.contains("1 made in") && first.contains("1 have no host pipeline"), "{first}"); + assert_eq!(recorded.lines().count(), 1, "{recorded}"); + assert!(recorded.trim_end().ends_with(&"11".repeat(16)), "{recorded}"); + assert!(fs::read(dir.join("warm-bad.txt")).unwrap().is_empty()); + + let fingerprint = recorded.split_whitespace().next().unwrap().strip_prefix("made-v1:").unwrap(); + let mut history = fs::OpenOptions::new().append(true).open(&done).unwrap(); + writeln!(history, "{fingerprint} {}", "22".repeat(16)).unwrap(); + drop(history); + fs::OpenOptions::new().append(true).open(&book).unwrap().write_all(&shader_record(&other)).unwrap(); + let repaired = warm(root); + assert!(repaired.contains("1 to make") && repaired.contains("1 made in"), "{repaired}"); + let recorded = fs::read_to_string(&done).unwrap(); + assert_eq!(recorded.lines().filter(|line| line.starts_with("made-v1:")).count(), 2, "{recorded}"); + assert!(recorded.trim_end().ends_with(&"22".repeat(16)), "{recorded}"); + assert!(warm(root).contains("0 to make")); +} \ No newline at end of file ``` </details>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 07:25:59 +00:00
Author
Owner

@⁠zmelumian972 on GitHub · 2026-11-27 19:22 UTC · original

Checked on main at b6ea434: this looks fixed by 2cd040d (v2 completion records written only when there, legacy lines no longer count as done).

I ran the issue's title-free CLI regression under Linux / GE-Proton11-14 (RTX 5090, --features diagnostics). I adapted it in two ways: it parses the v2 <fingerprint> <key> format instead of made-v1:, and since fcf76de the first run fails on purpose:

Run Result
1: recipe 22… has no shader in the book warm worker failed after 1 of 2 pipelines, exit 1; warm-done.txt holds only v2 … 1111…
2: legacy <fingerprint> 2222… line appended, shader added 1 made before … 1 to make, then 1 made in 1 s, 22… now recorded as v2
3 0 to make

The driver-refusal path (made … 0) isn't reachable with this fixture any more. It's covered by warm_completion_keeps_refusals_and_ambiguous_legacy_records_pending.

One side effect of fcf76de, from reading known::make: the first unreadable recipe returns through ?, so a worker stops there and the recipes after it in its batch aren't attempted. That happens again on every warm until the shader is recorded. That may be intended; I'm just noting it in case a missing shader should skip the recipe rather than end the batch.

From my side this issue can be closed.

🤖 Generated with Claude Code

**@⁠zmelumian972** on GitHub · 2026-11-27 19:22 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/188#issuecomment-7226466668) Checked on `main` at `b6ea434`: this looks fixed by `2cd040d` (`v2` completion records written only when `there`, legacy lines no longer count as done). I ran the issue's title-free CLI regression under Linux / GE-Proton11-14 (RTX 5090, `--features diagnostics`). I adapted it in two ways: it parses the `v2 <fingerprint> <key>` format instead of `made-v1:`, and since `fcf76de` the first run fails on purpose: | Run | Result | |---|---| | 1: recipe `22…` has no shader in the book | `warm worker failed after 1 of 2 pipelines`, exit 1; `warm-done.txt` holds only `v2 … 1111…` | | 2: legacy `<fingerprint> 2222…` line appended, shader added | `1 made before … 1 to make`, then `1 made in 1 s`, `22…` now recorded as `v2` | | 3 | `0 to make` | The driver-refusal path (`made … 0`) isn't reachable with this fixture any more. It's covered by `warm_completion_keeps_refusals_and_ambiguous_legacy_records_pending`. One side effect of `fcf76de`, from reading `known::make`: the first unreadable recipe returns through `?`, so a worker stops there and the recipes after it in its batch aren't attempted. That happens again on every `warm` until the shader is recorded. That may be intended; I'm just noting it in case a missing shader should skip the recipe rather than end the batch. From my side this issue can be closed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 19:35 UTC · original

@⁠NotADonky43 This is fixed on main in 2cd040d. The v2 completion record is written only when the host actually creates the pipeline. Old completion records get another attempt.

@⁠zmelumian972 Thanks for checking the repair and the legacy record across those three runs. The test for refused pipelines is on main too. Your note about fcf76de is right: a missing shader stops that worker and leaves the later recipes in its batch pending.

**@⁠TaynanGT** on GitHub · 2026-11-27 19:35 UTC · [original](https://github.com/TaynanGT/Vice-Tay/issues/188#issuecomment-7226674495) @⁠NotADonky43 This is fixed on `main` in `2cd040d`. The `v2` completion record is written only when the host actually creates the pipeline. Old completion records get another attempt. @⁠zmelumian972 Thanks for checking the repair and the legacy record across those three runs. The test for refused pipelines is on `main` too. Your note about `fcf76de` is right: a missing shader stops that worker and leaves the later recipes in its batch pending.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/TaynanGT--Vice-Tay#188
No description provided.