From e99a60c5ac6a0180b6ddb36c63c7ec91e15ce74c Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Mon, 23 Nov 2026 05:51:02 +1100 Subject: [PATCH] borealis/tests: give the GS fence-strip loop a run-time trip count check_main_side_effects_fence_strip() builds a geometry shader whose loop runs exactly 64 times and expects the main kernel to keep that loop with one atomic and one fence_mem_to_tex_agx. The loop's only job is to check that stripping the atomic in replay also strips the fence, so the raster variant does not keep a loop alive for the fence alone. With "agx: enable AGX3 compute unroll, shared-memory, and 32x32 GEMM passes on AGX3B" (in aurora-silicon/mesa#704), agx_preprocess_nir_g17p() raises max_unroll_iterations to 64, as M5 already does. The 64-trip loop is then fully unrolled before hk_nir_lower_gs() sees it: the main kernel has 64 atomics, 64 fences and no loop, and the test fails at its first count check although the strip itself still works. Read the trip count from memory instead, so no unroll limit can remove the loop. The checks are unchanged and still fail if strip_fence_mem_to_tex() stops removing the fence. Signed-off-by: Ryan Murray --- src/asahi/vulkan/tests/test-hk-gs-ray-query.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/asahi/vulkan/tests/test-hk-gs-ray-query.c b/src/asahi/vulkan/tests/test-hk-gs-ray-query.c index 24676f8941a7..8c308bff56ae 100644 --- a/src/asahi/vulkan/tests/test-hk-gs-ray-query.c +++ b/src/asahi/vulkan/tests/test-hk-gs-ray-query.c @@ -611,12 +611,17 @@ check_main_side_effects_fence_strip(void) b.shader->info.outputs_written = VARYING_BIT_POS; const uint64_t atomic_addr = 0x10009000000ull; + const uint64_t count_addr = 0x1000a000000ull; + /* A run-time trip count, so no unroll limit can remove the loop before + * the GS lowering sees it. */ + nir_def *trips = nir_load_global(&b, 1, 32, nir_imm_int64(&b, count_addr), + .align_mul = 4); nir_variable *iter = nir_local_variable_create(b.impl, glsl_uint_type(), "i"); nir_store_var(&b, iter, nir_imm_int(&b, 0), 1); nir_push_loop(&b); { nir_def *i = nir_load_var(&b, iter); - nir_break_if(&b, nir_uge_imm(&b, i, 64)); + nir_break_if(&b, nir_uge(&b, i, trips)); nir_global_atomic(&b, 32, nir_imm_int64(&b, atomic_addr), nir_imm_int(&b, 1), .atomic_op = nir_atomic_op_iadd); nir_fence_mem_to_tex_agx(&b);