CLI: reuse the D3D12 host across translation workers #1415

Closed
github-bot wants to merge 1 commit from gh-pr/1415/head into gh-pr/1415/base
Owner

@⁠gurvancampion on GitHub · 2026-11-24 17:52 UTC · original
gurvancampion:topic/translate-shared-host → main · +130 −59 · 1 files · 1 commits · closed without merging

Summary

victory translate --pipelines now opens one D3D12 host and builds one pixel stub before scanning files. Each worker borrows both, and VICTORY_PAIRS reuses the host after the workers finish. Initialization errors reach the caller before the scan. Explicit VICTORY_WARP=1 runs serialize pipeline creation while translation and DXIL validation remain parallel.

 translate::run
-  Host::new → drop after availability check
+  Host::new + stub_ps → keep for the scan
   each file → each worker
-    Host::new().ok() → stub_ps on success
+    borrow Host and stub_ps
     check emitted shaders
   VICTORY_PAIRS
-    Host::new
+    reuse Host when --pipelines is enabled

Evidence

Base ffe310e and head 61f2848 ran under GE-Proton11-12 with GPU and display access disabled. The regression test scans two synthetic files with two workers per file. The base control mirrors the old initialization order and fails with five initializations. Head passes with one and verifies that all four workers receive the same value.

Command Base Head
cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings Pass Pass
cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings Pass Pass
cargo xwin test -p victory --locked --target x86_64-pc-windows-msvc translate::tests::shares_pipeline_checks_across_files_and_workers 1 failed with 5 initializations 1 passed with 1 initialization
cargo xwin test -p victory --locked --target x86_64-pc-windows-msvc 1 passed 2 passed
cargo xwin test --workspace --locked --target x86_64-pc-windows-msvc --no-fail-fast 322 passed, 20 failed 323 passed, same 20 failures
cargo xwin test --workspace --all-features --locked --target x86_64-pc-windows-msvc --no-fail-fast 326 passed, 20 failed 327 passed, same 20 failures
cargo test -p victory-core -p victory-formats -p victory-game -p victory-pipeline -p victory-shader -p xtask --locked 140 passed 140 passed
cargo test -p victory-core -p victory-formats -p victory-game -p victory-pipeline -p victory-shader -p xtask --all-features --locked 140 passed 140 passed
cargo test -p xtask --locked repository_passes_policy Pass Pass
cargo xtask policy --staged Pass Pass
cargo fmt --all -- --check Existing differences Same differences
rustfmt --check --edition 2024 apps/victory/src/translate.rs Pass Pass
git diff --check origin/main HEAD Pass Pass

The unfiltered Windows failures require a D3D12 SM 6.6 device, a window, a missing Wine export, a working probe build path, or Git in the guest. Filtering those 20 tests passed both feature sets on both revisions.

Not verified

Native Windows, hardware and WARP pipeline creation, and scan timings remain unverified under the GPU halt. The WARP lock addresses the explicit software-adapter path described in the upstream concurrency report. PR #244

Merge Danger

Door Two-way. Reverting restores the previous host lifetime. The change involves no persisted state.

Blast Radius Local. The device lifetime affects the offline pipeline checks in victory translate, including the final pair pass when --pipelines is set.

AI disclosure

OpenAI Codex (gpt-6.2-sol) traced the call paths, implemented the change and regression test, ran verification, and drafted this description. Antigravity (Gemini 4 Neon) coordinated and reviewed the diff. The author reviewed the diff and description before opening the PR.

