Repository navigation
VI-BR-PORT opt-in shader passes + per-frame cap for first-use pipeline waits (all off by default) - #11
Open
oceansde012 wants to merge 10 commits into
Open
VI-BR-PORT opt-in shader passes + per-frame cap for first-use pipeline waits (all off by default)#11oceansde012 wants to merge 10 commits into
oceansde012 wants to merge 10 commits into
Conversation
Add `EXT_FOLD` (bit 128) to `VICTORY_SHADER_OPT` for extended integer algebraic/bitwise/shift identities, power-of-two strength reduction, two-valued compare/select folding, and canonical comparison reuse and branch facts, keeping `DEFAULT` (`63`) bit-identical to existing output. - Gate every extended `simplify`, `learn`, `key`, and `merge` rule behind `EXT_FOLD` (`128`), leaving `DEFAULT = 63` unchanged. - Keep shift-width and division/remainder safety checks intact; boolean `select -> or/and` rewrites stay unguarded because this IR emits no `nsw`/`nuw`/`exact` poison flags. - Add unit tests for algebraic/bitwise/shift/compare/select folds, IEEE 754 float negation (including NaNs and avoiding `fcmp one`), canonical branch facts, and `DEFAULT = 63` invariance. (cherry picked from commit 651fbac97adc752815de9516a7884b015ee15979)
…load reuse Add `MEM_FWD` (bit 256) to `VICTORY_SHADER_OPT` for alias-aware forwarding and overwritten-store elimination on non-escaping private globals (`space == 0`), plus non-aliasing shared-memory (`space == 3`) load reuse and `WriteKind` resource invalidation, keeping `DEFAULT` (`63`) bit-identical to existing `LOADS` output. - Trace arbitrarily deep GEP chains to canonical scalar-leaf paths with escape analysis (`escaped_globals`) and signed/multi-dim bounds checks. - Never forward `space == 3` (groupshared) stores to later loads, preserving barrier-free wave-ordered LDS exchange (leader election). - Leave the original `LOADS` path untouched when `MEM_FWD` is unset. - Add unit tests for private/shared aliasing, DSE, wave-ordered LDS leader election, escaped globals, loop headers, and deep GEP chains. (cherry picked from commit 18b2c93c6cc07848810bbe92e561c338f5ac3dfd)
Add `LICM` (bit 512) to `VICTORY_SHADER_OPT` to hoist pure, non-trapping loop-invariant instructions out of guaranteed loop blocks (plus provably in-bounds constant-table loads) to a dominating preheader, lazily splitting conditional entry edges while keeping `DEFAULT` (`63`) bit-identical. - Compute dominator tree immediate dominators (`Tree::idom`) and natural loops, hoisting innermost-first only from guaranteed-executed loop blocks (before any `dx.op.discard` or unknown write) plus provably in-bounds constant-table loads. - Leave speculative hoisting out of conditional loop blocks off under plain `LICM` (`512`) so register-pressure trade-offs can be measured under a separate opt-in bit. - Add unit tests covering preheader splitting, nested loops, trap guards, conditional resource/ALU/discard/uniformity negatives, and signed OOB constant-table GEP rejection. (cherry picked from commit 70981f334726203fdbf604e5d69c60788f65abbf)
Add `BARRIERS` (bit 1024) to `VICTORY_SHADER_OPT` to drop immediately adjacent covered `dx.op.barrier` calls and bounded read-after-read LDS barriers within a block, keeping `DEFAULT` (`63`) bit-identical. - Eliminate adjacent `dx.op.barrier` calls whose mode bits are already covered by the preceding barrier with no intervening memory/lane ops. - Coalesce read-after-read barriers between non-escaping `space == 3` LDS loads bounded on the left by a covering group+TGSM barrier and on the right by either a covering group+TGSM barrier or `Term::Ret` (for non-UAV barrier modes), resetting on stores, atomics, resource/wave calls, unknown loads, and branches. - Work cleanly both standalone (`BARRIERS` / `DEFAULT | BARRIERS`) and alongside `MEM_FWD`, with positive and negative soundness unit tests. (cherry picked from commit aaa9fe248d68eada202860982016067e28548cc8)
Add `SPEC_LICM` (bit 2048) to `VICTORY_SHADER_OPT` to hoist non-trapping ALU and pure math intrinsics (`is_speculatable_pure_call`) out of conditional (non-guaranteed) loop blocks, separate from plain `LICM` (`512`). - Document the speculative execution and register-pressure / occupancy trade-off when hoisting out of cold conditional loop branches. - Keep plain `LICM` (`512`) restricted to guaranteed loop blocks plus provably in-bounds constant-table loads; never hoist resource, descriptor, or uniformity-sensitive calls speculatively under either bit. - Add unit tests verifying `LICM` (`512`), `SPEC_LICM` (`2048`), and `LICM | SPEC_LICM` (`2560`) orthogonally. (cherry picked from commit ade8249c53c6424a84495eb83dee4ae17b911cb3)
Add `with_shader_opt` test override in `emit/mod.rs`, `DEFAULT = 63` invariance coverage across all five opt-in passes (`128`/`256`/`512`/ `1024`/`2048`), and `dxil.dll` + D3D12 HW/WARP parity tests exercising `0`, `DEFAULT` (`63`), and `ALL & !WIDE` (`4031`). - Verify `DEFAULT = 63` leaves `EXT_FOLD`, `MEM_FWD`, `LICM`, `BARRIERS`, and `SPEC_LICM` off while `4031` activates all five. - Verify bit-exact GPU parity across loop+LICM+NaN+guarded-div, LDS barriers, GFX10 compute loop, GFX10 waterfall, split-LDS Wave32 read-after-read barrier coalescing (HW + WARP), and wave-ordered LDS leader election (no space-3 store-to-load forwarding). (cherry picked from commit 6a52a47b5a746eae11353a7849d89384ebf70f8f)
…WAIT Inspired by Marvisak/VIctory PR 3353 (fewer dropped frames while pipelines compile for the first time). Not a direct port: the PR holds presentation of affected images; this waits up to 10 s on a pipeline's first request, independent of the per-frame wait budget, so intermediate draws are not dropped on a cold cache. Off by default; VICTORY_PIPELINE_FIRST_WAIT=1 enables it. Verified: cargo check -p victory --release passes. cargo test --release -p victory-gpu: 334 passed, 2 failed; both failures are the pre-existing indirect tests that assume VICTORY_INDIRECT_REST=1. Implemented by Codex; verified and committed by Claude. (cherry picked from commit 76e5b5c)
(cherry picked from commit 7bb03fe)
…AIT_FRAME_MS) With VICTORY_PIPELINE_FIRST_WAIT=1 each pipeline's first use waited up to 10 s, so a frame meeting many new pipelines on a cold cache could pass the title watchdog's 30 s. The first-use waits of one frame now end 12 s (VICTORY_PIPELINE_FIRST_WAIT_FRAME_MS) after the frame's first such wait; later pipelines of that frame wait within the normal budget. Idea from voidopcode/vilocity cad132d (per-frame deadline for compute waits, issue 1). Switch off: unchanged. Code by DeepSeek (deepseek-v4-pro), reviewed and applied by Claude. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLuVRpSS6xqa6TodU6iPSk
…in this base) The cherry-picked VI-BR-PORT parity tests build HostShader with a half_views field that f4b48ad does not have (Windows test target only). Command by DeepSeek, applied by Claude. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLuVRpSS6xqa6TodU6iPSk
This was referenced Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Vlad · project thread
Base: f4b48ad. Everything is off by default, so the picture should equal base.
What
VICTORY_SHADER_OPT: 128 EXT_FOLD, 256 MEM_FWD, 512 LICM, 1024 BARRIERS, 2048 SPEC_LICM. The default stays 63, and the commits say the default output is bit-identical. This is the opt-in version of Vice-Tay PR #193, which we skipped because it changed the defaults. The work is on the GPU side, with no fps figure from the author.half_viewsfrom those parity tests, because that field doesn't exist in this base (Windows test target only).VICTORY_PIPELINE_FIRST_WAIT(76e5b5c, 7bb03fe from vlad/perf-pr3353), plus c79132bVICTORY_PIPELINE_FIRST_WAIT_FRAME_MS(default 12000). The first-use waits of one frame now end 12 s after that frame's first such wait. Before, the limit was 10 s per pipeline, so on a cold cache a single frame could pass the title watchdog's 30 s. The idea comes from voidopcode/vilocity cad132d (issue 1, a cold-start hang). Code by DeepSeek, reviewed by Claude.Checked
CARGO_FEATURE_PURE=1 cargo check --workspace --all-targets --target x86_64-pc-windows-msvcOK.cargo test -p victory-shader --release: 218 passed.A/B on the PC
Use a separate
VICTORY_CACHE_DIRfor each variant, because the shader cache keys on SHADER_OPT.VICTORY_SHADER_OPT= 191 / 319 / 575 / 1087 / 2111 / 4031: compare GPU time and picture.VICTORY_PIPELINE_FIRST_WAIT=1: it must not crash.Report: project files reports/fresh-vibr-vilocity-2026-11-27b.md
Generated by Claude Code