From 88a3579d2bb4bd08900614310c4c535c73931d1c Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Fri, 27 Nov 2026 10:50:08 -0600 Subject: [PATCH] agx: enable AGX_CAP_COMPUTE_SMART_WAITS on G13G Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> --- src/asahi/compiler/test/test-insert-waits.cpp | 8 ++++++-- src/asahi/lib/agx_chip_caps.h | 7 ++++--- src/asahi/lib/tests/test-chip-caps.c | 14 ++++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/asahi/compiler/test/test-insert-waits.cpp b/src/asahi/compiler/test/test-insert-waits.cpp index cb82fd46d18d..cfbf2abf77f8 100644 --- a/src/asahi/compiler/test/test-insert-waits.cpp +++ b/src/asahi/compiler/test/test-insert-waits.cpp @@ -157,11 +157,15 @@ TEST_F(InsertWaits, SmartWaitsAvoidsMidBurstOverflowOnG14X) agx_context *g14x = build_case(AGX_CHIP_G14X, MESA_SHADER_COMPUTE); agx_context *frag = build_case(AGX_CHIP_G14X, MESA_SHADER_FRAGMENT); - EXPECT_GE(count_waits_before_first_alu(agx_start_block(g13g)), 2u); + agx_context *g13g_frag = build_case(AGX_CHIP_G13G, MESA_SHADER_FRAGMENT); + + EXPECT_EQ(count_waits_before_first_alu(agx_start_block(g13g)), 1u); EXPECT_GE(count_waits_before_first_alu(agx_start_block(g13x)), 2u); EXPECT_GE(count_waits_before_first_alu(agx_start_block(g14g)), 2u); EXPECT_EQ(count_waits_before_first_alu(agx_start_block(g14x)), 1u); - EXPECT_TRUE(agx_shader_equal(g13g, frag)); + EXPECT_TRUE(agx_shader_equal(g13g, g14x)); + EXPECT_TRUE(agx_shader_equal(g13x, frag)); + EXPECT_TRUE(agx_shader_equal(g13x, g13g_frag)); } TEST_F(InsertWaits, SmartWaitsLinearOnLongIndependentLoadBlock) diff --git a/src/asahi/lib/agx_chip_caps.h b/src/asahi/lib/agx_chip_caps.h index 8dddf90c0ccb..796a90a6cd03 100644 --- a/src/asahi/lib/agx_chip_caps.h +++ b/src/asahi/lib/agx_chip_caps.h @@ -188,8 +188,9 @@ enum agx_chip_cap { /* Partition AGX2 compute async scoreboard slots by first-use distance and * avoid premature AGX_MAX_PENDING=8 slot-0 overflow stalls when early-use - * loads mix with late-use loads (agx_insert_waits). Measured on G14X (M2 Max); - * other chips keep the stock pass until measured on aurora-wip. */ + * loads mix with late-use loads (agx_insert_waits). Measured on G13G (M1) + * and G14X (M2 Max); other chips keep the stock pass until measured on + * aurora-wip. */ AGX_CAP_COMPUTE_SMART_WAITS = 1u << 28, /* Hoist non-coherent AGX2 compute device_loads together with pure SSA @@ -296,7 +297,7 @@ enum agx_chip_cap { * predicates do. */ #define AGX_CHIP_CAPS(X, ...) \ - X(G13G, AGX_CAPS_G13, __VA_ARGS__) \ + X(G13G, AGX_CAPS_G13 | AGX_CAP_COMPUTE_SMART_WAITS, __VA_ARGS__) \ X(G13X, AGX_CAPS_G13, __VA_ARGS__) \ X(G14G, AGX_CAPS_AGX2, __VA_ARGS__) \ X(G14X, \ diff --git a/src/asahi/lib/tests/test-chip-caps.c b/src/asahi/lib/tests/test-chip-caps.c index 6becc9ab27cf..d1472768f60a 100644 --- a/src/asahi/lib/tests/test-chip-caps.c +++ b/src/asahi/lib/tests/test-chip-caps.c @@ -367,11 +367,17 @@ main(void) test_cdm_defer_flush(); for (unsigned i = 0; i <= AGX_CHIP_UNKNOWN; ++i) { const enum agx_chip c = (enum agx_chip)i; - const bool expected = c == AGX_CHIP_G14X; - CHECK_CHIP(agx_chip_has_cap(c, AGX_CAP_COMPUTE_SMART_WAITS) == expected, - c); + const bool expected_smart_waits = + c == AGX_CHIP_G13G || c == AGX_CHIP_G14X; + const bool expected_hoist = c == AGX_CHIP_G14X; + CHECK_CHIP( + agx_chip_has_cap(c, AGX_CAP_COMPUTE_SMART_WAITS) == + expected_smart_waits, + c); CHECK_CHIP( - agx_chip_has_cap(c, AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS) == expected, c); + agx_chip_has_cap(c, AGX_CAP_COMPUTE_HOIST_LOAD_ADDRS) == + expected_hoist, + c); } test_compute_coherent_store(); test_pbe_queued_buffer_copy();