From 4a55ae5c0bd9f29e4f9d7c111ec5cc1cd2923fad Mon Sep 17 00:00:00 2001 From: Yangwook Date: Wed, 10 Jun 2026 21:04:45 -0700 Subject: [PATCH] =?UTF-8?q?gqa(adr-0065):=20P6=20=E2=80=94=20close=20dispa?= =?UTF-8?q?tch-ratio=20loop=20(ADR-0064=20Test=20#9=20direction)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extend the opt2 R-sensitivity test to assert the opt3/opt2 dispatch ratio increases as R decreases (4.20x -> 5.22x -> 5.45x at R=0.25/0.0625/0.03125) — the cost is FIXED-dominated (command-count-driven), per ADR-0064 Test #9. Test-only; no production change (the P0 cost model + P2 recipe already make the ratio measurable). Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/attention/test_gqa_decode_opt2.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/attention/test_gqa_decode_opt2.py b/tests/attention/test_gqa_decode_opt2.py index 459b228..9314cda 100644 --- a/tests/attention/test_gqa_decode_opt2.py +++ b/tests/attention/test_gqa_decode_opt2.py @@ -97,12 +97,20 @@ def test_opt3_dispatch_exceeds_opt2_by_2x(): def test_dispatch_ratio_R_sensitivity(): - """ADR-0064 Test #9 — opt2 < opt3 across the queue-bandwidth range.""" - for R in (0.25, 0.0625, 0.03125): + """ADR-0064 Test #9 — opt2 < opt3 across the queue-bandwidth range, and + the opt3/opt2 ratio increases as R decreases (the cost becomes more + FIXED-dominated, i.e. command-count-driven). Absolute ratio values are + informative only; the gate is the direction + opt2 < opt3.""" + ratios = [] + for R in (0.25, 0.0625, 0.03125): # strictly decreasing R cm = PeCostModel(fixed_per_cmd_cycles=40, byte_cycles_recip=R) opt3 = _dispatch_cycles(_opt3_tile, cm) opt2 = _dispatch_cycles(_opt2_tile, cm) assert opt2 < opt3, f"R={R}: opt2={opt2} !< opt3={opt3}" + ratios.append(opt3 / opt2) + assert ratios[0] < ratios[1] < ratios[2], ( + f"opt3/opt2 ratio must increase as R decreases; got {ratios}" + ) # ── K-before-V DMA priority (ADR-0065 Test #3) ───────────────────────