Files
kernbench2/docs/adr-ko/ADR-0007-api-runtime-api-boundaries.md
T
ywkang a796c1d2f7 ADR: bilingual structure — EN canonical in adr/, KO mirror in adr-ko/
Establish English as the canonical ADR language with Korean translations
held in a parallel docs/adr-ko/ tree as derived artifacts (1:1 mirror).
Promotion from adr-proposed/ to adr/ now writes English to adr/ and the
Korean to adr-ko/; bidirectional sync rule documented in CLAUDE.md.

- Migrate 30 ADRs in docs/adr/: 28 Korean-only translated to English,
  2 bilingual pairs (ADR-0020, ADR-0023) consolidated (.en.md suffix
  dropped). ADR-0023 EN regenerated against KO source which had newer
  HW Realization Notes (D16-D23) section.
- docs/adr-history/ left frozen by design (transitional state).
- CLAUDE.md (Part 2): update ADR Lifecycle for 4-folder layout, mark
  docs/adr-ko/ as a Derived Artifact, add ADR Translation Discipline
  section covering bidirectional sync, conflict resolution (EN wins),
  and proposed-language freedom.
- tools/verify_adr_lang_pairs.py: new verification tool checking pair
  completeness, filename mirroring, ADR-ID match, Status byte-equality.
  Pre-commit hook intentionally not added; run on demand or in CI.
- tests/test_verify_adr_lang_pairs.py: 11 cases including CRLF/LF
  normalization, em-dash title separator, underscore-slug edge case.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 01:38:44 -07:00

96 lines
2.7 KiB
Markdown

# ADR-0007: Runtime API and Simulation Engine Boundaries
## Status
Accepted
## Context
The simulator consists of multiple layers with distinct responsibilities:
- a host-facing API layer used by benchmarks and user code,
- a discrete-event simulation engine that executes requests,
- device components that model hardware behavior.
Without strict boundaries, orchestration logic can leak into components,
or simulation internals can become entangled with user-facing APIs.
This ADR defines clear responsibility boundaries between:
- runtime API,
- simulation engine (sim_engine),
- hardware components.
---
## Decision
### D1. Runtime API is host-facing orchestration only
The runtime API represents host/driver-level behavior and MUST:
- expose high-level operations (tensor deployment, kernel launch),
- submit requests only to endpoint components (e.g., IO_CPU),
- await completion via futures/handles,
- own and persist host-side metadata (tensor allocation maps, kernel bindings).
The runtime API MUST NOT:
- hardcode hop-by-hop routing or fan-out,
- directly invoke internal components (M_CPU, PE_CPU, engines),
- embed topology- or routing-specific assumptions.
---
### D2. Simulation engine wires components and tracks completion
The simulation engine (sim_engine) MUST:
- wire components at initialization (create port stores + start wire
processes per the component port/wire framework — ADR-0015),
- inject requests into the compiled topology graph at entry components
(e.g., PCIE_EP for memory operations, IO_CPU for kernel launch),
- schedule and execute events using a discrete-event model,
- manage correlation ids and completion tracking.
The simulation engine MUST NOT:
- define tensor semantics,
- define kernel execution policies,
- expose internal graph details to the runtime API,
- walk the topology path during request execution,
- call component `run()` methods directly,
- track per-hop latency or decompose fan-out (components own this).
---
### D3. Components own fan-out and aggregation
Device-side components MUST:
- fan-out requests to downstream domains
(IO_CPU → M_CPU → PE_CPU → schedulers/engines),
- aggregate completion and failure signals,
- propagate results deterministically upstream.
Neither the runtime API nor the simulation engine may orchestrate
component-level fan-out explicitly.
---
## Consequences
- Runtime APIs remain stable as topology and routing evolve.
- Simulation internals can change without affecting user-facing code.
- Component implementations remain swappable via DI.
---
## Links
- SPEC R4, R7, R8
- ADR-0008 (Tensor deployment)
- ADR-0009 (Kernel execution)
- ADR-0015 (Component port/wire model and engine role)
- ADR-0010 (CLI surface and execution semantics — runtime API consumer)