From 8980c2051531d4825f3a1392989cbe9c3c32b1e7 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 11 Jun 2026 16:01:27 -0400 Subject: [PATCH] gdb.rocm/names.exp: build test program with optimizations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running on gfx90a, the test program for gdb.rocm/names.exp hangs when running all kernels: $ GPU_MAX_HW_QUEUES=32 testsuite/outputs/gdb.rocm/names/names all *hangs* When debugging with GDB, I see 4 running waves waiting in function wait_all_kernels, and kernels_seen is 4, meaning that the other kernels didn't start. I noticed that if I compiled the test program at -O2, it ran fine. Claude identified this as a resource issue: ● I extracted the kernel metadata from both binaries to compare. Here's the cause: names-0 (-O0), per kernel: - vgpr_count: 43, sgpr_count: 42 - private_segment_fixed_size: 72 (or 88/104) - uses_dynamic_stack: true names-2 (-O2), per kernel: - vgpr_count: 3, sgpr_count: 9 - private_segment_fixed_size: 0 - uses_dynamic_stack: false Presumably, at -O0, each wave (or queue?) consumes more resources and we can't get all 9 on the hardware at the same time. But I am not knowledgeable enough to say if that's correct. Fix it by building with -O2 so all kernels can be in flight concurrently. At -O2, the argument values appear to be optimized out, so update the expected frame function string. I don't think that it matters for this test that we are losing the actual argument values. I just hope that they will indeed always be optimized out so that we won't get FAILs because of that (worst case we can expect .* for the argument values). Change-Id: Ida07faf8b07bf9e0b21ce16bb6af7b019f01588b --- gdb/testsuite/gdb.rocm/names.exp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.rocm/names.exp b/gdb/testsuite/gdb.rocm/names.exp index b18c1ac2f53..44b05438817 100644 --- a/gdb/testsuite/gdb.rocm/names.exp +++ b/gdb/testsuite/gdb.rocm/names.exp @@ -21,7 +21,10 @@ require allow_hipcc_tests standard_testfile .cpp -if {[build_executable "failed to prepare" $testfile $srcfile {debug hip}]} { +# Optimize: at -O0 the kernels use scratch memory, which limits GPU +# concurrency below what wait_all_kernels needs and causes a deadlock. +if {[build_executable "failed to prepare" $testfile $srcfile \ + {debug hip optimize=-O2}]} { return } @@ -69,7 +72,7 @@ set all_kernels_info { {long_kernel_name_0123456789 long_kernel-0245 {long_kernel_name_0123456789 ()}} {long_kernel_name_abcdefghijklmnopqrstuvwxyz long_kernel-479c {long_kernel_name_abcdefghijklmnopqrstuvwxyz ()}} {templ_non_type templ_non_type {templ_non_type<(E)0> ()}} - {templ_type templ_type {templ_type (args=1, args=2)}} + {templ_type templ_type {templ_type (args=, args=)}} } # By default, the runtime allows 4 hardware queues max, which limits