gqa(adr-0064/0065): flat-ops CompositeCmd (P1) + structural dispatch cost (ADR-0064 Rev2); promote ADR-0064
ADR-0065 P1: CompositeCmd -> flat ordered ops list (drop legacy op/a/b/out_addr fields); OpSpec.operands dict + out handle. Meaning-preserving (op_log byte-equal); pe_scheduler + op_log read the head op. ADR-0064 Rev2: replace Rev1 per-op cost table with structural FIXED + logical_bytes*R formula. logical_bytes on every PeCommand; new common/pe_cost_model.py; cost centralized in TLContext._emit (load/recv_async charge explicitly); pe_cpu/kernel_runner wire the per-PE model + clock. D7: cap exceeded -> ValueError (no auto-segmentation). Remove Rev1 cpu_issue_cost.py + its tests. No goldens churn. Promote ADR-0064 Rev2 Proposed->Accepted (docs/adr/ + docs/adr-ko/); amend D7 (error not segmentation) + record P1-before-P0 ordering in ADR-0064/0065 Migration notes (EN+KO). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,14 @@ class PeCpuComponent(ComponentBase):
|
||||
| (self._cube_idx << 32)
|
||||
| (self._pe_idx << 24)
|
||||
)
|
||||
# ADR-0064 Rev2: structural dispatch cost model. Reads an optional
|
||||
# `pe_cost_model:` block from this PE_CPU node's attrs (D4); missing
|
||||
# keys fall back to defaults. Clock for cycle→ns is this node's
|
||||
# `clock_freq_ghz` (D3), same attr PE_GEMM/PE_MATH use.
|
||||
from kernbench.common.pe_cost_model import from_node_attrs
|
||||
|
||||
self._cost_model = from_node_attrs(node.attrs)
|
||||
self._clock_freq_ghz = float(node.attrs.get("clock_freq_ghz", 1.0))
|
||||
|
||||
def _find_shard(self, shards: tuple) -> Any:
|
||||
"""Find shard matching this PE's (sip, cube, pe). Fallback to positional index."""
|
||||
@@ -176,6 +184,8 @@ class PeCpuComponent(ComponentBase):
|
||||
store=store,
|
||||
scratch_base=self._tl_scratch_base,
|
||||
scratch_size=self._tl_scratch_size,
|
||||
cost_model=self._cost_model,
|
||||
clock_freq_ghz=self._clock_freq_ghz,
|
||||
)
|
||||
yield from runner.run(env, kernel_fn, kernel_args, num_programs)
|
||||
return getattr(runner, "_composite_results", [])
|
||||
@@ -184,7 +194,6 @@ class PeCpuComponent(ComponentBase):
|
||||
self, env, kernel_fn, kernel_args, num_programs, scheduler_id,
|
||||
) -> Generator:
|
||||
"""Legacy Phase 0 + replay: generate command list, then dispatch."""
|
||||
from kernbench.common.cpu_issue_cost import DEFAULT_CPU_ISSUE_COST
|
||||
from kernbench.common.pe_commands import (
|
||||
CompositeCmd, PeCpuOverheadCmd, PeInternalTxn, WaitCmd,
|
||||
)
|
||||
@@ -194,7 +203,8 @@ class PeCpuComponent(ComponentBase):
|
||||
pe_id=self._pe_idx, num_programs=num_programs,
|
||||
cube_id=self._cube_idx, num_cubes=self._num_cubes,
|
||||
dispatch_cycles=0,
|
||||
issue_cost_table=DEFAULT_CPU_ISSUE_COST,
|
||||
cost_model=self._cost_model,
|
||||
clock_freq_ghz=self._clock_freq_ghz,
|
||||
)
|
||||
run_kernel(kernel_fn, tl, *kernel_args)
|
||||
commands = tl.commands
|
||||
|
||||
Reference in New Issue
Block a user