Files
kernbench2/docs/adr/ADR-0010-api-cli-surface-and-semantics.md
T
ywkang 687c98086d ADR housekeeping: category prefixes, lifecycle folders, retroactive 0034-0037
Filename + lifecycle:
- ADR rename to ADR-NNNN-<cat>-title.md with 8 3-letter category prefixes
  (dev / mem / lat / prog / algo / par / api / ver). Numbers stay immutable.
- ADR Lifecycle split into 3 folders, documented in CLAUDE.md Part 2:
  docs/adr/ (Accepted), docs/adr-proposed/ (Proposed/Stub/Draft),
  docs/adr-history/ (Superseded/Merged). Status field gains "Draft" for
  retroactive docs pending verification.

Merges (one ADR per topic, no change-history annotations):
- ADR-0017 absorbs ADR-0019 (Cube NOC + per-PE HBM connectivity, 10 D-items)
- ADR-0014 absorbs ADR-0021 (PE pipeline execution model, 8 D-items incl.
  TileToken self-routing and multi-op composite epilogue scope)
- ADR-0023 absorbs docs/ipcq-dma-codesign-hw.md as new "HW Realization
  Notes (Informative)" section (D16-D23 + Open HW Questions). codesign-hw.md
  deleted; ADR-0019/0021 moved to adr-history with one-line stub status

Retroactive documentation (G4 closures, code-verified):
- ADR-0037 forwarding component (TransitComponent: first-flit overhead,
  serial worker, path-based routing, single impl/multiple names)
- ADR-0036 IO_CPU component (target_start_ns global barrier stamping,
  per-cube fan-out, response aggregation)
- ADR-0035 M_CPU & M_CPU.DMA component (3 fan-out paths, DMA Resources,
  target_start_ns passthrough)
- ADR-0034 HBM controller internal design (per-PC state, address-based
  selection, flit-aware per-flit commit, async finalize, command-only
  fallback path)

Content updates:
- ADR-0010 expanded to full CLI surface (run/probe/web), retitled
  "Command Line Interface and Execution Semantics"
- ADR-0007 D2 rewritten to current state; ADR-0015 supersession notes pruned
- ADR-0005 wrapped in Decision header with D1-D5; ADR-0022 metadata
  block replaced with standard Status header
- ADR-0024 trimmed to rank=SIP launcher essentials (D1-D4);
  ADR-0027 cleaned of supersession history
- ADR-0033 D6 cleanup: address-based PC selection moved out of future-work
  (now documented in ADR-0034 D3); related D1/D3 wording realigned
- Cross-references back-filled in 5 ADRs (G3 gaps closed)

Onboarding docs split:
- docs/onboarding/ created
- moved: hw-architecture-overview.md, latency-model.md, di-presentation.md,
  ccl-author-guide{,.en}.md
- references updated in README, ADR-0023{,.en}, src/kernbench/ccl/__init__.py

Source / test / yaml: ADR-NNNN cross-references in docstrings and YAML
comments updated after the merges (ADR-0021->0014 D6, ADR-0019->0017 D8).
No behavior change.

Tooling:
- tools/verify_adr_lang_pairs.py + tests/test_verify_adr_lang_pairs.py
  (ADR EN/KO pair invariant checker)
- .claude/commands/report.md tracked (/report slash command)
- .gitignore: allow .claude/commands/*.md while keeping settings files ignored

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

4.3 KiB

ADR-0010: Command Line Interface and Execution Semantics

Status

Accepted

Context

The kernbench CLI is the user-facing entry point of the simulator. It exposes three subcommands:

  • run — execute a benchmark against a topology.
  • probe — diagnostic utility for latency / BW measurement.
  • web — interactive topology viewer.

Device enumeration is centralized in the CLI; neither the runtime API nor the simulation engine enumerates devices. Benchmarks remain single-device by design and accept a device identifier as input.

Decision

D1. Benchmark contract — single-device by design

  • A benchmark MUST define behavior for a single device only.
  • A benchmark MUST accept a device identifier as input.
  • Benchmarks MUST NOT enumerate or loop over multiple devices.

Multi-device execution is the CLI's concern (D3), not the benchmark's.

D2. kernbench run — benchmark execution

Required arguments:

  • --topology <path>: topology YAML file path. Loaded via resolve_topology().
  • --bench <name>: benchmark name. Resolved via benches.loader.resolve_bench().

Optional arguments:

  • --device <selector> (default: all):
    • all — run once per discovered SIP (see D3).
    • sip:<N> — run only on SIP N.
    • Parsed via resolve_device().
  • --verify-data (default: off) — enable Phase 2 data verification (see ADR-0020). When set, engine_factory constructs the engine with enable_data=True. After the benchmark runs, a diagnostic summary of recorded ops is printed.

Each invocation runs the benchmark once within a single simulation instance.

D3. Multi-device execution is logically parallel

When --device all (or omitted) and the topology has multiple SIPs:

  • Benchmark executions are submitted to a single simulation engine instance.
  • Executions are logically parallel in simulation time.
  • Inter-device contention is naturally modeled (shared fabric bandwidth, cross-SIP traffic, etc.).

The CLI does NOT spawn multiple OS processes or independent simulation runs — parallelism is internal to one simulation instance.

D4. kernbench probe — latency / BW diagnostic utility

Required argument:

  • --topology <path>: topology YAML file path.

Optional argument:

  • --case <name> (default: all) — run a predefined traffic pattern, or all to run every defined case.

Probe runs each pattern through the simulation engine and reports per case:

  • End-to-end latency (ns).
  • Effective bandwidth (nbytes / total_ns).
  • Bottleneck bandwidth (min edge BW along the chosen path).
  • Utilization (effective / bottleneck).

Probe additionally validates monotonicity invariants — for example that local-HBM access ≤ cross-PE-within-cube ≤ cross-cube ≤ cross-SIP — and reports violations. Probe is a developer tool for verifying the latency / BW model; it is not a benchmark.

D5. kernbench web — topology viewer

Optional arguments:

  • --port <N> (default: 8765) — HTTP port.
  • --no-open — do not auto-open the browser.

Launches a local HTTP server that renders the compiled topology in the browser. Distinct from the static docs/diagrams/ artifacts:

  • docs/diagrams/ files are derived at topology-compile time (ADR-0006).
  • kernbench web is interactive — pan/zoom, hover for component attributes, switch between SIP / CUBE / PE views.

D6. Runtime API and simulation engine remain device-scoped

  • Runtime API calls operate on one device per invocation.
  • The simulation engine schedules all requests deterministically.
  • Neither layer enumerates devices.

This invariant keeps each layer testable in isolation; device enumeration and multi-device fan-out live only in the CLI's run command (D3).

Consequences

  • Benchmark authors write single-device logic; multi-device behavior emerges from the CLI dispatching across SIPs.
  • Adding a new subcommand (e.g., trace export, replay) does not require benchmark or runtime-API changes — the CLI is the extension point.
  • probe and web are diagnostic / visualization tools, not benchmarks; they bypass the benchmark loader path.
  • SPEC R7, R8, R9
  • ADR-0007 (Runtime API and Simulation Engine Boundaries)
  • ADR-0020 (Two-pass data execution — --verify-data)
  • ADR-0006 (Topology compilation and diagram generation — background for kernbench web)