fix(shader): reject modified v_add_co_ci_u32 in address carry tracing #3362
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3362"
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?
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T20:25:50Z.
Summary
Tracer::carriedmatchedv_add_co_ci_u32without checking VALU input/output modifiers (abs,neg,opsel,clamp,omod,sdwa,dpp).clamp), SDWA sub-dword, or DPP lane-permutedv_add_co_ci_u32was therefore accepted as a plain 64-bit address high-half carry, misclassifying the resulting global memory address as belonging to a root descriptor parameter instead of falling back toMEMORY.Tracer::carriedto require unmodifiedv_add_co_ci_u32(abs == 0 && neg == 0 && opsel == 0 && !clamp && omod == 0 && sdwa.is_none() && dpp.is_none()).modified_v_add_co_ci_u32_is_not_treated_as_plain_address_carrycovering plain vs clamped, SDWA, and DPP16 encodings.Verification
victory-shaderon Linuxcargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningscargo test -p xtask --lockedImported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T20:27:05Z.
Review: APPROVED
LGTM — verified on Windows against
origin/main(63bcca4).v_add_co_ci_u32instructions with VALU modifiers (abs,neg,opsel,clamp,omod,sdwa,dpp) during address carry tracing avoids misclassifying saturating/SDWA/DPP operations as plain 64-bit address high-half carries.cargo test -p victory-shader --lib resource:: -- --test-threads=1: 36 passed, 0 failed (includingmodified_v_add_co_ci_u32_is_not_treated_as_plain_address_carry).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).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T20:48:25Z.
Review: APPROVED
LGTM — adding the VALU modifier guards (
abs,neg,opsel,clamp,omod,sdwa,dpp) toTracer::carriedprevents modifiedv_add_co_ci_u32instructions from being misclassified as plain 64-bit address high-half carries.Verified
cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--all-features): clean.rustfmt --edition 2024: clean on all PR-touched hunks incrates/victory-shader/src/resource.rs.cargo test --locked -p victory-shader --lib resource::tests:: -- --test-threads=1: 36 passed, 0 failed (includingmodified_v_add_co_ci_u32_is_not_treated_as_plain_address_carry).cargo test --locked -p victory-shader --lib -- --test-threads=1 ir:: structure:: io:: emit::lower::: 59 passed, 0 failed, 1 ignored.Non-blocking follow-up notes
resource.rs(vaddat731-753,voriginat764-777, andreaches_pcat863) have similar gaps (missingclamp/omodguards onv_mov_b32/v_add_*, andcarriednot yet validating the other addend or carry-in provenance).resource.rs:3937): since 48-bit global addresses drop the upper 16 bits,dst_sel:WORD_0with zero-pad still produces the same effective address and exercises conservative fallback toMEMORY.Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:29:06Z.
Windows 11,
63bcca4+ this PR:resource::tests::modified_v_add_co_ci_u32_is_not_treated_as_plain_address_carryby name: 1 passed.cargo test -p victory-shader --lib resource::: green.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.The guard now requires abs/neg/opsel clear, no clamp, omod 0 and no SDWA/DPP before a
v_add_co_ci_u32is read as the plain carry-add of an address; the test's plain VOP3B case still traces as a parameter and the clamped case stops doing so. Synthetic only. AI-assisted.Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T07:17:04Z.
NVIDIA full-suite run, to go with the reports above by Dukestar69, Jackster, fuzeofficlal, since none of them names a GPU run. Tested exact head
dd8cf5f(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.modified_v_add_co_ci_u32_is_not_treated_as_plain_address_carry.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.