From 8ab6f2a8b371e88ad9da0d2e15db9a8f2b9c6d11 Mon Sep 17 00:00:00 2001 From: mici81 Date: Thu, 5 Nov 2026 07:26:46 +0100 Subject: [PATCH] libr4d: qsa_select launches its chained form from a site of its own The emulator test reads the plain launch's kernel name (tests/r4d_emu/test_qsa.cpp), and one launch choosing between the two kernels spelled the choice instead; r4d_emu_qsa and r4d_emu_qsa_sweep failed on it. Co-Authored-By: Claude Opus 5.5 --- libr4d/r4d_qsa_select_bf16.hip | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libr4d/r4d_qsa_select_bf16.hip b/libr4d/r4d_qsa_select_bf16.hip index 91614ff9..6fa3a5f7 100644 --- a/libr4d/r4d_qsa_select_bf16.hip +++ b/libr4d/r4d_qsa_select_bf16.hip @@ -1171,7 +1171,15 @@ static int r4d_qsa_select_bf16_emit(long score, long bt, long nc, long pos, long /* Never more than the table width. */ int cap = (M <= kCacheMaxM) ? lds_cap_of() : 0; if (cap > nb) cap = nb; - return R4D_EMIT(stream, g_r4d_chain_arg ? &r4dchain_qsa_select : &qsa_select_kernel, dim3((unsigned)M), dim3(kThreads), + /* Two launch sites rather than a choice of kernel inside one: each names its kernel alone, and + * the emulator test reads the plain one's name (tests/r4d_emu/test_qsa.cpp). */ + if (g_r4d_chain_arg) + return R4D_EMIT(stream, r4dchain_qsa_select, dim3((unsigned)M), dim3(kThreads), + (size_t)cap * sizeof(uint32_t), (const float*)score, (const int32_t*)bt, + (const int32_t*)nc, (const int32_t*)pos, (const int32_t*)cu, + (int32_t*)sel, (int32_t*)nsel, + (int32_t*)seqused, nb, topk, ratio, nseq, s_ld, t_ld, o_ld, cap); + return R4D_EMIT(stream, qsa_select_kernel, dim3((unsigned)M), dim3(kThreads), (size_t)cap * sizeof(uint32_t), (const float*)score, (const int32_t*)bt, (const int32_t*)nc, (const int32_t*)pos, (const int32_t*)cu, (int32_t*)sel, (int32_t*)nsel,