Shaders: a record's zero stride is refused apart from an unknown one #3090
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3090
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3090"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@borosf on GitHub · 2026-11-26 07:27 UTC · original
borosf:vibe/stride-record-split-842ca5→main· +307 −15 · 3 files · 5 commits · openSummary
emit/lower.rs: load, store, atomic) refused every record stride under 4 or not a multiple of 4 with one error — the "structured buffer of unknown stride" class, 27 world-window failures in #1481 and 41 in the earlier count. #1482 (Rule 3, Project Leonida) measured on RDNA2 that a stride of exactly 0 is a separate population — a zero SRD stride field is a raw buffer — and asked that the split be made visible before any routing decision is costed on it.Details
index_strideinemit/lower.rsnames the record's three cases: zero (the host view's, runtime), a dword element (taken), other (unknown). The three call sites are the load, store and atomic index arms.emit::census_tests) is unchanged: 546 translated, 686 refused, 0 panicked.83ccfc2): fourlower.rstests use the windows-gatedvalidatormodule without a#[cfg], so pristine main'scargo test -p victory-shader --libdoes not build on Linux (or any non-Windows host). Gated#[cfg(all(test, windows))]like the neighbouring test modules; Windows runs are unchanged.Verification
cargo test -p victory-shader --libon Linux: 174 passed, 0 failed, 2 benchmarks ignored (pristine main does not build there; this branch makes the whole suite run).cargo check --locked --all-targets --target x86_64-pc-windows-msvc -p victory-shader: passes.claiming: a record's zero stride is refused apart from an unknown one (#1482 rule 3's measurement)
@Dukestar69 on GitHub · 2026-11-26 07:50 UTC · original · approved these changes
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-shader emit::lower::tests: all tests passed.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@oni-swr on GitHub · 2026-11-26 07:53 UTC · original
Independent WARP verification of this PR at
806965b5against its pre-series base63bcca43(the claim is #1633). No source changes and no PR from me.Setup: Windows 11,
x86_64-pc-windows-msvc, Rust 1.98.1,--locked. The binaries were built separately per tree.victory-shaderGPU tests ran withVICTORY_WARP=1. I confirmed the adapter first with a throwaway probe test: it reportsMicrosoft Basic Render Driver, software flag set, 0 bytes of dedicated video memory. The physical GPU was not used. The validator loaded the Windows SDKdxil.dll; no test printed "no dxil.dll" or a device skip. Synthetic inputs only, no game data.Classification probe (not part of the PR). One record-stride sweep through
lower, same program shape,UsedResource.stridevaried, for the three buffer instructions on the table-root path:unknown stridestride is only the host view'sunknown strideunknown stride"All three" is
buffer_load_dword,buffer_store_dwordandbuffer_atomic_add, element-indexed. Only the stride-0 row changes, and only in its message. Translated and refused outcomes are identical on every row, which matches the "no previously-translating shader changes its outcome" claim. The PR's own tests cover 0 and 4 on this path but not an unusable nonzero stride, so that row is new evidence.Suite.
cargo test -p victory-shader --libon WARP: base 298 passed, 4 failed. Head 304 passed, 4 failed. The six extra passes are the newlower::stride_recordtests, which pass when run alone. The four failures are the same on both:a_mask_joined_with_data_at_a_uniform_loop_is_its_number,gathers_at_a_level_match_the_hardware,permutes_mask_high_address_bits_and_divergent_branchesandpermutes_read_the_lane_named_and_zero_from_lanes_left_out. They are hardware-lane checks that WARP does not satisfy, and they fail before this PR too. The existingstride_tests(8) pass.Limits: WARP only, so this says nothing about an AMD or NVIDIA host. I did not run the non-Windows build the first commit is about, or clippy.
AI use: Claude Code (Claude Sonnet 5.5) ran the verification, coordinated by Codex (gpt-6.2-sol).
@fuzeofficlal on GitHub · 2026-11-26 08:03 UTC · original · requested changes
Tested locally on Windows 11 x64 (
rustc 1.98.1):cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.cargo test -p victory-shader --locked stride_record: 6 passed, 0 failed.cargo test -p victory-shader --locked emit::lower: 39 passed, 0 failed.cargo xtask policy: 192 files ok.Two items should be adjusted before merge:
Lower::index_stridediagnostic accuracy (lower.rs:5338):used.map_or(0, |u| u.stride)conflates a missing entry with a matched entry whosestrideis0, and reports"a structured buffer whose stride is only the host view's". However,fspx_program(crates/victory-shader/src/native.rs:519-534) setsUsedResource::stride = 0for every FSPX entry, so a matched entry withstride == 0can simply reflect missing parser metadata rather than proving that only the host view knows the stride. Rewording the diagnostic to state that the matched entry provides no usable stride (or preserving the stride source) would match the available metadata.#[cfg(all(test, windows))]gating on four existing tests (lower.rs:11510, 11552, 11601, 11655):waterfall_loops_over_descriptors_joined_per_lane_sample_with_each_lanes_owndoes not callValidatorat all, and the other three run lowering assertions before their optional DXIL validation check. Please gate only the Windows DXIL validator blocks so non-Windows CI keeps running the lowering assertions.Minor test suggestion: adding a nonzero-index byte-offset assertion for the built-stride cases, a swizzle-only case without record limit, and a nonzero invalid stride (e.g.
2/3/5) would further tightenstride_record.rs.@YaBulochka on GitHub · 2026-11-26 08:10 UTC · original
Offline validation on the retail corpus, with the current main as the baseline:
main63bcca4— 24 850 programs validatedpull/3090/head) — 24 850 programs validatedSo no regression and no change in the count on this corpus. Environment: Wine 11.22 on CachyOS (kernel 7.3.5), retail 1.0.2.1
shaders.rpf(26,503 containers), built with--features diagnostics,victory translate <shaders.rpf> --validate --list, unchanged prefix and settings for both runs.If the change is meant to move that number, it does not on this dump; if it is about correctness of the emitted DXIL for an instruction shape the corpus does not hit, then parity is the expected result and this says only that nothing else moved.
Numbers only, no game files or dumps.
@borosf on GitHub · 2026-11-26 08:13 UTC · original
Right — parity is what this PR is designed to produce on the offline corpus. The change touches no translation decision: the three sites' routing is byte-identical for every record stride ≥ 4 and dword-multiple, and refuses exactly the accesses main refuses for strides 0/1/2/3 — only the error string splits for the stride-0 class (24,850 identical validated programs confirms the outcome side). What the split is for is the world-run diagnostics: the "structured buffer of unknown stride" bucket that #1481 counted at 27 per three-minute window will now report its stride-0 and other-unknown members separately in translate --list / the drop summaries, which is the measurement #1482 rule 3 asked for before anyone designs runtime-stride routing on it. If you ran --list differences by refusal reason rather than validated counts, the delta should be only inside that one bucket's message — if you still have both listings handy, the stride-0 share of that bucket on your dump would be the exact number the rule wanted.
And agreed on the scope note: the test-side additions pin an instruction/descriptor shape (a built root descriptor's own stride field, and its limit/swizzle refusals) that this corpus apparently doesn't hit — kept as regression coverage for future main, with the census unchanged (546/686/0) confirming nothing else shifted.
@borosf on GitHub · 2026-11-26 08:14 UTC · original
Both adjustments are in at
8b965b4:@fuzeofficlal
index_stride now reports "a structured buffer whose record names no stride" — the wording no longer conflates a missing entry with a matched zero, and notes the FSPX parser leaves unread strides at zero, so neither case is described as the host view knowing the stride; only as the record's metadata not naming one.
The four #[cfg(all(test, windows))] gates are gone; the three validator if let blocks carry the module-level #[cfg(windows)] instead (the existing pattern at lower.rs:12196), and the waterfall test lost its gate entirely — it never loads the validator. The lowering assertions all run on non-Windows now: the Linux lib suite went from 174 to 179 passing.
Also took the test suggestions: record strides 2/3/5/6 each refuse with the unchanged "unknown stride" (pinning the table row from the independent WARP sweep), and a swizzle-only built case (swizzle bits set, record count still -1) refuses by "swizzling or a record limit" alongside the record-limit one.
@Marvisak on GitHub · 2026-11-26 08:21 UTC · original
Automated triage for the maintainers.
Merge candidate (diagnostics only).
Lower::index_strideinemit/lower.rsreplaces the three identical stride checks in the element-indexed load, store and atomic arms. A missing record or a zero stride now refuses with its own message ("a structured buffer whose record names no stride"). Strides of 1-3 and other non-multiples of 4 keep "a structured buffer of unknown stride", and strides that are multiples of 4 translate as before. No translation outcome changes, which matches the census and the corpus parity reported in the thread. The validator calls in threelower.rstests get#[cfg(windows)]like the module itself.lower/stride_record.rsholds the new tests. Most of them pin main's existing built-descriptor behaviour, and two cover the new split. Maintainers should know the value here is the split refusal count, not a functional fix.lower.rsis now 521,018 bytes against the 524,288-byte policy limit.CI: passing (check).
Generated by Claude Code
@borosf on GitHub · 2026-11-26 08:25 UTC · original
Thanks all — with the triage verdict and three independent verifications (WARP sweep, retail-corpus parity on 24,850 programs, and hardware runs) consistent on no outcome change, I'll leave this as-is for review. The lower.rs size note is also covered: the new tests live in the separate lower/stride_record.rs module, keeping lower.rs at 521,018 bytes under the 512 KiB policy limit.
@fuzeofficlal on GitHub · 2026-11-26 10:17 UTC · original · approved these changes
Both previous review points are resolved in
8b965b4f:Lower::index_stride(emit/lower.rs:5339-5344) now reports"a structured buffer whose record names no stride"across all three element-indexed paths, the threeValidator::loadblocks carry narrow#[cfg(windows)]gates while keeping lowering assertions enabled on non-Windows targets (and un-gating the waterfall test), andstride_record.rsadds tests for nonzero invalid strides (2, 3, 5, 6) and swizzle bits without a record limit.emit/lower.rsis521,018bytes (under the 512 KiB limit).Verified locally on Windows 11 x64 (
8b965b4f):cargo run --locked -p xtask -- policy: passed (192 files ok)cargo clippy -p victory-shader --all-targets --locked -- -D warnings(default and--all-features): cleanemit::lower::stride_record: 7 passed, 0 failedemit::lower::tests: 33 passed, 0 failedMinor nits:
rustfmt --edition 2024 --check crates/victory-shader/src/emit/lower/stride_record.rsflags extra 4-space indentation on the tests starting at line 62, and a couple of comments inlower.rs/stride_record.rsstill use the older host-view phrasing.@borosf on GitHub · 2026-11-26 13:53 UTC · original
Both post-approval cosmetics are done at
933ecc5:rustfmtindentation atstride_record.rs:62— the tests had been left indented as if still inside the module they were split out of. Dedented to the file's own level;rustfmt --edition 2024 --check crates/victory-shader/src/emit/lower/stride_record.rsis now clean (no hunks).grep -rc "host view" crates/victory-shader/src→ 0 left. Files:lower.rs(three),stride_record.rs(two),resource.rs(one — a fourth comment there I found with the same phrasing).No behaviour change: comments and indentation only.
Verification on an Intel Arc B580, Windows 11:
cargo test -p victory-shader --lib --locked -- --test-threads=1→ 307 passed, 2 failed, 3 ignored. The two are the known B580 failures pristinemainalso has (emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros,emit::valu_tests::fspx_programs_run_with_the_hardwares_dot_products); the sevenstride_recordtests pass.cargo clippy -p victory-shader --all-targets -- -D warningsclean.cargo fmtclean:lower.rs33 pre-existing hunks (was 37 before these comment edits — the longer lines merged four of them),resource.rs4 (unchanged),stride_record.rs0 (was 1).@fuzeofficlal on GitHub · 2026-11-26 18:26 UTC · original · approved these changes
Verified the follow-up commit
933ecc5f555d30d3e66b102a7b631b7b2e261d8don Windows 11 x64 (63bcca43base) — confirmed comment- and formatting-only updates with zero behavior change:rustfmt --edition 2024 --check crates/victory-shader/src/emit/lower/stride_record.rs: clean (exit 0).crates/victory-shader/src/emit/lower.rssize: 521,024 B (under the 524,288 B cap);cargo test -p xtask --locked policy::tests::repository_passes_policy:1 passed(asset policy: 192 files ok).cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default and--all-features): clean.stride_record(7 passed, 0 failed) andemit::lower(40 passed, 0 failed) pass on both RTX 5090 (VICTORY_WARP=0) and WARP (VICTORY_WARP=1); full--libon RTX 5090 (skipping the pre-existingheap_direct_texture_reads_mark_their_heap_indexcrash):305 passed; 3 failed; 3 ignored; 1 filtered out(same 3 pre-existing failures asmain).Both post-approval nits are cleanly resolved — ready to merge.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.