GEAK API reference#
2026-07-17
7 min read time
GEAK v4’s public surface is not a CLI or a Python package. It is: the Workflow scripts
(e2e_workflow.js, kernel_workflow.js), the helper scripts they call, and a stable
external-orchestrator contract (interface/run_e2e.py). For walkthroughs see
Run a workflow.
The Workflow tool#
Claude Code runs a workflow by calling:
Workflow({ scriptPath: "<absolute path to *.js>", args: { /* see below */ } })
workflow_dir is always required (a JS workflow can’t read its own path). Natural-language prompts
are mapped onto args; there is no config file for workflow parameters.
Workflow |
scriptPath |
Purpose |
|---|---|---|
e2e |
|
Whole-model sglang/vLLM serving-throughput optimization. |
single kernel |
|
Optimize/author one AMD GPU kernel. |
e2e_workflow.js#
meta.name = "e2e-workflow". Phases:
Setup → Profile → Strategize → ConfigSweep → HeadKernel → Milestone → Finalize → Report → Validate.
Owns the server, throughput metric, profiling, Amdahl triage, config/backend tuning, hot-kernel
extraction, and reversible reintegration; recursively calls kernel_workflow.js per kernel.
Core args#
Arg |
Default |
Description |
|---|---|---|
|
— (required for e2e) |
Model weights directory. |
|
— |
Single-kernel pass-through (mutually exclusive with |
|
— (required) |
This folder ( |
|
sibling |
Recursive kernel layer location. |
|
sibling |
Output root. |
|
|
Serving adapter: |
|
|
Optional custom launch script; else the stack default. |
|
|
CSV optimization-parallelism pool. |
|
|
Serving tensor-parallel size. |
|
first |
Serving GPU set (distinct from |
|
|
Workload; profiling and benchmarking share these. |
|
|
Natural-language steer. |
|
|
If |
|
|
Run a subset: |
Budget and triage args#
Arg |
Default |
Description |
|---|---|---|
|
|
Max kernel-optimization tasks (config sweep is free). |
|
|
Budget passed down to each recursive single-kernel run. |
|
|
Milestone floor. |
|
|
Skip editable kernels below this %GPU time (Amdahl). |
|
|
Tier-0 flag/env/backend sweep on/off (runs FIRST). |
|
|
Head-kernel selection threshold. |
|
|
Max head bake-offs. |
|
|
Author languages per head (FlyDSL + Triton). |
|
|
A dominant head is never silently dropped. |
|
|
Corrective re-author retries. |
Depth modes#
Both default false → default mode. Mutually exclusive; deep takes precedence. With both off,
the run is byte-identical to an unmodified run (every mode knob is gated).
Mode |
Arg |
Phases |
Default budget |
|---|---|---|---|
default |
(none) |
ConfigSweep + HeadKernel + Milestone |
— |
fast |
|
HeadKernel only (parallel, time-boxed) |
|
deep |
|
ConfigSweep + HeadKernel (global cross-kernel×backend lane pool) |
|
Related timing/tuning args: fast_head_deadline_ms, fast_head_workflow_ms, deep_wave_budget,
deep_max_reseeds, deep_converge_streak, deep_agent_budget, deep_e2e_target, deep_backends.
Accuracy gate#
Arg |
Default |
Description |
|---|---|---|
|
|
|
|
|
Number of gsm8k questions. |
|
|
Allowed exact-match drop ( |
Measurement and misc args#
Arg |
Default |
Description |
|---|---|---|
|
|
e2e acceptance band (%). |
|
|
Repeats per timed measurement. |
|
|
A/B leg completion retries. |
|
|
Consult |
|
sibling |
Authoring knowledge base. |
|
— |
Forwarded from the external orchestrator. |
Example#
Workflow({
scriptPath: "<REPO>/e2e_workflow/e2e_workflow.js",
args: {
model_path: "/models/Qwen3.5-27B-FP8",
workflow_dir: "<REPO>/e2e_workflow",
backend: "sglang", tp: 4, gpu_ids: "0,1,2,3",
isl: 1024, osl: 1024, conc: 64,
budget: 6, config_tune: "true"
}
})
kernel_workflow.js#
meta.name = "kernel-workflow". Phases:
Setup → Author → Analyze → Benchmark → Profile → Optimize → Verify → Merge → Report → Validate.
Director → TechLead → specialist engineers (algorithm, memory, compute, and host_runtime), multi-round, budget-controlled, each patch independently verified.
Arg |
Default |
Description |
|---|---|---|
|
— (required) |
Kernel task directory (or a kernel source to wrap). |
|
— (required) |
This folder ( |
|
|
Optimization-task budget. |
|
|
Minimum accepted improvement (2%). |
|
|
Budget cost of a deep-explore engineer. |
|
|
CSV GPU pool. |
|
|
Natural-language steer. |
|
sibling |
Output root. |
|
— |
Isolated evaluation directory. |
|
|
Emit apply bundle vs edit-in-place. |
|
|
|
|
|
Author-mode language: |
|
|
Op specification (author mode). |
|
sibling |
Knowledge base. |
|
— |
Workload-alignment spec; makes the primary metric the time-weighted ratio-of-sums. |
|
|
Per-agent timeout (1h). |
|
|
Agent retry count (min 1). |
Speedup metric = geomean(baseline_ms / optimized_ms); with a workload spec it becomes the
time-weighted ratio-of-sums. Author mode writes a fresh baseline against an immutable oracle, then runs
the same optimize loop.
Workflow({
scriptPath: "<REPO>/kernel_workflow/kernel_workflow.js",
args: {
kernel_path: "<REPO>/examples/tasks/knn",
workflow_dir: "<REPO>/kernel_workflow",
budget: 8, gpu_ids: "0"
}
})
Helper scripts#
e2e_workflow/scripts/bench_e2e.sh#
Backend-agnostic e2e serving-benchmark dispatcher: server lifecycle, health-wait, and cleanup
(or REUSE_SERVER=1), warmup + N timed repeats + optional profiling trace, median throughput + spread.
Env-driven; MODEL is required (no rig default).
Key env vars: MODEL, TP, GPU, ISL/OSL/CONC, REPEATS (default 3), MEM_FRACTION,
EXTRA_SERVER_ARGS, EXTRA_ENV, OVERLAY_PYTHONPATH, PROFILE, BENCH_CLIENT, PORT_BASE/PORT_SPAN,
NUM_PROMPTS, NUM_WARMUPS, SEED, PROFILE_NUM_STEPS, REUSE_SERVER.
e2e_workflow/scripts/op_bench.py#
Single-op multi-backend bake-off and autotune for head kernels (GEMM and attention). Isolated; never touches
a server. Reads meta.json (+ optional reference_io.pt).
python op_bench.py --task <op_task_dir> \
[--backends hipblaslt,tunableop,rocblas,aiter,triton] \
[--repeats 50] [--warmup 10] [--tol 2e-2] [--triton-autotune] [--seed 0] [--out result.json]
e2e_workflow/scripts/parse_profile.py#
Standardized profile → per-kernel Top-N (JSON + MD). Merges a torch trace (op names + shapes) with the rocprofv3 CSV (HW durations); also emits the workload-v1 spec.
python parse_profile.py --torch-trace <file.json[.gz]> --rocprof-dir <dir> \
--top 25 --out <prefix> --workload-out <file> --target <name>
e2e_workflow/scripts/parse_regime.py#
Parse the online serving regime from launch flags + model config; emits a
quant / kv_cache_dtype / compile / cuda_graph / attention_backend descriptor into meta.json.
python parse_regime.py --server-args <...> --model-config <...> --out <file>
e2e_workflow/scripts/attribute_weights.py#
op_kind-aware weight attribution joining extractor meta.json shapes with profiled time; emits
workload-v1 JSON with weight_source ∈ {trace, regime, prior}.
python attribute_weights.py --meta <...> --profile-weights <...> \
--name-match <...> --min-regime-share 0.0 --out <file>
e2e_workflow/scripts/gsm8k_eval.py#
Lightweight gsm8k accuracy eval against an OpenAI-compatible /v1 endpoint (5-shot greedy exact-match).
Prints GSM8K_EXACT_MATCH=<0..1>.
python gsm8k_eval.py --base-url <url> --model <name> \
[--limit 200] [--fewshot 5] [--max-tokens 1024] [--concurrency 32] [--seed 0] [--out <file>]
e2e_workflow/scripts/overlay_setup.py and capture_shapes.py#
Reversible-overlay tooling (never edits site-packages). overlay_setup.py builds a compounding
sitecustomize/monkeypatch overlay — subcommands add-module and add-rebind. capture_shapes.py
hooks a live server callable through the overlay to capture real serving shapes + a reference I/O oracle
(reference_io.pt + meta.json); imported through the overlay, not a standalone CLI.
kernel_workflow/scripts/gpu_lock.sh#
GPU lock + per-workspace build isolation. flock per GPU id (safe GPU sharing), per-workspace
TORCH_EXTENSIONS_DIR, pins PYTORCH_ROCM_ARCH to the local gfx, reaps orphaned enumerator processes.
bash gpu_lock.sh <gpu_id> <command...>
kernel_workflow/scripts/profile_kernel.sh#
Thin profiling wrapper: warmup + gpu_lock + auto-detect best profiler + run + dump RAW output.
Output entry point: <output_dir>/profile_report.txt.
bash profile_kernel.sh <gpu_id> <benchmark_cmd> <output_dir>
Env: PROFILER_PRIORITY (default rocprof-compute omniperf rocprofv3 rocprof metrix), WARMUP_RUNS (3),
RPC_PROFILE_ARGS, RPV3_TRACE_ARGS, RPROF_ARGS, METRIX_ARGS.
External-orchestrator contract (interface/run_e2e.py)#
The only surface an external orchestrator (for example, Hyperloom) touches — wraps e2e_workflow.js arg names
behind one command and two JSON files (schema_version 1).
python interface/run_e2e.py <handoff.json> <result.json> [--dry-run]
Stable handoff.json fields: model_path, framework (→ backend), tp, gpu_ids,
workload{isl, osl, conc}, accepted_flags / env, exp_root, bench_client, bench_protocol,
inferencex_path, raw_baseline_tput.
Env knobs: GEAK_CLAUDE_MODEL (claude-opus-4-8), GEAK_CLAUDE_EFFORT (ultracode),
GEAK_E2E_TIMEOUT_S (43200 = 12h), GEAK_ROOT, GEAK_EVAL_DIR, INFERENCEX_PATH.
See External orchestrator contract for the full contract.
Output artifacts#
e2e — <exp_root>/e2e_<model>_<timestamp>/#
env_report.{md,json} # preflight capability report (every phase routes on it)
baseline/bench_summary.json # TRUE baseline throughput
config/baseline_flags.json # baseline launch flags
config/sweep_results.json # Tier-0 sweep results
profile/round_*/profile_topN.{json,md} # standardized Top-N per round
strategy.md, insight_log.md
kernels/<name>_task/{kernel_src, reference_io.pt, unittest.py, meta.json} # extracted tasks
kernels/_exp/… # recursive single-kernel runs (each verified)
overlay/… # candidate + accepted reversible overlays
final/{overlay, final_patch.diff, final_launch.sh} # deliverable bundle
final_report.md # complete run report (Phases tree + artifacts tree)
architect_report.md # official verified throughput result
director_e2e_validation.json # independent re-measurement
single kernel — <exp_root>/team_<kernel>_<timestamp>/<kernel>/#
COMMANDMENT.md # measurement contract
baseline_timing.json, baseline_metrics.json
analysis.json, codebase_context.md, roadmap.md, profiling_summary.md
round_N/engineer_i/{worker_result.json, report.md, best_patch.diff}
round_N/integrate/
insight_log.md, current_best.diff
tech_lead_report.md # run report
final_patch.diff # winning patch
optimized/ # applied optimized source
director_validation.json # independent re-measurement