From 8afbba14b9e96c4809c6a2ee0b574be9f3d1003e Mon Sep 17 00:00:00 2001 From: cole Date: Tue, 24 Nov 2026 09:54:35 -0500 Subject: [PATCH] tests: expect resident image_load tfe to preserve seeded status VGPRs (SHADER-1266) --- runtime/test/shaders/cs_imgload_d16_tfe.asm | 16 ++++++++++------ runtime/test/shaders/cs_imgload_tfe.asm | 19 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/runtime/test/shaders/cs_imgload_d16_tfe.asm b/runtime/test/shaders/cs_imgload_d16_tfe.asm index 0739810d1b..119653577a 100644 --- a/runtime/test/shaders/cs_imgload_d16_tfe.asm +++ b/runtime/test/shaders/cs_imgload_d16_tfe.asm @@ -1,8 +1,10 @@ ; tfe status VGPR on a d16 image_load (SHADER-1266): cs_imgload_d16 with tfe on both loads. Under d16 one -; component fills one VGPR, and with tfe the fetch status follows it, so vdata is v[7:8] and v[11:12]. Every texel is -; resident, so the status is 0. Each status VGPR is seeded with 1000 and added into the result, so a stale status -; moves every texel by 2000. The unpacking and the result are cs_imgload_d16's, checked by vk_store_test load-d16 -; (including its saturation row). Suggested by @nnonno91, who ran the same companion on gfx1036 and an RTX 5090 in #8968. +; component fills one VGPR, and with tfe the fetch status follows it, so vdata is v[7:8] and v[11:12]. On a resident +; texel, RDNA2 hardware leaves the status VGPR unchanged. The two status VGPRs are seeded with distinct values +; (v8 = 0x3e8, v12 = 0x7d0) and independently checked via (v8 ^ 0x3e8) | (v12 ^ 0x7d0) before adding into v11, so +; zeroing or modifying either status VGPR shifts every texel. The unpacking and the result are cs_imgload_d16's, +; checked by vk_store_test load-d16 (including its saturation row). Suggested by @nnonno91, who ran the same +; companion on gfx1036 and an RTX 5090 in #8968. v_and_b32_e32 v1, 7, v0 v_lshrrev_b32_e32 v2, 3, v0 v_cvt_f32_u32_e32 v3, v1 @@ -38,14 +40,16 @@ s_mov_b32 s28, 0x33 s_mov_b32 s29, 0x33 s_mov_b32 s30, 0x33 s_mov_b32 s31, 0x33 -v_mov_b32_e32 v12, 0x3e8 +v_mov_b32_e32 v12, 0x7d0 image_load v[11:12], v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm tfe d16 s_waitcnt vmcnt(0) v_and_b32_e32 v7, 0xffff, v7 v_bfe_i32 v11, v11, 0, 16 v_add_nc_u32_e32 v11, v7, v11 +v_xor_b32_e32 v8, 0x3e8, v8 +v_xor_b32_e32 v12, 0x7d0, v12 +v_or_b32_e32 v8, v8, v12 v_add_nc_u32_e32 v11, v8, v11 -v_add_nc_u32_e32 v11, v12, v11 v_mov_b32_e32 v12, 0 v_mov_b32_e32 v13, 0 v_mov_b32_e32 v14, 0 diff --git a/runtime/test/shaders/cs_imgload_tfe.asm b/runtime/test/shaders/cs_imgload_tfe.asm index 63ad9dc71f..6eb3e76f6d 100644 --- a/runtime/test/shaders/cs_imgload_tfe.asm +++ b/runtime/test/shaders/cs_imgload_tfe.asm @@ -1,9 +1,10 @@ -; tfe status VGPR on image_load (SHADER-1266): cs_imgload with tfe on both loads. With tfe an MIMG read returns one -; more dword after its data, the fetch status, at vdata[data_count] (RDNA2 ISA, MIMG TFE/LWE). Every texel here is -; resident, so the status is 0. Each status VGPR is seeded with 1000 before its load and added into the result, so a -; status that keeps its old value moves every texel by 1000 or 2000. vk_store_test fills the r32 uint image with -; 100 + 8y + x and the r32 sint image with -2 (8y + x) before the dispatch; the rgba8 image is stored as in -; cs_imgstore. Run: vk_store_test cs_imgload_tfe.spv load -> sint = 100 - (8y + x), uint unchanged. +; tfe status VGPR on image_load (SHADER-1266): cs_imgload with tfe on both loads. With tfe an MIMG read reserves one +; more dword after its data, the fetch status, at vdata[data_count] (RDNA2 ISA, MIMG TFE/LWE). On a resident texel, +; RDNA2 hardware leaves the status VGPR unchanged. The two status VGPRs are seeded with distinct values (v8 = 0x3e8, +; v12 = 0x7d0) and independently checked via (v8 ^ 0x3e8) | (v12 ^ 0x7d0) before adding into v11, so zeroing or +; modifying either status VGPR shifts every texel. vk_store_test fills the r32 uint image with 100 + 8y + x and the +; r32 sint image with -2 (8y + x) before the dispatch; the rgba8 image is stored as in cs_imgstore. +; Run: vk_store_test cs_imgload_tfe.spv load -> sint = 100 - (8y + x), uint unchanged. v_and_b32_e32 v1, 7, v0 v_lshrrev_b32_e32 v2, 3, v0 v_cvt_f32_u32_e32 v3, v1 @@ -39,12 +40,14 @@ s_mov_b32 s28, 0x33 s_mov_b32 s29, 0x33 s_mov_b32 s30, 0x33 s_mov_b32 s31, 0x33 -v_mov_b32_e32 v12, 0x3e8 +v_mov_b32_e32 v12, 0x7d0 image_load v[11:12], v[1:2], s[24:31] dmask:0x1 dim:SQ_RSRC_IMG_2D unorm tfe s_waitcnt vmcnt(0) v_add_nc_u32_e32 v11, v7, v11 +v_xor_b32_e32 v8, 0x3e8, v8 +v_xor_b32_e32 v12, 0x7d0, v12 +v_or_b32_e32 v8, v8, v12 v_add_nc_u32_e32 v11, v8, v11 -v_add_nc_u32_e32 v11, v12, v11 v_mov_b32_e32 v12, 0 v_mov_b32_e32 v13, 0 v_mov_b32_e32 v14, 0