gqa(adr): ADR-0064/0065 second-pass review — 1024B rationale, FIFO as ordering source, robust formula-based tests, D5/D6 auto-bind alignment
ADR-0064 Revision 2 second-pass review fixes: - D7 added 1024-byte cap rationale: explicitly framed as a *safe engineering limit* (intentionally above all known composites at ~322 bytes, finite descriptor capacity placeholder), not a measured HW number. Default is the discipline; topology override for real HW. - D7 segment ordering: strict FIFO is the *ordering source*; rw_handles is dependency metadata, not the ordering primitive. Explicit note for the future RW-aware reorder migration path. - Tests rewritten around the formula (D1) instead of specific numbers: - Test #1 → "formula preservation" (parametrized across composites, asserts dispatch == FIXED + bytes × R, not anchor 43 ns). - Test #2 → robust "opt3 > 2 × opt2" qualitative gate; ≈ 4.0× is informative only, not the gate, so calibration changes don't break. - Test #9 → qualitative (opt2 < opt3 at all R), not a numeric ratio. - Anchor description in D3 stays as *informative* (shows the model produces ≈ 43 ns at defaults), but is no longer a test gate. ADR-0065 second-pass review: - D5 step 5 aligned with D6.6 invariant: explicit conflict check before auto-binding (previously written as if auto-bind always happens). Mirrors D6.6 wording: error if both kernel explicit `a` and prologue primary_out are present. - Test #7 made robust: `opt3 > 2 × opt2` gate (was ≈ 4.0×). Default-calibration model expectation (≈ 4.0×) recorded as informative reference, not the gate. DDD-0065 follow-on robust thresholds: - §1.4 success criteria: ratio condition rewritten as `opt3 > 2 × opt2` with model-expected ≈ 4.0× as informative. - §9 P6 phase gate: `opt3 > 2 × opt2` (was 4.0× ± 15%). - §10 dispatch ratio test: assert `opt3 > 2 × opt2`; record observed ratio for performance tracking but do not gate on it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -234,14 +234,31 @@ issue cost 를 0 → non-zero 로 바꾸면 **모든** bench 의 latency 변화.
|
||||
- segmentation 알고리즘 결정적 (emit 순서로 op 인덱스 greedy); host
|
||||
emitter 의 일부, PE_SCHEDULER 가 아님.
|
||||
|
||||
이게 필요한 이유. 실제 하드웨어는 descriptor queue entry 크기, scheduler
|
||||
parser buffer, command SRAM, firmware 입력의 하드 제한 보유. cap 없으면
|
||||
`FIXED + bytes × R` 모델이 하드웨어가 받지 못할 정도로 큰 fused composite
|
||||
를 보상 (예: primitive 100 개를 composite 1 개로 fuse, FIXED 1 회만 지불).
|
||||
~30 bytes 짜리 op 100 개의 composite = ~3000 bytes > 1024 cap → 3 개로
|
||||
segment → 3 × FIXED, 정직한 회계 회복.
|
||||
**cap 이 필요한 이유.** 실제 하드웨어는 descriptor queue entry 크기,
|
||||
scheduler parser buffer, command SRAM, firmware 입력의 하드 제한 보유.
|
||||
cap 없으면 `FIXED + bytes × R` 모델이 하드웨어가 받지 못할 정도로 큰
|
||||
fused composite 를 보상 (예: primitive 100 개를 composite 1 개로 fuse,
|
||||
FIXED 1 회만 지불).
|
||||
|
||||
Decode opt2 의 `#2` composite (10 ops, ~310 bytes) 는 1024 cap 안에
|
||||
**1024 bytes 라는 *특정* 숫자의 근거.** 이는 측정된 HW 숫자가 아니라
|
||||
**safe engineering limit** — kernbench 코드베이스의 현재 모든 알려진
|
||||
composite (가장 큰 것이 decode opt2 의 `#2` ~322 bytes) 보다 훨씬 위이면서
|
||||
미래 recipe 도 지켜야 할 *유한* descriptor capacity 를 의도적으로 표현.
|
||||
값은 topology 별 override (D4); 실제 HW reference 등장 시 재캘리브레이션.
|
||||
이 default 의 역할은 cap 을 *원칙으로 존재시키는 것*, 특정 HW 에 맞추는
|
||||
것이 아님.
|
||||
|
||||
**segment 간 순서 — strict FIFO 가 주체, `rw_handles` 아님.** segment 들은
|
||||
emit 순서로 PE_CPU → PE_SCHEDULER 큐에 들어감. strict-FIFO dispatch
|
||||
(ADR-0065 D6.3) 가 *순서의 주체* — segment 가 큐 진입 순서로 실행. 각
|
||||
segment 의 `rw_handles` block 은 cross-composite 해저드 추적기의 **의존성
|
||||
메타데이터** — 그 자체로 inter-segment 순서를 보장하지 **않음**. 미래
|
||||
scheduler 가 FIFO 를 완화 (예: RW-aware reorder, ADR-0065 A4) 한다면
|
||||
segmenter 는 (a) segment 를 단일 CompositeCmd 로 merge 또는
|
||||
(b) 명시적 completion-handle 의존 체인 도입 필요. Phase 1 에선 무관 —
|
||||
strict FIFO 가 유효.
|
||||
|
||||
Decode opt2 의 `#2` composite (10 ops, ~322 bytes) 는 1024 cap 안에
|
||||
편안히 — GQA workload 에 segmentation 없음.
|
||||
|
||||
## Alternatives
|
||||
@@ -307,12 +324,24 @@ fold. calibration 이 분리 필요성을 보이면 PE_DMA fixed setup 으로
|
||||
|
||||
## Test Requirements
|
||||
|
||||
1. **Anchor 보존.** DMA-staged GEMM 경로용 단일-OpSpec composite
|
||||
(`logical_bytes ≈ 54`) 가 default 값에서 ≈43 ns 에 dispatch (±2 ns).
|
||||
2. **구조적 ratio.** opt3 vs opt2 dispatch (ADR-0065 §verification 의):
|
||||
default calibration 에서 `opt3 / opt2 ≈ 4.0×`.
|
||||
테스트는 specific 숫자 anchor 가 아닌 **공식 (D1)** 에 대해 작성 —
|
||||
calibration 이 바뀌거나 OpSpec/CompositeCmd 필드가 추가되어도 유효.
|
||||
|
||||
1. **공식 보존.** 임의 `CompositeCmd` `c` 에 대해 PE_CPU 의 기록된
|
||||
dispatch overhead 가 `FIXED_PER_CMD + c.logical_bytes × R`
|
||||
(floor/round-off 의 ±1 cycle 내). 여러 composite parametrize:
|
||||
1-OpSpec GEMM composite, 5-op MATH chain, 10-op recipe composite.
|
||||
Default-calibration 숫자 (1-OpSpec composite 의 anchor ≈43 ns) 는
|
||||
*informative* 참고, 테스트 gate 가 아님 — gate 는 공식 등가.
|
||||
2. **정성적 ratio (robust).** opt3 per-tile PE_CPU dispatch 가 opt2
|
||||
per-tile dispatch 를 최소 2× 차이로 엄격히 초과 — `opt3 > 2 × opt2`.
|
||||
Default-calibration 모델은 ≈4× 예측; gate 는 느슨한 2× 한계라
|
||||
calibration 이동 (예: HW reference 가 default 대체) 시 깨지지 않음.
|
||||
Informative 숫자 — ADR-0065 §verification 와 DDD-0065 §11 의 모델
|
||||
기대치 참조.
|
||||
3. **Override 경로.** topology yaml 의 `pe_cost_model:` block 이 per-PE
|
||||
dispatch cost 변경; block 누락 시 default 복귀.
|
||||
dispatch cost 변경; block 누락 시 default 복귀. #1 의 공식 등가가
|
||||
override 값에서도 성립.
|
||||
4. **`PeCpuOverheadCmd` 우회.** 수동 `tl.cycles(n)` 는 정확히 `n` cycles,
|
||||
`n + dispatch_cycles(...)` 아님.
|
||||
5. **double-count 없음.** PE_DMA `drain_ns`, PE_GEMM/MATH `_compute_ns` 가
|
||||
@@ -322,12 +351,12 @@ fold. calibration 이 분리 필요성을 보이면 PE_DMA fixed setup 으로
|
||||
dispatch-cycle 회계.
|
||||
8. **Composite 크기 cap (D7).** `logical_bytes >
|
||||
MAX_COMPOSITE_LOGICAL_BYTES` 가 될 recipe 가 N 개 연속 `CompositeCmd`
|
||||
로 segment; 총 dispatch = segment dispatch 의 합; segment 간 RW 순서
|
||||
strict FIFO 로 보존.
|
||||
9. **민감도 sweep.** `R ∈ {0.25, 0.0625, 0.03125}` cycles/byte
|
||||
(= 4 / 16 / 32 bytes/cycle) 에서 *opt2 per-tile dispatch
|
||||
< opt3 per-tile dispatch* 결론 유지 (ratio 가 R 감소 시 단조 증가
|
||||
— FIXED 가 더 지배).
|
||||
로 segment; `sum(segment.logical_bytes) == original logical_bytes`;
|
||||
총 dispatch = segment dispatch 의 합 (FIXED 가 segment 당 지불);
|
||||
inter-segment 순서 strict FIFO 로 보존 (`rw_handles` 단독 아님).
|
||||
9. **민감도 (정성적).** `R ∈ {0.25, 0.0625, 0.03125}` cycles/byte 에서
|
||||
3 지점 모두 `opt3 > opt2`. 방향 (R 감소 시 ratio 단조 증가) 도 단언,
|
||||
단 절대 ratio 값은 *불필요*.
|
||||
|
||||
## Migration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user