quark-onnx-subgraph-partitioner
Partition an ONNX model graph into named functional subgraphs and emit a subgraph_partition.json file.
Skill by amd
Chalk Labs
Need help deploying quark-onnx-subgraph-partitioner?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/amd-quark-onnx-subgraph-partitioner-b59f39
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/quark-onnx-subgraph-partitioner
What's inside
- Skill name
quark-onnx-subgraph-partitioner- Description
- Partition an ONNX model graph into named functional subgraphs and emit a subgraph_partition.json file. Use when the user wants to understand a model's high-level structure, document its architectural blocks, or prepare a partition for downstream workflows (mixed-precision quantization, layer-wise profiling, partial deployment, graph visualization). Triggers on "partition my ONNX model", "generate a subgraph JSON", "which nodes belong to the attention blocks", "show me the model architecture", "split the model into blocks", "group layers for AMP", or any request that needs a named block decomposition of an ONNX graph. Handles any ONNX architecture: CNNs (ResNet, EfficientNet, YOLOv5/v8, DenseNet, MobileNet), Transformers (BERT, ViT, Swin, LLMs), multi-modal (CLIP, BLIP), detection models with FPN/PAN necks, BEV perception models (BEVFormer), and custom or unfamiliar architectures identified from node-name prefixes and op sequences.
- License
- MIT
- Instructions
- 214 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (3)
- SKILL.md
- inspect_model.py
- validate_partition.py
SKILL.md (first lines)
# quark-onnx-subgraph-partitioner
## Purpose
Produce a `subgraph_partition.json` that groups ONNX graph nodes into named
functional blocks (stem, backbone stage, attention layer, FFN, FPN neck, etc.).
The partition can serve as input to AMP sensitivity analysis, layer-wise
profiling, partial deployment, or graph documentation.
Two helper scripts live alongside this file:
```bash
SKILL_DIR=skills/_legacy_impl/l1-atomic/onnx/quark-onnx-subgraph-partitioner
```
## Inputs
- Model path — a single `.onnx` file supplied as `$ARGUMENTS`
- Optional architecture hints from the user (layer count, naming convention,
block granularity preference)
## Outputs: subgraph_partition.json
Schema: [`subgraph_partition.schema.json`](../../shared/contracts/subgraph_partition.schema.json)
```json
{
"quantized": false,
"num_subgraphs": 4,
"subgraphs": [
{
"name": "backbone_stem",
"description": "Initial stride-2 Conv → SiLU activation, produces P1 features",
"start_nodes": ["/model.0/conv/Conv"],
"end_nodes": ["/model.0/act/Mul"]
},
{
"name": "attention_layer_0",
"description": "Full encoder layer 0: self-attention + FFN + LayerNorm + residuals",
"start_nodes": ["/encoder/layer.0/attention/self/query/MatMul"],
"end_nodes": ["/encoder/layer.0/output/LayerNorm"]
}
]
}
```
Every entry requires all four fields: `name`, `description`, `start_nodes`,
`end_nodes`. **Never include `resolved_nodes`** — node resolution happens at
runtime. `num_subgraphs` must equal `len(subgraphs)`; set it last.
## Analysis Procedure
### Step 1 — Load and inspect the model
```bash
python3 "$SKILL_DIR/inspect_model.py" <MODEL_PATH>
```
For quantized models (detected automatically via Q/DQ op presence), Q/DQ
wrapper nodes are suppressed so structural landmarks remain visible; Q/DQ
counts are reported separately.
**Text `.onnxtxt`** — use `grep` instead:
```bash
grep -n 'op_type:\| name:\|input:\|output:' <MODEL_PATH> | head -400
```
**Quantized model rules:** use compute nodes (`Conv`, `MatMul`, `Add`, …) as
boundaries — never Q/DQ nodes. BFS from a compute node captures surrounding
Q/DQ wrappers automatically.
### Step 2 — Identify structural landmarks
| Signal | Likely boundary |
|--------|-----------------|
| First `Conv` consuming the graph input | Backbone / model stem |
| Repeated `/model.N/` or `/layer.N/` prefix groups | Stage or layer repetition |
| `MaxPool` or strided `Conv` (stride 2) | Resolution downsampling |
| `Resize` (upsample) + `Concat` on lateral path | FPN / PAN top-down merge |
| `Split` → N parallel `Conv` → `Concat` + 1×1 `Conv` | C2f / CSP bottleneck |
| `GlobalAveragePool` → FC → activation → `Mul` | SE block |
| `MatMul`×3 → `Softmax` → `MatMul` (QKV pattern) | Self-attention block |
| `LayerNormalization` or `InstanceNormalization` | Transformer / diffusion layer |
| `MatMul`/`Gemm` → activation → `MatMul`/`Gemm` (hidden × 4) | FFN / MLP block |
| `Add` immediately after attention + FFN | Residual add (layer end) |
| `GridSample` with sampling offsets | Deformable attention |
| `Gather` on index 0 → `LayerNorm` → `Gemm` | CLS token / pooler / head |
### Step 3 — Assign blocks
| Block type | Description |
|------------|-------------|
| `Stem` | Initial convs before first downsampling |
| `BackboneStage` | Stage at one resolution (N residual / bottleneck blocks) |
| `SEBlock` | Squeeze-and-Excitation (GAP → FC → activation → Mul) |
| `PatchEmbedding` | ViT patch projection (Conv with patch-stride kernel) |
| `SelfAttentionBlock` | Multi-head self-attention (QKV + Softmax + out proj) |
| `FFNBlock` | Feed-forward network (Linear → activation → Linear) |
| `TransformerLayer` | Full encoder/decoder layer (attn + FFN + norms + residuals) |
| `SPPF` | Spatial Pyramid Pooling Fast |
| `FPNNeck` | Feature Pyramid Network (lateral convs + upsample + merge) |
| `PANNeck` | Path Aggregation Network (down-path convs + concat + merge) |
| `DetectionHead` | Conv layers + decode logic for bbox / class output |
| `ClassificationHead` | MLP predicting class logits |
**Granularity rules:**
- No single subgraph > ~25 % of total nodes; split if needed.
- No trivial single-activation subgraphs; minimum unit is one compute op.
- Split every repeated layer individually (12 transformer layers → 12 entries).
- Merge inseparable op chains (Conv + BN + ReLU with no branch points).
- Assign `Concat` / `Add` / `Resize` to the subgraph that *produces* the feature map.
### Step 4 — Choose start and end nodes
**`start_nodes`**: first node(s) receiving data from outside the block. Only
list a node if it is **not already reachable** from another listed start node —
downstream-reachable additions are redundant. When a block has multipleFrom amd/Quark, MIT.
More from amd/Quark
- 0.684score
quark-skill-creator
amd
Author or restructure a Quark Agent Skill so it conforms to this project's template, contracts, and layer rules.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-llm-eval
amd
End-to-end LLM accuracy evaluation on AMD ROCm (ROCm-only) — container setup, vLLM/SGLang/ATOM serving, lm-eval / lighteval / evalscope benchmarks.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-env-preflight
amd
Collect and normalize environment facts (OS, Python, GPU, CUDA/ROCm, container state) before Quark installation or PTQ planning.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-model-intake
amd
Inspect a target model and prepare metadata for Quark PTQ planning.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-export
amd
Prepare export and downstream evaluation handoff for a planned or completed Quark PTQ run.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-install
amd
Install or verify the correct PyTorch build for a user's accelerator backend before Quark installation.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-install
amd
Install or verify the AMD Quark package and its dependencies.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-onnx-install
amd
Install or verify the correct ONNX Runtime build (and the `onnx` package) for a user's accelerator backend before Quark's ONNX-to-ONNX flow.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-onnx-model-intake
amd
Inspect a target ONNX model and prepare metadata for Quark ONNX PTQ planning.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-onnx-router
amd
Route Quark ONNX user goals to the correct atomic skill.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-debug
amd
Diagnose failed Quark installation, PTQ execution, script generation, or export attempts.
SkillAFreshness: A★ 186Claude Code +9 - 0.679score
quark-torch-quant-plan
amd
Build a Quark Torch LLM PTQ quantization plan from model analysis and user intent.
SkillAFreshness: A★ 186Claude Code +9
Signals
- Stars
- 186
- Forks
- 36
- Open issues
- 3
- Last commit (this folder)
- Sep 28, 2026 (1 month ago)
- Last release
- Sep 28, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/amd/Quark
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from amd
- 0.700score
quark-torch-llm-ptq
amd
Runs an end-to-end AMD Quark post-training quantization workflow for PyTorch / Hugging Face LLMs: inspect a Hub or local model, choose a quantization plan…
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
rocprofiler-pc-sampling
amd
Profiles a target application using rocprofv3 with program counter sampling enabled and then analyzes the results.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
local-ai-use
amd
Makes this agent generate images, transcribe audio, and synthesize speech on the user's own machine through a local Lemonade Server instead of a paid cloud API.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
quark-install
amd
Installs or verifies AMD Quark and ensures the selected Python environment has an accelerator-matched PyTorch.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
lemonade-router-builder
amd
Turns a natural-language description of routing intent into a valid Lemonade `collection.router` policy JSON.
SkillAFreshness: A★ 465Claude Code +9 - 0.700score
serving-llms-on-epyc
amd
Serves an LLM on a supported AMD EPYC server CPU using vLLM with zentorch, in Docker, Podman, or conda.
SkillAFreshness: A★ 465Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get quark-onnx-subgraph-partitioner running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
quark-onnx-subgraph-partitioner skill. Agent Mart. https://agentmart.dev/skills/amd-quark-onnx-subgraph-partitioner-b59f39 (last updated 2026-10-24)