shader,gpu: read shader constant tables from a root SRV instead of a per-thread array #200

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

@⁠Androtim on GitHub · 2026-11-30 05:17 UTC · original
Androtim:feat/iter197-shader-code-table-root-srv → main · +312 −10 · 18 files · 1 commits · closed without merging

Summary

  • Moves shader constant tables (s_getpc_b64 indexed loads in emit/hdr.rs) from internal per-thread constant arrays (constant_global("code", ...)) to a shared raw root SRV (SLOT_CODE_TABLE = 250 in ROOT_CBV_SPACE) read via rawBufferLoad.f32, avoiding per-thread scratch VRAM reservations on host drivers (VICTORY_CODE_TABLE_PRIVATE=1 opts back into internal arrays).
  • Adds code_table: Vec<u32> to Lowered and HostShader, updates shader_cache switch fingerprint and binary encoding/decoding (keeping trailing compatibility when empty), pools deduplicated 256-byte-aligned tables into 4 MiB host upload buffers in pipeline/host.rs (code_table_address), and binds stage.code_table as a root SRV descriptor in draw.rs.
  • Updates diff_tests.rs root binding for SLOT_CODE_TABLE and adds valu_tests::code_table_reads_via_root_srv_and_populates_table_words verifying DXIL validation plus live GPU and WARP execution.

Verification

  • cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy: 311 files ok
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib code_table: 4 passed; 0 failed (DXIL + hardware GPU + WARP)
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib shader_cache:: -- --test-threads=1: 2 passed; 0 failed
  • cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib pipeline:: -- --test-threads=1: 34 passed; 0 failed
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings: pass
  • cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings: pass
  • Live GPU 75s Series S (-PlayParity, warm cache): 11.7 fps, used_max=6485/6841 MB (over=0 MB), final_waiting=5252, mapped_rate=8.42 ms/s, lit=17/24, luma=104.84, magenta=0.0%, 0 crashes, late PNGs crisp (frame-4980, frame-4988)
  • Live GPU 75s Series X 1440p (-PlayParity): 10.85 fps, max_draws=12773, used_max=7046/6869 MB, lit=18/24, luma=104.52, magenta=0.0%, 0 crashes, late PNGs crisp (frame-3737, frame-3753)
**@⁠Androtim** on GitHub · 2026-11-30 05:17 UTC · [original](https://github.com/Androtim/MiniVI/pull/200) `Androtim:feat/iter197-shader-code-table-root-srv` → `main` · +312 −10 · 18 files · 1 commits · closed without merging ### Summary - Moves shader constant tables (`s_getpc_b64` indexed loads in `emit/hdr.rs`) from internal per-thread constant arrays (`constant_global("code", ...)`) to a shared raw root SRV (`SLOT_CODE_TABLE = 250` in `ROOT_CBV_SPACE`) read via `rawBufferLoad.f32`, avoiding per-thread scratch VRAM reservations on host drivers (`VICTORY_CODE_TABLE_PRIVATE=1` opts back into internal arrays). - Adds `code_table: Vec<u32>` to `Lowered` and `HostShader`, updates `shader_cache` switch fingerprint and binary encoding/decoding (keeping trailing compatibility when empty), pools deduplicated 256-byte-aligned tables into 4 MiB host upload buffers in `pipeline/host.rs` (`code_table_address`), and binds `stage.code_table` as a root SRV descriptor in `draw.rs`. - Updates `diff_tests.rs` root binding for `SLOT_CODE_TABLE` and adds `valu_tests::code_table_reads_via_root_srv_and_populates_table_words` verifying DXIL validation plus live GPU and WARP execution. ### Verification - `cargo +1.98.1-x86_64-pc-windows-gnu run -p xtask -- policy`: `311 files ok` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-shader --lib code_table`: `4 passed; 0 failed` (DXIL + hardware GPU + WARP) - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib shader_cache:: -- --test-threads=1`: `2 passed; 0 failed` - `cargo +1.98.1-x86_64-pc-windows-gnu test -p victory-gpu --lib pipeline:: -- --test-threads=1`: `34 passed; 0 failed` - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets -- -D warnings`: pass - `cargo +1.98.1-x86_64-pc-windows-gnu clippy --workspace --all-targets --features diagnostics -- -D warnings`: pass - Live GPU 75s Series S (`-PlayParity`, warm cache): `11.7 fps`, `used_max=6485/6841 MB` (`over=0 MB`), `final_waiting=5252`, `mapped_rate=8.42 ms/s`, `lit=17/24`, `luma=104.84`, `magenta=0.0%`, `0` crashes, late PNGs crisp (`frame-4980`, `frame-4988`) - Live GPU 75s Series X 1440p (`-PlayParity`): `10.85 fps`, `max_draws=12773`, `used_max=7046/6869 MB`, `lit=18/24`, `luma=104.52`, `magenta=0.0%`, `0` crashes, late PNGs crisp (`frame-3737`, `frame-3753`)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 20:17:56 +00:00
github-bot closed this pull request 2026-12-01 20:17:56 +00:00
Author
Owner

@⁠Androtim on GitHub · 2026-11-30 09:17 UTC · original

Overlaps #173 (SLOT_CODE_TABLE = 250 root SRV constant table), which is now merged onto main. Please rebase onto latest main if keeping any remaining delta (such as VICTORY_CODE_TABLE_PRIVATE=1 / diff_tests.rs), or close as superseded.

**@⁠Androtim** on GitHub · 2026-11-30 09:17 UTC · [original](https://github.com/Androtim/MiniVI/pull/200#issuecomment-7273993837) Overlaps `#173` (`SLOT_CODE_TABLE = 250` root SRV constant table), which is now merged onto `main`. Please rebase onto latest `main` if keeping any remaining delta (such as `VICTORY_CODE_TABLE_PRIVATE=1` / `diff_tests.rs`), or close as superseded.
Author
Owner

@⁠Androtim on GitHub · 2026-11-30 10:02 UTC · original

Automated triage for the maintainers (not an approval).

Verdict: needs-rebase · CI (check): passing

This PR no longer merges cleanly into main.

To change the verdict: Rebase onto current main and resolve conflicts; CI and triage will run again automatically.


Generated with Antigravity CLI (agy).

**@⁠Androtim** on GitHub · 2026-11-30 10:02 UTC · [original](https://github.com/Androtim/MiniVI/pull/200#issuecomment-7275040789) <!-- minivi-triage v1 head=b9c638a754272cd0e92f34995cdb200604001a46 verdict=needs-rebase ci=passing at=2026-11-30T10:03:22Z --> Automated triage for the maintainers (not an approval). **Verdict:** `needs-rebase` · **CI (`check`):** `passing` This PR no longer merges cleanly into `main`. **To change the verdict:** Rebase onto current `main` and resolve conflicts; CI and triage will run again automatically. --- _Generated with Antigravity CLI (`agy`)._
Author
Owner

@⁠Androtim on GitHub · 2026-12-01 01:39 UTC · original

Closing stale/conflicted backlog PR per #276. Superseded by the active root-architecture replacement pillars with isolated plain --release A/B verification.

**@⁠Androtim** on GitHub · 2026-12-01 01:39 UTC · [original](https://github.com/Androtim/MiniVI/pull/200#issuecomment-7297742120) Closing stale/conflicted backlog PR per #276. Superseded by the active root-architecture replacement pillars with isolated plain --release A/B verification.

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/Androtim--MiniVI!200
No description provided.