gqa(adr-0065): P3 — flat-ops PE_SCHEDULER plan (position-scan + prologue stages)

tiling.generate_plan_from_ops: scan flat ops for the GEMM (<=1); pre-GEMM KERNEL ops become single-shot prologue MATH stages, post-GEMM ops split by scope (K_TILE/OUTPUT_TILE epilogue + KERNEL post-loop). MATH-only composite reproduces the legacy math-head plan. Prologue/post-loop stages fold into the first/last tile so the feeder + completion counting are untouched (existing benches have neither -> byte-equal op_log).

PipelinePlan gains prologue_stages/epilogue_stages. pe_scheduler._generate_plan delegates to generate_plan_from_ops. DMA keeps the existing pinned signal (NOT a space flip); recipe scratch/primary-out handles are pinned=True so the head GEMM's auto-bound a (=P) is consumed in place.

ADR-0065 D4/D6.7/Test#5 amended (EN+KO): DMA decision from pinned, not space; prologue recipe ops TCM-only (head op exempt -- it may stream from HBM).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-10 20:24:33 -07:00
parent 184f654295
commit 55f025c4b1
7 changed files with 304 additions and 90 deletions
+5 -1
View File
@@ -934,9 +934,13 @@ class TLContext:
nbytes = self._nbytes(shape, dtype)
addr = self._scratch_alloc(nbytes)
# pinned=True: recipe scratch / primary-out live in TCM already, so
# the head GEMM's auto-bound `a` (= primary-out P) is consumed in
# place — no DMA_READ (ADR-0065 P3, pinned-based DMA decision).
return TensorHandle(
id=self._next_handle_id(),
addr=addr, shape=shape, dtype=dtype, nbytes=nbytes, space="tcm",
addr=addr, shape=shape, dtype=dtype, nbytes=nbytes,
space="tcm", pinned=True,
)
@staticmethod