/hpc-assistant-skills:geak-optimizationfrom hpc-assistant-skills
Installs and runs GEAK, an autonomous GPU kernel optimizer for AMD Instinct MI GPUs. Covers single-kernel (kernel_workflow) and whole-model serving (e2e_workflow) optimization loops.
Ships in hpc-assistant-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
GEAK is an autonomous GPU kernel optimizer for AMD Instinct MI GPUs (CDNA — gfx942 / gfx950). It is a multi-agent system driven by Claude Code that runs the full optimization loop: profile → analyze → generate improved kernels (Triton, HIP, FlyDSL, CK) → verify speedup → repeat.
It ships two workflows:
| Workflow | Scope | Use when |
|---|---|---|
kernel_workflow | Single kernel | Optimizing one Triton / HIP / CK / FlyDSL kernel |
e2e_workflow | Whole-model serving | Raising sglang / vLLM throughput end-to-end |
rocprofv3 / rocprof-compute / rocprofe2e_workflow: a running sglang or vLLM backend and model weights on diskGEAK does not install your kernel's toolchain (PyTorch, Triton, HIP compiler, hipBLASLt). Set up and verify baseline builds before starting a workflow.
pip install "git+https://github.com/AMD-AGI/GEAK"
This installs the geak Python package, clones the repo to ./GEAK/, and installs the Claude Code CLI.
git clone https://github.com/AMD-AGI/GEAK.git
cd GEAK
pip install .
After installation claude should be on your PATH (check which claude). If not, add ~/.local/bin
to your PATH.
On systems with Lustre or similar parallel filesystems, a plain pip install creates thousands of
small files and may exhaust your inode quota. Use the site's recommended container-wrapper or
virtual-environment method that bakes packages into a SquashFS image. See the site-specific
reference for your cluster.
Set one of the following before launching GEAK:
# Option 1: Anthropic API directly
export ANTHROPIC_API_KEY=sk-ant-...
# Option 2: Standard gateway (x-api-key / bearer)
export ANTHROPIC_BASE_URL=https://your-gateway
export ANTHROPIC_AUTH_TOKEN=your-token
# Option 3: Custom header gateway
export ANTHROPIC_BASE_URL=https://your-gateway
export ANTHROPIC_CUSTOM_HEADERS="Your-Header-Name: <your-key>"
For kernel_workflow, point GEAK at a directory containing your kernel source. The minimum
requirement is the kernel source file(s) themselves. GEAK's benchmark_engineer agent will:
test_*.py, config.yaml, scripts/task_runner.py)test_harness.py itself — correctness check + timing harnessYou do not need to provide a test file or config. Optionally, a config.yaml with explicit
compile_command, correctness_command, and performance_command entries saves GEAK some setup
budget. Do not provide one if you want GEAK to discover everything autonomously.
Minimum task directory:
matmul_task/
└── matmul.py ← your Triton kernel source, nothing else needed
Kernels with obvious sub-optimalities give GEAK's specialist engineers more to work with:
tl.autotune)eviction_policy hints on loadsGEAK runs interactively inside a Claude Code session. It spawns many sub-agents and runs profiling and build commands on the box, so launch with permissions auto-approved:
IS_SANDBOX=1 claude --dangerously-skip-permissions
Then describe what you want in natural language:
use /abs/path/to/GEAK/kernel_workflow to optimize /abs/path/to/matmul_task
use /abs/path/to/GEAK/kernel_workflow to optimize /abs/path/to/my_kernel, budget 8, focus on memory layout
use /abs/path/to/GEAK/e2e_workflow to optimize inference for /models/Qwen3-27B, sglang, ISL/OSL=1024, conc=64, gpus 0,1,2,3
Or launch non-interactively with -p:
IS_SANDBOX=1 claude --dangerously-skip-permissions -p \
'use /abs/path/to/GEAK/kernel_workflow to optimize /abs/path/to/matmul_task'
kernel_workflow arguments| Argument | Default | Notes |
|---|---|---|
kernel_path | (required) | Absolute path to the kernel task directory |
workflow_dir | (required) | Same as scriptPath directory |
budget | 6 | Total optimization directions across all rounds |
gpu_ids | "0" | Comma-separated GPU IDs to use |
task | — | Optional natural-language steering hint |
mode | "optimize" | optimize | author | bakeoff |
min_improve | 0.02 | Min verified geomean gain to commit a round winner |
On HPC clusters GEAK should run in a batch job on a compute node with GPU access. The job needs:
claude binary) accessible from the compute nodeGeneral job script template:
#!/bin/bash
# scheduler directives here — see your cluster's documentation
# e.g. for Slurm:
#SBATCH --partition=<gpu-partition>
#SBATCH --account=<your-account>
#SBATCH --nodes=1
#SBATCH --gpus=1
#SBATCH --time=02:00:00
export ANTHROPIC_API_KEY=<your-key>
GEAK_WF=/path/to/GEAK/kernel_workflow
KERNEL_PATH=/path/to/matmul_task
RUN_DIR=/scratch/your-project/geak-runs/$SLURM_JOB_ID # or equivalent
mkdir -p "$RUN_DIR"
cd "$RUN_DIR"
IS_SANDBOX=1 claude --dangerously-skip-permissions -p \
"use ${GEAK_WF} to optimize ${KERNEL_PATH}"
For container-based clusters, wrap the claude call in singularity run / apptainer run and
bind-mount the shared filesystem paths. See the site-specific reference for your cluster.
Setup → Analyze + Roadmap → Benchmark (baseline) → Profile →
LOOP[ Plan round → (Optimize ‖ Verify, pipelined) → Integrate → Commit winner → Re-profile → Update memory ] →
Final Report → Director Validation
algorithm, memory, compute,
host_runtime, and optionally deep_explore.verify_engineer before being committed.geomean(baseline_ms / optimized_ms) vs the true original baseline.kernel_workflow output lands under <exp_root>/team_<kernel>_<timestamp>/<kernel>/:
| Artifact | Contents |
|---|---|
COMMANDMENT.md | Immutable benchmark contract (correctness + timing commands) |
baseline_timing.json | Per-case baseline latencies |
profiling_summary.md | Profiler output and bottleneck analysis |
round_N/engineer_i/ | Each engineer's patch, report, and timing |
tech_lead_report.md | Round-by-round narrative + final per-case speedup table |
final_patch.diff | The verified winning patch |
optimized/ | Full optimized source tree |
director_validation.json | Independent validation verdict |
mode=optimize (default)Optimize an existing kernel source in-place. The original is never modified unless
apply_to_original="true" is passed.
mode=authorNo existing source — GEAK writes a fresh implementation in target_language
(triton | flydsl | hip | ck), then optimizes it. Requires an op task dir with
meta.json + unittest.py.
mode=bakeoffRaces multiple backend languages against the same frozen baseline. Pass backends (e.g.
["hip","triton","flydsl"]). The incumbent language always competes as an optimize lane.
Useful for finding the fastest language for a given op shape.
scripts/frontier/ install GEAK once (setup-geak.sh) and handle the job life
cycle with JSON output (geak_job.py submit | status | watch | cancel | list). Read the
limits section first: MI250X (gfx90a) is not a validated GEAK target.What SKILL.md sets; muted values are Claude Code's defaults
8 skills in this plugin
/energy-profilingUse when profiling GPU job energy or power consumption on AMD systems with Omnistat. Handles Omnistat/VictoriaMetrics setup, Slurm job instrumentation, report-card interpretation, and troubleshooting. Covers LUMI and Frontier. Do NOT use for rocprofv3 kernel/API performance profiling./frontier-frequency-power-cappingUse when running GPU frequency-cap or power-cap experiments on Frontier (AMD MI250X). Covers the power cap in the job header (#SBATCH --gpu-power-cap, one job per cap), the max frequency changed at runtime with /usr/bin/set_gpu_max_sclk, the sclk min/max range (#SBATCH --gpu-srange), checking which caps were applied, sysfs/pm_counters telemetry, sweep planning and submission, and runtime/energy/EDP analysis. Do NOT use for rocprofv3 kernel profiling (profiling) or general Omnistat setup (energy-profiling)./frontier-resource-managementnpx claudepluginhub silogen/hpc-assistant --plugin hpc-assistant-skillsOther plugins' skills for the same job