GPU, HLE, loader and shader: 14 bug fixes, built and tested on Windows (replaces #460) #469
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!469
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-469"
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?
@GiovanniFadanelli on GitHub · 2026-11-27 14:22 UTC · original
GiovanniFadanelli:fixes/stability-tested→main· +571 −54 · 18 files · 17 commits · openReplaces #460 (zocram4cc). The same 14 cherry-picked commits with their original authors (davutsimsekk, avt0m4t, AscilCH ×3, Peppacodes ×2, Vax, mynzjerko, libslibslibslibslibslibs), plus three fix-ups found by building and testing them:
heap_bytes_retains_allocation_across_apu_freewas the onlyApuAlloctest withoutCONTEXT_TESTS. AfterApuFree, a parallel test could take the same APU address, soApuMapApuAddress(apu).is_null()failed now and then (1 run in 8 here; also seen in a parallel workspace run on klbf-lab beta). CI runs tests in parallel.VICTORY_HELPER_OWN(zocram4cc, cherry-picked). Answers the review point that the new select bypassedVICTORY_HELPER_OWN=0, which the shader cache keys on. The select now follows the switch, and it still covers the two-host-wave exchange path, wherefirst_lane's result can come from the other half.TRANSLATOR_VERSION's own comment asks for a bump. Without it, existing installs keep serving cached translations (the other review point).One default-on behaviour change, as in #460: "GPU/resource: preserve 4 KiB texture alignment" keeps 4 KiB alignments in
GetResourceAllocationInfo(2)instead of raising them to 64 KiB, so the title spaces its small textures as on the console.resource::tests::sizes_cover_every_mipcovers it. Not measured in game.Testing (Windows 11, RX 9070 XT, native MSVC toolchain 1.98.1; base
126acb35vs this head)126acb35cargo check -p victory-gpu -p victory-hle -p victory-loader -p victory-shader -p victory --all-targetscargo test -p victory-shader(lib, one test skipped, see below)--test-threads 1--test-threads 1cargo check -p victory-gpu --features diagnostics --all-targetscargo test --workspace --all-features -- --test-threads=1: victory-gpu-D warnings(default and--all-features,--keep-going)transmutelints, pluslist.rsopenandwatch.rstotalsin victory-gpu, as #409 fixesRed first: 11 of the 12 new or extended tests fail with their fix reverted and pass with it (for the queue use-after-free and the 16-bit gradient fix, by a hand revert of the fix itself). The exception is the APU heap test: its use-after-free half cannot be reverted without breaking the test's build, and its overflow assertion cannot fail at offset 0. For example:
sizes_cover_every_mipleft: AllocationInfo { size: 352256, alignment: 65536 },release_waits_for_release_held_before_freeing_waiting_queue"queue::release freed queue while release_held lock was held", andfloat_compares_that_are_always_false_or_trueWARP "device removed". Not red-first-able: the snapshot retry and the helper-lane readfirstlane commits carry no test.Pre-existing on main and not from this PR: CI is red on every main run, both clippy steps fail (fixed by #409), and on an RX 9070 XT (RDNA 4)
emit::size_tests::the_record_count_of_a_structured_buffer_read_by_indexcrashes the shader test process with an access violation (base and head alike, which endscargo test --workspaceearly). That is the RDNA 4 compiler crash #55 addresses: on #55's head (whose base is the same126acb35) the test passes on this card.Not verified: in-game behaviour (no game runs) and the layout change in game.
AI-assisted (build, tests, red-first, the three fix-ups); the code of the 14 is the original authors'.
🤖 Generated with Claude Code
Fix two resource allocation-info bugs in `crates/victory-gpu/src/resource.rs`: 1. `place()` initialized `total.alignment = KIB_64` and took `max(one.alignment)`, clobbering 4 KiB console texture alignments (e.g., 512x512 BC7 10 mips -> `{ size: 0x56000, alignment: 0x1000 }`) up to 64 KiB in `GetResourceAllocationInfo` / `GetResourceAllocationInfo2` (and producing contradictory `total.alignment = 64 KiB` vs `each[0].alignment = 4 KiB` in `GetResourceAllocationInfo2`). Start with `alignment: 0` and default to `KIB_64` only for empty descriptor lists. 2. `footprint()`'s fallback path rounded `size` to `KIB_64` instead of `alignment`, leaving `SizeInBytes` unaligned to `Alignment` for MSAA (`MIB_4`) or custom-aligned resources. Round to `alignment`. Extend `resource::tests::sizes_cover_every_mip` to verify both fixes.cmp rax, reg(decode part of bbd2408) 2162d0dd06From AscilCH's bbd2408 ("loader: fix ClzeroLoop ModRM decoding, >=2 GiB skip, unaligned/empty bounds, and EFlags"), the decoder part only: `decode` did not check that `48/4C 39 modrm` is register to register with rax as the destination, so `cmp rcx, rdx`, `cmp [rax], rdx` or `cmp rax, rax` after `clzero; add rax, 0x40` decoded as a ClzeroLoop. With the check those are a plain clzero, stepped one at a time. The emulation parts (>= 2 GiB, end <= start, unaligned, EFlags) are not taken: RYUKI rewrote the loop's emulation (passes capped at 2 GiB and continued, one pass for an end not above the start, flags from cmp_flags, a stub patched in on the first fault), which covers them.v_cmp_f_{f32,f16} and v_cmp_tru_{f32,f16} lowered to fcmp false and fcmp true (predicates 0 and 15). DXC folds those away, so drivers never see them from it, and WARP removes its device at the first dispatch of a pipeline that has one ("The GPU device instance has been suspended"). The hardware adapter (RTX 5080) runs them. A removed WARP device stays removed for the process, so everything after it fails too. They are false and true whatever the operands, NaNs included (RDNA2 ISA), so they now lower as constants, as the integer v_cmp_f/v_cmp_t already do. FALSE and TRUE stay in the predicate table, unused. Found with a sweep of every 32-bit VALU instruction on the hardware adapter against WARP: all 62 compares now run and agree on both. Test: float_compares_that_are_always_false_or_true, f32 and f16 with ordinary and NaN operands, on the hardware adapter and WARP. On main WARP's dispatch fails with the device suspended.TRANSLATOR_VERSION 1 -> 2. Five commits of this series change what the translator makes ("a helper lane's v_readfirstlane reads its own value", "always-false and always-true float compares lower as constants", "pack 16-bit gradients ... image_sample_*_g16", "keep annotateHandle local to its block", "export target 16 is pos4"). TRANSLATOR_VERSION's own comment asks for a bump with any change of a shader's translation; without it, installs keep serving the old translations from the shader cache (raised in review of avatarmanz/VIctory-7900XTX#460). Adapted from zocram4cc/victory-linux-perf 774e5221 (4 -> 5 there). Co-Authored-By: Claude Opus 5.5 <[email protected]>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.