perf(vk): GCN (RX 400/500): f16 lowered where the GPU has none; no VRAM mirrors or batched submits by default (from hookshot-k10) #2343
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!2343
Loading…
Reference in a new issue
No description provided.
Delete branch "port/k10-gcn-f16-mirrors"
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?
Ported from deadlynch/hookshot-k10 commit e09059c1, credited as co-author. That fork carries the fixes that got an RX 580 under RADV to play.
shaderFloat16 = false, yet the translator always emitted f16, and Kokiri Forest drew as coloured noise. f16 is now lowered to f32 there, as Pascal (GTX 10xx, also without f16) needs too. The f16 networks fall back to the linear stand-in, and these programs are kept apart in the program cache (disk_stamp), so other GPUs keep theirs.RX_VK_MIRROR/RX_VK_BATCHstill choose.GPUs with f16 shaders and 32-lane stages (RTX, RDNA) take exactly the same path as before.
Checked
🤖 Generated with Claude Code
Thanks for porting this. The gating looks right to me for the cards that matter most: on RTX and RDNA,
sg32_stagesis non-zero (minSubgroupSize <= 32with subgroup size control), sogcnis false and mirrors and batching stay as before. Intel and NVIDIA report 32-lane subgroups, so they're excluded too. The f16 change only applies whereshaderFloat16is false, and thenf16stamp is only added there, so caches on f16 cards don't change. Nothing has been posted on the thread yet, so these are first notes.The one blocker is CI.
tests/test_amd_subgroup_profiles.pyfails on Linux and Windows because of this PR. It copiesdisk_stamp()fromconst uint32_t lanes[]to// (the records keep Shader::Info, and the newnf16block falls inside that slice. The fixture'sdevstub has novk12(no member named 'vk12'), and itsaddstub expects every call to be 5 words. The simplest fix is to move the block below theabi[]add, outside the slice. If you'd rather keep it where it is, give the stub avk12and letcheck_stampaccept the extra word. The other red jobs (Python checks part 1/2 on Ubuntu, SPIR-V fixtures, appimage) died in apt withTemporary failure resolving 'azure.archive.ubuntu.com', so a re-run should clear them.Things to be aware of, but not blocking:
shaderFloat16, including GTX 10xx going by the description. The existing comment athost_info()says Eden's lowering on its own drew Kokiri as noise on an RTX card. Pascal now gets that lowering, the linear stand-in for the networks, and a fresh program cache, and it hasn't been tested yet. A run on a 10xx before merging would be worth it, or at least a line in the description saying Pascal changes too.gcntest also matches Vega (the comment says so) and Vega/GCN APUs on RADV, where batching now turns off. The numbers come from an RX 580 (and an RX 590 in #1001), so for Vega and the APUs this is an assumption. That's probably fine sinceRX_VK_MIRROR/RX_VK_BATCHstill override.Good to merge once the subgroup-profile test is fixed and CI is green, plus the RTX 4060 Ti run you mentioned.
@ -186,8 +186,10 @@ bool batch_on() {p2.pNext = &dp;if (dev.physical) vkGetPhysicalDeviceProperties2(dev.physical, &p2), radv = dp.driverID == VK_DRIVER_ID_MESA_RADV;const char* e = getenv("RX_VK_BATCH");Nit:
sg32_stagesis also 0 whenRX_VK_NO_SUBGROUP_PINis set, so on RDNA that debug switch now also turns batching (and VRAM mirrors) off, which could confuse an A/B test. It would also catch an RDNA driver without subgroup size control. Neither is a big deal. Maybe say it in the comment, or work out GCN fromminSubgroupSizeinstead.This also changes Pascal (and any other card without
shaderFloat16) by default, not only Polaris. The comment just above says this lowering on its own gave noise on an RTX card. It would be good to have a GTX 10xx run, or at least to say in the description that Pascal changes too.This sits inside the slice
tests/test_amd_subgroup_profiles.pytakes fromdisk_stamp()(const uint32_t lanes[]up to// (the records keep Shader::Info). The fixture'sdevhas novk12, so it fails to compile on both platforms. Even with one, itsaddstub assertsbytes == 5 * sizeof(uint32_t). Moving this block after theabi[]add avoids both problems.The stub now sets
vk12.shaderFloat16 = true.test_amd_subgroup_profilesandtest_shader_stamp_cachepass locally. The gatesg32_stages == 0 && subgroup_size > 32is false on RTX, RDNA, Intel and Arc, and thenf16stamp word is only added withoutshaderFloat16, so caches on f16 GPUs stay valid.Side effect: setting
RX_VK_NO_SUBGROUP_PINon RDNA now also matches GCN and loses mirrors and batching (RX_VK_MIRROR/RX_VK_BATCHstill override).This changes
vk_shader.cpp, as do #2309, #2306, #2442 and #2457. Shipping them in one release means players re-prepare once.github-sync referenced this pull request2026-11-12 06:22:54 +00:00