Skip to content

crosslane_fuzz.py: ask for 32-wide subgroups for wave32 and emulated programs (FUZZ-13) - #702

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
ismailchaka1:fuzz-13-crosslane-subgroup-size
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
ismailchaka1:fuzz-13-crosslane-subgroup-size

Conversation

@ismailchaka1

Copy link
Copy Markdown
Contributor

Item: FUZZ-13 (claimed in #634), found by @Pierre-Kookis.

tools/crosslane_fuzz.py's run_gpu() never set VKC_SUBGROUP_SIZE, unlike lds_fuzz.py and valu_fuzz.py. On AMD, whose compute default is 64, a wave32 program with a group over 32 lanes ran as one 64-wide subgroup and mismatched in wave 1: 23 of 50 even with --no-maskdata --no-w32-hi-lanes, and 0 of 100 with VKC_SUBGROUP_SIZE=32 (the finding in #634).

  • New gpu_env(prog, emulate, dump) builds vk_compute_test's environment, as run_gpu did. It now also sets VKC_SUBGROUP_SIZE=32 for wave32 programs and for wave64 ones translated with --wave64-emulate, the same rule as the other two fuzzers.
  • A native wave64 program keeps the device default, which is what --w64-native is for (on a 32-wide GPU it is the documented approximate case).
  • run_gpu takes the mode, and both callers (the main loop and still_fails, used by minimisation) pass mode == "emulate".

Tests: tests/test_crosslane_fuzz.py gets a GpuEnv class with 4 tests: wave32 and emulated wave64 ask for 32; native wave64 leaves the caller's value alone and adds none; the buffer size, dump path and inherited variables are kept. python -I tests/test_crosslane_fuzz.py: 19 tests OK. python -m compileall is clean.

Not run end to end: I have no llvm-mc here, and my GPU (NVIDIA RTX 4070 SUPER) is always 32-wide, so it could not show the bug anyway. An AMD run of python -I tools/crosslane_fuzz.py --programs 50 --wave 32 before and after would confirm it; the finding's numbers say it should go from 23/50 to 0.

AI-assisted.

…programs (FUZZ-13)

run_gpu never set VKC_SUBGROUP_SIZE, unlike lds_fuzz.py and valu_fuzz.py.
On AMD (compute default 64) a wave32 program with a group over 32 lanes
ran as one 64-wide subgroup and mismatched in wave 1: 23 of 50 programs,
reported by @Pierre-Kookis, with VKC_SUBGROUP_SIZE=32 bringing that to 0
of 100.

The environment is now built by gpu_env(), which sets
VKC_SUBGROUP_SIZE=32 for wave32 programs and for wave64 ones translated
with --wave64-emulate; native wave64 keeps the device default, as
--w64-native intends. Both callers pass the mode. Four unit tests cover
it.
@Pierre-Kookis

Copy link
Copy Markdown
Contributor

AMD check of #702 (8cd37b2). I reported this on #638 and #634, so here is the before and after on the GPU where it showed.

Setup: Windows 11. AMD Radeon Graphics (Ryzen 7 7800X3D iGPU, RDNA2), driver 32.0.21043.5001, subgroup 32..64. RTX 4070 Ti SUPER, driver 610.88, subgroup 32. Test programs from main c432cdc (llvm-mingw clang), llvm-mc 23.1.6. VKC_SUBGROUP_SIZE not set in the shell.

crosslane_fuzz.py --modes both --wave both, seed 1, 50 programs per wave (match / mismatch / hyp_only):

wave32 native, main wave32 native, #702 wave64 emulate, #702
AMD 6 / 28 / 16 24 / 11 / 15 24 / 12 / 14
AMD, --no-maskdata --no-w32-hi-lanes 13 / 23 / 14 36 / 0 / 14 36 / 0 / 14
NVIDIA 24 / 11 / 15 24 / 11 / 15 24 / 12 / 14
NVIDIA, --no-maskdata --no-w32-hi-lanes 36 / 0 / 14 36 / 0 / 14 36 / 0 / 14

With #702, AMD now gives exactly the NVIDIA counts. The 11 and 12 left in the full run are the maskdata and high-lane classes (#293) on both GPUs. Seed 2, clean, on AMD: 0 mismatches (wave32 38 / 0 / 12, emulate 37 / 0 / 13). tests/test_crosslane_fuzz.py: OK, self-test OK.

(AI-assisted run, counts only.)

@kapitche

Copy link
Copy Markdown
Contributor

Tested 8cd37b2 on Linux (WSL2 Ubuntu), Python 3.12, CPU only (no GPU run): pass

  • pytest tests/test_crosslane_fuzz.py: 19 passed, 4 subtests
  • Negative control: with tools/crosslane_fuzz.py from main, 4 tests fail.
  • Code read: VKC_SUBGROUP_SIZE=32 is set for wave32 and for emulated wave64, and native wave64 keeps the device default, which matches lds_fuzz.py/valu_fuzz.py. Both call sites pass mode == 'emulate'. An AMD run would still be worth having, to confirm the false wave-1 mismatches are gone.

@troythedecoyx

Copy link
Copy Markdown
Contributor

Tested 8cd37b2 on NVIDIA GeForce RTX 4060 Ti (Ada, subgroup 32..32), driver 621.24, Windows 11; LLVM 21.1.8 (WSL), Vulkan SDK 1.4.363: pass for the 32-wide half.

On a device whose only subgroup size is 32, asking for VKC_SUBGROUP_SIZE=32 should change nothing, and it doesn't: crosslane_fuzz.py --modes both --programs 30 --seed 1 gives output identical to main 67204bf, program for program (wave32 native: 15 programs, 7 match, 3 mismatch, 5 hyp_only; wave64 emulate: 15, 9 match, 4 mismatch, 2 hyp_only). The mismatches are the same on main (masks read as data and wave32 lane selects, #293/#407), not from this PR. tests/test_crosslane_fuzz.py and --self-test: OK on both.

The AMD half (a 64-wide default) still needs an AMD GPU.

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants