From: Jesse Zhang <Jesse.Zhang@amd.com>
To: <igt-dev@lists.freedesktop.org>
Cc: Vitaly Prosyak <vitaly.prosyak@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>,
Jesse Zhang <Jesse.Zhang@amd.com>
Subject: [PATCH i-g-t 2/2] lib/amdgpu: add gfx12 shader blob for sync_dependency_test
Date: Thu, 13 Aug 2026 16:03:23 +0800 [thread overview]
Message-ID: <20260813080337.3327962-2-Jesse.Zhang@amd.com> (raw)
In-Reply-To: <20260813080337.3327962-1-Jesse.Zhang@amd.com>
The shader blob used by amdgpu_sync_dependency_test() is a GFX11 (RDNA3)
assembly. GFX12 (RDNA4) re-encoded several of the SOP/FLAT opcodes it uses
(s_endpgm, s_cbranch_scc0 and the store), so on gfx1200 the GFX11 blob decodes
into different instructions: the shader neither terminates nor stores its
result, and the test hangs/fails.
Add a gfx1200 re-assembled copy of the same kernel and select it in
get_shader_bin() by family_id, falling back to the existing GFX11 blob for
everything else.
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
---
lib/amdgpu/shaders/amd_shaders.c | 35 ++++++++++++++++++++++++++++++--
lib/amdgpu/shaders/amd_shaders.h | 3 ++-
tests/amdgpu/amd_basic.c | 3 ++-
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/lib/amdgpu/shaders/amd_shaders.c b/lib/amdgpu/shaders/amd_shaders.c
index adc4fc051..07489706e 100644
--- a/lib/amdgpu/shaders/amd_shaders.c
+++ b/lib/amdgpu/shaders/amd_shaders.c
@@ -109,12 +109,43 @@ uint32_t shader_bin[] = {
SWAP_32(0x000070e0), SWAP_32(0x00000080), SWAP_32(0x000081bf)
};
+/*
+ * GFX12 (RDNA4) re-encoded several of the SOP/FLAT opcodes used above
+ * (s_endpgm, s_cbranch_scc0, the store), so the GFX11 blob decodes into
+ * different instructions and the shader neither terminates nor stores its
+ * result. This is the same kernel re-assembled for gfx1200:
+ *
+ * s_mov_b32 s2, 0
+ * .Lloop:
+ * s_add_co_i32 s2, s2, 1
+ * s_cmp_gt_u32 s2, 0x0098967f
+ * s_cbranch_scc0 .Lloop
+ * v_mov_b32_e32 v0, 42
+ * v_mov_b32_e32 v1, s0
+ * v_mov_b32_e32 v2, s1
+ * flat_store_b32 v[1:2], v0
+ * s_endpgm
+ */
+static const
+uint32_t shader_bin_gfx12[] = {
+ SWAP_32(0x800082be), SWAP_32(0x02810281), SWAP_32(0x02ff08bf), SWAP_32(0x7f969800),
+ SWAP_32(0xfcffa1bf), SWAP_32(0xaa02007e), SWAP_32(0x0002027e), SWAP_32(0x0102047e),
+ SWAP_32(0x7c8006ec), SWAP_32(0x00000000), SWAP_32(0x01000000), SWAP_32(0x0000b0bf)
+};
+
const uint32_t *
-get_shader_bin(uint32_t *size_bytes, uint32_t *code_offset, uint32_t *data_offset)
+get_shader_bin(uint32_t *size_bytes, uint32_t *code_offset, uint32_t *data_offset,
+ uint32_t family_id)
{
- *size_bytes = sizeof(shader_bin);
*code_offset = CODE_OFFSET;
*data_offset = DATA_OFFSET;
+
+ if (family_id == AMDGPU_FAMILY_GC_12_0_0) {
+ *size_bytes = sizeof(shader_bin_gfx12);
+ return shader_bin_gfx12;
+ }
+
+ *size_bytes = sizeof(shader_bin);
return shader_bin;
}
diff --git a/lib/amdgpu/shaders/amd_shaders.h b/lib/amdgpu/shaders/amd_shaders.h
index f7d4cab07..284c1b2f8 100644
--- a/lib/amdgpu/shaders/amd_shaders.h
+++ b/lib/amdgpu/shaders/amd_shaders.h
@@ -30,7 +30,8 @@
#include "amdgpu/compute_utils/amd_shared_dispatch.h"
const uint32_t *
-get_shader_bin(uint32_t *size_bytes, uint32_t *code_offset, uint32_t *data_offset);
+get_shader_bin(uint32_t *size_bytes, uint32_t *code_offset, uint32_t *data_offset,
+ uint32_t family_id);
int
amdgpu_dispatch_load_cs_shader_hang_slow(uint32_t *ptr, uint32_t family_id);
diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
index 3ad023472..84a6d8618 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -553,7 +553,8 @@ amdgpu_sync_dependency_test(amdgpu_device_handle device_handle, bool user_queue)
igt_assert_eq(r, 0);
}
- shader = get_shader_bin(&size_bytes, &code_offset, &data_offset);
+ shader = get_shader_bin(&size_bytes, &code_offset, &data_offset,
+ ip_block->funcs->family_id);
/* assign cmd buffer */
base->attach_buf(base, ib_result_cpu, const_size);
--
2.49.0
next prev parent reply other threads:[~2026-08-13 8:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 8:03 [PATCH i-g-t 1/2] lib/amdgpu: fix NULL deref computing available_rings in amdgpu_create_ip_queues Jesse Zhang
2026-08-13 8:03 ` Jesse Zhang [this message]
2026-08-13 10:59 ` ✓ Xe.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2026-08-13 11:08 ` ✓ i915.CI.BAT: " Patchwork
2026-08-13 12:51 ` ✓ Xe.CI.FULL: " Patchwork
2026-08-19 1:34 ` [PATCH i-g-t 1/2] " vitaly prosyak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260813080337.3327962-2-Jesse.Zhang@amd.com \
--to=jesse.zhang@amd.com \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=vitaly.prosyak@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox