Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions runtime/test/shaders/cs_imgload_d16_tfe.asm
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions runtime/test/shaders/cs_imgload_tfe.asm
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading