mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 13:58:43 +00:00
vk_compute_test always put the output V# in s[0:3] and zero in every
other user SGPR, so a compute test shader could not be given an input
word: #300's cs_cvt_f32_sat reads its float from s4 and could only be
checked on a GPU by building one shader variant per input by hand.
- VKC_SGPRS=w4,w5,... sets s4, s5, ... up to s31 (s[0:3] stay the output
V#), with the same syntax and checks as vk_harness's VKH_SGPRS: decimal
or 0x hex, no sign, nothing above 32 bits, no trailing comma, at most
28 words; anything else exits 2 with a message.
- cs_user_sgprs.asm declares eight user SGPRs (RSRC2 0x8090) and stores
s4..s7 back. Both runners seed it with 0x4f000000,0xdeadbeef,7,
0xffffffff (check.USER_SGPRS) and expect those words, then the
0xEEEEEEEE fill.
- check.compute_test() takes an env for vk_compute_test.
- tests/test_shader_checks.py: the fake harness only answers
cs_user_sgprs with the seeded words when VKC_SGPRS was passed, and no
other test may get VKC_SGPRS.
AI-assisted (Claude Code). Tested on NVIDIA GeForce RTX 4060 Ti (Ada,
subgroup 32), driver 32.0.16.2124, Windows 11, on main d937b7f:
- run_gpu_tests.py cs_user_sgprs PASS natively and with
LEONIDA_W64_EMULATE=1; check.py cs_user_sgprs ok
- vk_compute_test directly: unset -> s4..s7 read 0; "5" sets s4 only;
28 words accepted; "1,2,", "-1", "0x1ffffffff", "abc" and 29 words
exit 2
- test_shader_checks.py fails (7) if check.py stops passing VKC_SGPRS
- full suite: see the PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
693 B
NASM
15 lines
693 B
NASM
; group: 1,1,1
|
|
; rsrc2: 0x8090
|
|
; Eight user SGPRs: s[0:3] are the output V#, s4..s7 are input words seeded by vk_compute_test's VKC_SGPRS (both
|
|
; runners pass 0x4f000000,0xdeadbeef,7,0xffffffff). One thread stores them back, so a compute test can read an
|
|
; input word (#300's cs_cvt_f32_sat takes its float in s4). Without VKC_SGPRS they read 0.
|
|
; Run: VKC_SGPRS=0x4f000000,0xdeadbeef,7,0xffffffff vk_compute_test cs_user_sgprs.spv 1 dump
|
|
; out[0..7] = 4F000000 DEADBEEF 00000007 FFFFFFFF EEEEEEEE EEEEEEEE EEEEEEEE EEEEEEEE (hex)
|
|
v_mov_b32_e32 v1, 0
|
|
v_mov_b32_e32 v2, s4
|
|
v_mov_b32_e32 v3, s5
|
|
v_mov_b32_e32 v4, s6
|
|
v_mov_b32_e32 v5, s7
|
|
buffer_store_dwordx4 v[2:5], v1, s[0:3], 0 offen
|
|
s_endpgm
|