# minho-fan/kernel-opt-agent architecture

> Architecture diagram of the GitHub repository minho-fan/kernel-opt-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/minho-fan/kernel-opt-agent
- Repository: https://github.com/minho-fan/kernel-opt-agent

## Overview

Kernel Opt Agent packages four GPU-kernel skills. The main user workflow is to retrieve implementation evidence with kernel-KBS, iterate on a kernel with kernel-loop’s profiling-guided hypotheses, and measure the result with kernel-benchmark; kernel-profile also supports standalone checks and profiling. The corpus includes archived kernel implementations and PR artifacts. Links among the skills and their capabilities are based on README statements; the tree and excerpts do not show the unsampled benchmark or loop implementations in detail.

Main entry points: [`skills/kernel-KBS/store/corpus/artifacts`](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts) (Evidence corpus), [`skills/kernel-loop`](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-loop) (Optimization loop), [`skills/kernel-profile/scripts/ncu_profile.py`](https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-profile/scripts/ncu_profile.py) (Kernel profiling), [`skills/kernel-KBS/scripts/kbs.py`](https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-KBS/scripts/kbs.py) (Knowledge search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Optimization workflow"]
  node_loop["Optimization loop"]
end

subgraph group_evidence["Kernel knowledge"]
  node_kbs["Knowledge search<br/>[kbs.py]"]
end

subgraph group_measurement["Correctness and performance"]
  node_benchmark["Kernel benchmark"]
  node_profile["Kernel profiling<br/>[ncu_profile.py]"]
  node_correctness["Correctness check"]
end

subgraph group_archive["Reference corpus"]
  node_corpus[("Evidence corpus")]
  node_cutlass["CUTLASS PR artifacts"]
  node_deepgemm["DeepGEMM PR artifacts"]
  node_flashinfer["FlashInfer PR artifacts"]
  node_pytorch["PyTorch PR artifacts"]
  node_sglang["SGLang PR artifacts"]
  node_vllm["vLLM PR artifacts"]
  node_kernel_examples["Kernel examples"]
end

node_engineer(("Kernel engineer"))
node_results["Reports and metrics"]

node_engineer -->|"requests iterations"| node_loop
node_engineer -->|"searches evidence"| node_kbs
node_engineer -->|"runs benchmarks"| node_benchmark
node_engineer -->|"profiles kernels"| node_profile
node_kbs -->|"retrieves evidence"| node_corpus
node_corpus -->|"includes PRs"| node_cutlass
node_corpus -->|"includes PRs"| node_deepgemm
node_corpus -->|"includes PRs"| node_flashinfer
node_corpus -->|"includes PRs"| node_pytorch
node_corpus -->|"includes PRs"| node_sglang
node_corpus -->|"includes PRs"| node_vllm
node_corpus -->|"includes kernels"| node_kernel_examples
node_loop -->|"orchestrates profiling"| node_profile
node_loop -->|"uses guidance"| node_kbs
node_loop -->|"runs final benchmark"| node_benchmark
node_profile -->|"checks correctness"| node_correctness
node_benchmark -->|"writes benchmark report"| node_results
node_profile -->|"writes profiling artifacts"| node_results
node_loop -->|"writes final report"| node_results

click node_loop "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-loop"
click node_kbs "https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-KBS/scripts/kbs.py"
click node_corpus "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts"
click node_benchmark "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-benchmark"
click node_profile "https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-profile/scripts/ncu_profile.py"
click node_correctness "https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-profile/scripts/correctness_check.py"
click node_cutlass "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/cutlass"
click node_deepgemm "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/deepgemm"
click node_flashinfer "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/flashinfer"
click node_pytorch "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/pytorch"
click node_sglang "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/sglang"
click node_vllm "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/vllm"
click node_kernel_examples "https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/kernels"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_loop toneBlue
class node_kbs toneAmber
class node_benchmark,node_profile,node_correctness toneMint
class node_corpus,node_cutlass,node_deepgemm,node_flashinfer,node_pytorch,node_sglang,node_vllm,node_kernel_examples toneRose
class node_engineer,node_results toneIndigo
```

## Components

### Optimization workflow

- [Optimization loop](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-loop): `skills/kernel-loop`

### Kernel knowledge

- [Knowledge search](https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-KBS/scripts/kbs.py): `skills/kernel-KBS/scripts/kbs.py`

### Correctness and performance

- [Kernel benchmark](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-benchmark): `skills/kernel-benchmark`
- [Kernel profiling](https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-profile/scripts/ncu_profile.py): `skills/kernel-profile/scripts/ncu_profile.py`
- [Correctness check](https://github.com/minho-fan/kernel-opt-agent/blob/main/skills/kernel-profile/scripts/correctness_check.py): `skills/kernel-profile/scripts/correctness_check.py`

### Reference corpus

- [Evidence corpus](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts): `skills/kernel-KBS/store/corpus/artifacts`
- [CUTLASS PR artifacts](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/cutlass): `skills/kernel-KBS/store/corpus/artifacts/prs/cutlass`
- [DeepGEMM PR artifacts](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/deepgemm): `skills/kernel-KBS/store/corpus/artifacts/prs/deepgemm`
- [FlashInfer PR artifacts](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/flashinfer): `skills/kernel-KBS/store/corpus/artifacts/prs/flashinfer`
- [PyTorch PR artifacts](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/pytorch): `skills/kernel-KBS/store/corpus/artifacts/prs/pytorch`
- [SGLang PR artifacts](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/sglang): `skills/kernel-KBS/store/corpus/artifacts/prs/sglang`
- [vLLM PR artifacts](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/prs/vllm): `skills/kernel-KBS/store/corpus/artifacts/prs/vllm`
- [Kernel examples](https://github.com/minho-fan/kernel-opt-agent/tree/main/skills/kernel-KBS/store/corpus/artifacts/kernels): `skills/kernel-KBS/store/corpus/artifacts/kernels`

### Other components

- **Kernel engineer**
- **Reports and metrics**

## Connections

- Kernel engineer → Optimization loop: requests iterations (evidence: `README.md`)
- Kernel engineer → Knowledge search: searches evidence (evidence: `README.md`)
- Kernel engineer → Kernel benchmark: runs benchmarks (evidence: `README.md`)
- Kernel engineer → Kernel profiling: profiles kernels (evidence: `README.md`)
- Knowledge search → Evidence corpus: retrieves evidence (evidence: `README.md`)
- Evidence corpus → CUTLASS PR artifacts: includes PRs (evidence: `README.md`)
- Evidence corpus → DeepGEMM PR artifacts: includes PRs (evidence: `README.md`)
- Evidence corpus → FlashInfer PR artifacts: includes PRs (evidence: `README.md`)
- Evidence corpus → PyTorch PR artifacts: includes PRs (evidence: `README.md`)
- Evidence corpus → SGLang PR artifacts: includes PRs (evidence: `README.md`)
- Evidence corpus → vLLM PR artifacts: includes PRs (evidence: `README.md`)
- Evidence corpus → Kernel examples: includes kernels (evidence: `README.md`)
- Optimization loop → Kernel profiling: orchestrates profiling (evidence: `README.md`)
- Optimization loop → Knowledge search: uses guidance (evidence: `README.md`)
- Optimization loop → Kernel benchmark: runs final benchmark (evidence: `README.md`)
- Kernel profiling → Correctness check: checks correctness (evidence: `README.md`)
- Kernel benchmark → Reports and metrics: writes benchmark report (evidence: `README.md`)
- Kernel profiling → Reports and metrics: writes profiling artifacts (evidence: `README.md`)
- Optimization loop → Reports and metrics: writes final report (evidence: `README.md`)
