fix(vk): bound compare-exchange loops and give EQUAL depth tests a margin on Intel #548
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!548
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/intel-arc-cas-depth"
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?
As asked in #17: the bounded
CasLoopand the EQUAL-depth change, one commit each, so they can be tried on other GPUs.Bounded compare-exchange loops
The four compare-exchange loops of the SPIR-V backend left only on success:
CasLoop(the atomics it emulates) and the shared-memory, storage-buffer and global byte/halfword stores (the last one new with #536). Under robust buffer access an atomic on a word out of bounds need not return what it was given, and then the loop never ends. On an Intel Arc B390 theStorageAtomicAddF32of compute435a0138b9013040did that after the intro movie: no device loss, the frame just never came back (the freeze several people report in #17).Each loop now counts its attempts in a Function variable and leaves on success or at
CAS_LOOP_MAX_TRIES(1024). Every failed attempt on a real word means another invocation's succeeded, so contention never comes near the ceiling.Note: since the
foliage-linux-updaterrelease each attempt expects the word the last exchange returned, and with that I no longer saw the hang (9 minutes of play without the ceiling). The ceiling is the guarantee that a loop ends whatever the driver returns.EQUAL depth margin on Intel
The colour passes after the depth prepass (
43ec86f35fd937b9after8a8304edb7bdf4bf,6b4dea…aftere28434…,68642b…aftercb71f7…) test EQUAL against depth written by a different program. Intel's compiler does not give the two programs the same position to the last bit, so most ground pixels failed the test: about 550k fragments for the colour pass against 1.8M for the depth one, and the sky showed through the ground.Where depth is tested, not written, and the game asks for EQUAL, the test becomes LESS_OR_EQUAL with a depth bias of 64 units towards the camera. It is on by default on Intel (vendor 0x8086) only.
RX_VK_EQ_BIAS=<units>turns it on for any GPU, so it can be tried elsewhere;RX_VK_EQ_BIAS=0turns it off.Testing
3d6a388plus these changes. The ceiling on #536's new global-store loop came with the rebase and is compile-checked only.tests/test_cas_loop_ceiling.pyandtests/test_equal_depth_margin.py, wired intosource-regressions.yml(paths and run steps). Both pass on this branch and fail on main. The other checks CI runs on Windows pass too, apart fromnx2/test_nup_paths.py, which fails the same way on main on this PC (WinError 1314: creating symlinks needs a privilege this account lacks).Refs #17