**@⁠gurvancampion** on GitHub · 2026-11-24 17:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/1415) `gurvancampion:topic/translate-shared-host` → `main` · +130 −59 · 1 files · 1 commits · closed without merging ## Summary `victory translate --pipelines` now opens one D3D12 host and builds one pixel stub before scanning files. Each worker borrows both, and `VICTORY_PAIRS` reuses the host after the workers finish. Initialization errors reach the caller before the scan. Explicit `VICTORY_WARP=1` runs serialize pipeline creation while translation and DXIL validation remain parallel. ```diff translate::run - Host::new → drop after availability check + Host::new + stub_ps → keep for the scan each file → each worker - Host::new().ok() → stub_ps on success + borrow Host and stub_ps check emitted shaders VICTORY_PAIRS - Host::new + reuse Host when --pipelines is enabled ``` ## Evidence Base `ffe310e` and head `61f2848` ran under GE-Proton11-12 with GPU and display access disabled. The regression test scans two synthetic files with two workers per file. The base control mirrors the old initialization order and fails with five initializations. Head passes with one and verifies that all four workers receive the same value. | Command | Base | Head | | --- | --- | --- | | `cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings` | Pass | Pass | | `cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings` | Pass | Pass | | `cargo xwin test -p victory --locked --target x86_64-pc-windows-msvc translate::tests::shares_pipeline_checks_across_files_and_workers` | 1 failed with 5 initializations | 1 passed with 1 initialization | | `cargo xwin test -p victory --locked --target x86_64-pc-windows-msvc` | 1 passed | 2 passed | | `cargo xwin test --workspace --locked --target x86_64-pc-windows-msvc --no-fail-fast` | 322 passed, 20 failed | 323 passed, same 20 failures | | `cargo xwin test --workspace --all-features --locked --target x86_64-pc-windows-msvc --no-fail-fast` | 326 passed, 20 failed | 327 passed, same 20 failures | | `cargo test -p victory-core -p victory-formats -p victory-game -p victory-pipeline -p victory-shader -p xtask --locked` | 140 passed | 140 passed | | `cargo test -p victory-core -p victory-formats -p victory-game -p victory-pipeline -p victory-shader -p xtask --all-features --locked` | 140 passed | 140 passed | | `cargo test -p xtask --locked repository_passes_policy` | Pass | Pass | | `cargo xtask policy --staged` | Pass | Pass | | `cargo fmt --all -- --check` | Existing differences | Same differences | | `rustfmt --check --edition 2024 apps/victory/src/translate.rs` | Pass | Pass | | `git diff --check origin/main HEAD` | Pass | Pass | The unfiltered Windows failures require a D3D12 SM 6.6 device, a window, a missing Wine export, a working probe build path, or Git in the guest. Filtering those 20 tests passed both feature sets on both revisions. ### Not verified Native Windows, hardware and WARP pipeline creation, and scan timings remain unverified under the GPU halt. The WARP lock addresses the explicit software-adapter path described in the upstream concurrency report. [PR #244](https://git.gtahub.st/github/Marvisak--VIctory/pulls/244) ## Merge Danger **Door** Two-way. Reverting restores the previous host lifetime. The change involves no persisted state. **Blast Radius** Local. The device lifetime affects the offline pipeline checks in `victory translate`, including the final pair pass when `--pipelines` is set. ## AI disclosure OpenAI Codex (`gpt-6.2-sol`) traced the call paths, implemented the change and regression test, ran verification, and drafted this description. Antigravity (`Gemini 4 Neon`) coordinated and reviewed the diff. The author reviewed the diff and description before opening the PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:30:52 +00:00
github-bot closed this pull request 2026-11-26 04:30:52 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:26 UTC · original · edited 2026-11-25 20:19 UTC

Automated triage for the maintainers.

Merge candidate (unchanged). The new head 3ebc8e8 is a plain rebase onto main (67e8ae1). git range-diff shows the patch is identical to the previously reviewed 8668932. main's changes since then to crates/victory-shader/src/emit/host.rs are test-harness additions that don't touch Host::new or pipeline creation. So the earlier review still holds: scan in apps/victory/src/translate.rs builds one Host and stub pixel shader before the walk, returns a creation error instead of silently dropping the checks, and lends both to every worker and to VICTORY_PAIRS.

Minor, still not blocking: the test's temp directory is named by process id and made with create_dir, so a directory left over from an aborted run would fail it.

CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1415#issuecomment-7149548496) · edited 2026-11-25 20:19 UTC <!-- victory-triage v1 head=3ebc8e8f8382d0e30f90789cefcc8732e5bd6ef7 verdict=merge-candidate at=2026-11-25T20:18:54Z --> Automated triage for the maintainers. **Merge candidate (unchanged).** The new head `3ebc8e8` is a plain rebase onto `main` (67e8ae1). `git range-diff` shows the patch is identical to the previously reviewed `8668932`. `main`'s changes since then to `crates/victory-shader/src/emit/host.rs` are test-harness additions that don't touch `Host::new` or pipeline creation. So the earlier review still holds: `scan` in `apps/victory/src/translate.rs` builds one `Host` and stub pixel shader before the walk, returns a creation error instead of silently dropping the checks, and lends both to every worker and to `VICTORY_PAIRS`. Minor, still not blocking: the test's temp directory is named by process id and made with `create_dir`, so a directory left over from an aborted run would fail it. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:00 UTC · original

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because main already has its effects. translate creates a Host once up front and fails if that fails. D3D12 devices are per-adapter singletons, so the workers of a file already share one device, and this only saves a device re-creation per file. The WARP serialisation is done more completely by #244 (now merged), which locks inside Host for every caller. The new test checks that scan calls its factory once, which is the new plumbing rather than a defect of main.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 22:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1415#issuecomment-7175826932) Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because `main` already has its effects. `translate` creates a `Host` once up front and fails if that fails. D3D12 devices are per-adapter singletons, so the workers of a file already share one device, and this only saves a device re-creation per file. The WARP serialisation is done more completely by #244 (now merged), which locks inside `Host` for every caller. The new test checks that `scan` calls its factory once, which is the new plumbing rather than a defect of `main`. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!1415
No description provided.