Repository navigation
Conversation
c595f7a to
b0fbdcb
Compare
|
Independent verification (software WARP only)
Commands and results
Review: Looks correct. Review and verification by Claude Code (Claude Sonnet 5.5), AI-assisted; no game files, dumps, shader names or hashes involved. |
|
Tested on NVIDIA (the GPU tests weren't run here yet): RTX 4070, driver 621.01, Windows 11, rustc 1.100.0, dxil.dll 1.9.2602.17. Head
No game data; the title was not run. AI-assisted. |
|
Automated triage for the maintainers. Needs rebase. This PR no longer merges cleanly into Previous verdict for this head: merge candidate. Generated by Claude Code |
|
Note 🤖 Gemini 4 Neon (with GPT-6.2 Astra, Mistral Large 4, and DeepSeek V4.1 Flash) responding on behalf of brainbudt Independently verified
Verification: Windows MSVC workspace |
Three tests in `emit/lower.rs` (from ff47463, 54ab406 and 850b66f) called the Windows-only `validator` module without a `cfg`, so the shader crate's tests no longer built on Linux or macOS (E0433). They now call `validate`, which validates where `dxil.dll` is and does nothing off Windows. Where tests run in CI (`CI` set, as on GitHub's runners) a validator that does not load fails the test instead of skipping the check, so a green run means the DXIL was validated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b0fbdcb to
8e11f47
Compare
|
Rebased onto
Checked from macOS:
The GPU tests run in the Windows CI. Edit: the first push of this rebase failed the CI asset policy, because AI-assisted (Claude Code). |
`view_stride` and `view_addresses` read the view-stride table and the view addresses, root SRVs with no bounds of their own, at a heap index taken from data, without clamping it as `heap_handle` and `buffer_guard` do. An index past the table read whatever memory follows it. Both now clamp the index to `HEAP_VIEWS` - 1 first (`clamp_view_index`, which `buffer_guard` now uses too). The host's view-address buffer had 16 bytes per title and dynamic slot only (`address_slots`), fewer than `HEAP_VIEWS` (about 1.2 million against 2^21 for this title), so even a clamped index could read past it. It now covers the larger of the two, as the view-stride table already does. The entries past the dynamic slots are cleared when it is made rather than left to the new allocation's contents, and nothing writes them after. Tests: a structured read through a heap descriptor clamps once more than a raw one (the stride lookup), and reading a descriptor's dwords 0 and 1 as data clamps twice. Without the clamps it fails (3 against 4). `view_addresses_cover_tables_made_afresh` (Marvisak#1906) now checks that the buffer reaches `HEAP_VIEWS`, that the entries past the dynamic slots read 0 up to the last and are not written, and that there is none past it. The new lowering test lives in `emit/lower/tests/descriptors.rs`, a child of `lower`'s tests: `lower.rs` is within a few KiB of the repository's 512 KiB limit on a file, and with the test it would pass it. Clearing the tail was suggested by brainbudt in review; the conflict resolution with Marvisak#1906 and its test follow r4tedx's reference rebase. Co-Authored-By: r4. <192970269+r4tedx@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8e11f47 to
eb0dae2
Compare
A descriptor every lane shares can reach its use through a tree of joins and SCC selects: a select on an edge into a join, a join on an arm of a select, or a join at a loop header whose back edge is lowered after the body. `uniform_heap_index`, which took nested joins of loads (Marvisak#1012), now also takes selects, so either may hold the other. A loop header's phi goes to `pending_descriptors` and `fill_phis` fills it once every predecessor has a tail; an edge no lane takes brings 0, as before. `view_stride` takes the same trees, so a structured read through one gets its stride; it refused a join ("a structured buffer of unknown stride"). An SCC select between two immediate samplers samples with both, as a join of two already does. A tree with a leaf that a waterfall loop reads per lane gets a non-uniform handle. Tests, synthetic GFX10 programs, each validated by dxil.dll where it runs (required in CI): a select inside nested joins and a descriptor phi at a loop header, each with a raw and a structured read, and an immediate sampler chosen by SCC. On `main` they are refused with "a descriptor chosen by control flow" / "... by a condition". `lower.rs` is within a few KiB of the repository's 512 KiB limit on a file. `uniform_heap_index` and its two new helpers (`fill_descriptor_phi`, `waterfall_leaf`) move to a child module, `emit/lower/trees.rs`, and the tests join Marvisak#2558's in `emit/lower/tests/descriptors.rs`; `lower.rs` ends slightly smaller than on `main`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Split out of #2342 at the maintainer's request (NEW-118 in #1633), on current
main(63bcca4).view_strideandview_addressesread root SRVs at a heap index taken from data: the view-stride table and the view addresses. They do this without clamping the index, asheap_handleandbuffer_guardalready do. Root views have no bounds, so an index past the table reads whatever memory follows it.Change
clamp_view_indexclamps the index toHEAP_VIEWS - 1before both reads.buffer_guardnow uses the same helper; its behaviour is unchanged.address_slots, from GPU: view addresses for tables made afresh (dynamic slots) #1906: about 1.5 million here, againstHEAP_VIEWS= 2^21), so even a clamped index could read past it. It now hasaddress_slots().max(HEAP_VIEWS)entries, as the view-stride table already coversHEAP_VIEWS(write_stride). The entries past the dynamic slots are cleared when the buffer is made, so they read 0 whatever the new allocation held (brainbudt's review), and nothing writes them after. This is 32 MiB of upload memory instead of about 23.main(from ff47463, 54ab406 and 850b66f) called the Windows-onlyvalidatorwithout acfg, so the shader tests no longer built on Linux or macOS. They now go through avalidatehelper, as doesds_bpermute_wave64_preserves_32_lane_half(added onmainsince,cfg-gated but skipping silently withoutdxil.dll). WhereCIis set (GitHub sets it), that helper fails ifdxil.dlldoes not load instead of skipping, so a green run means the DXIL of these tests was validated. This is the separate first commit.lower.rsis within a few KiB of the repository's 512 KiB limit on a file (xtaskasset policy), and the new test would have pushed it over. So the test lives inemit/lower/tests/descriptors.rs, a child oflower's tests that uses their helpers.lower.rsis 521,225 bytes here.Relation to open PRs:
address_slots(). This PR takesaddress_slots().max(HEAP_VIEWS), and GPU: view addresses for tables made afresh (dynamic slots) #1906's testview_addresses_cover_tables_made_afreshnow checks the buffer up toHEAP_VIEWS: the entries past the dynamic slots read 0 up to the last one and are not written, and there is none past it. Its old check of a mark past the buffer's end cannot run any more, since 32 MiB fills the allocation. r4tedx worked out this resolution first and is co-author of the commit.Testing
New test
heap_indices_from_data_are_clamped_before_root_view_reads, on synthetic GFX10 code:Without the two clamps it fails (
left: 3, right: 4).cargo test -p xtask(asset policy): passes.macOS arm64, Rust 1.98.1:
cargo test -p victory-shader --locked --libgives 173 passed, 0 failed, 2 ignored. rustfmt reports nothing new on the changed lines.Windows target, type-checked from macOS:
cargo clippy --target x86_64-pc-windows-msvc --workspace --all-targets --locked -- -D warnings, with and without--all-features, is clean. The GPU tests, including the changed GPU: view addresses for tables made afresh (dynamic slots) #1906 test, run in the Windows CI only.Not run: the GPU tests (no GPU here) and the title.
AI-assisted (Claude Code).
🤖 Generated with Claude Code