Files
mandy/runtime/test/shaders/cs_w64_mask_detect.asm
Shrey Ratna 446270b08a GPU tests: fix the two errors GPU-assisted validation reports
Run under VK_LAYER_KHRONOS_validation with GPU-assisted validation (VK_KHRONOS_VALIDATION_GPUAV_ENABLE=1),
which instruments the translated shaders, the llvmpipe GPU suite gives two errors. Both are in the tests,
not the translator, and both passed only because llvmpipe tolerates them:

- vk_bindless_test (ps_tex): the synthetic T#'s word 1, 0x22222222, has FORMAT 34 (10_11_11_UINT). The
  translator picks the uint alias of the image array for a UINT T#, so every draw sampled the test's
  R8G8B8A8_UNORM views through a uint image, which Vulkan leaves undefined
  (VUID-vkCmdDraw-format-07753). The T# now has FORMAT 56 (8_8_8_8_UNORM), checked by a static_assert.
- cs_w64_mask_detect: every lane stored at lane * 64 through a V# that allows any offset, so lanes 4-63
  wrote past the 256 bytes vk_compute_test gives one group, through the buffer's device address
  (VUID-RuntimeSpirv-PhysicalStorageBuffer64-11819). It stores at lane * 4 now; out[0] is still 48.

docs/testing.md: how to run the shader test programs under validation, GPU-AV and sync validation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:01:58 +00:00

17 lines
899 B
NASM

; Wave64 detection from a 64-bit lane-mask op alone (#210 part 2 / SHADER-28).
; mattr: +wavefrontsize64,-wavefrontsize32
; No exec_hi / mbcnt_hi / *_saveexec_b64 / *_wrexec_b64 and no _b64 op on exec/vcc: only s_bcnt1_i32_b64
; on an ordinary SGPR pair. Lanes where (lane & 5) != 0: 48 of 64. A wave32 mis-detect counts 24.
; Run: VKC_SUBGROUP_SIZE=64 vk_compute_test cs_w64_mask_detect.spv 1 dump --require-wave64
; -> out[0] = 48
; With LEONIDA_W64_EMULATE=1 the same on a 32-wide subgroup.
; Every lane stores the count at lane * 4, so the 64 lanes fill the 256 bytes vk_compute_test gives one group. (At
; lane * 64, lanes 4-63 wrote past the buffer through its device address: the V# allows any offset.)
v_and_b32_e32 v5, 5, v0
v_cmp_ne_u32_e64 s[20:21], 0, v5
s_bcnt1_i32_b64 s30, s[20:21]
v_mov_b32 v1, s30
v_lshlrev_b32_e32 v13, 2, v0
buffer_store_dword v1, v13, s[0:3], 0 offen
s_endpgm