vllm-kernel-trace
Trace which GPU kernels vLLM dispatches for specific model layers (linear, attention, MoE, norms).
Skill by yiliu30
Chalk Labs
Need help deploying vllm-kernel-trace?
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/yiliu30-vllm-kernel-trace
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
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. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/vllm-kernel-trace
What's inside
- Skill name
vllm-kernel-trace- Description
- Trace which GPU kernels vLLM dispatches for specific model layers (linear, attention, MoE, norms). Use this skill whenever the user wants to understand what kernel runs under a vLLM model layer, trace the call stack from a quantization config to the actual CUDA kernel, profile a vLLM run and identify bottleneck ops, or understand input/output dtypes and tensor shapes flowing through a layer. Trigger on phrases like 'which kernel', 'trace the call stack', 'what op does vLLM use for', 'profile this model', 'understand the dispatch path', 'what GEMM kernel', 'marlin or cutlass', 'kernel for MXFP4/FP8/AWQ/GPTQ'.
- License
- MIT
- Instructions
- 172 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# vLLM Kernel Trace
Trace the GPU kernel dispatch path for any layer type in a vLLM model. Produces a call stack analysis, dtype/shape table, and a profiling script with actual trace results.
## Workflow
There are two modes. Use **Quick mode** when the user just wants to know what kernel is running (profile and grep). Use **Deep mode** when they want the full call stack, dtypes, shapes, and understanding of the dispatch logic.
### Quick Mode (profile-first)
1. Get model path, python env, GPU count from user (skip if already known)
2. Write and run a profiling script (see template in Step 5 below) with `torch_profiler_record_shapes=True`
3. After profiling completes, grep the trace JSON for kernel names:
```bash
python -c "
import json, glob, collections
files = glob.glob('<PROFILE_DIR>/*.json')
for f in files:
trace = json.load(open(f))
ops = [e['name'] for e in trace.get('traceEvents', []) if e.get('cat') == 'kernel']
counts = collections.Counter(ops).most_common(20)
for name, cnt in counts:
print(f'{cnt:5d} {name}')
"
```
4. Report which kernels dominate and their shapes (visible in the trace event args)
5. If the user wants deeper understanding, switch to Deep mode
### Deep Mode (full trace)
### 1. Clarify the target
Ask the user:
- **Model path** — where is the model checkpoint?
- **Layer type** — what are they interested in? (quantized linear, attention, MoE, norms, or "all")
- **Python env** — which python interpreter to use
- **GPU setup** — how many GPUs, which CUDA_VISIBLE_DEVICES
If the user already provided these in context, skip asking.
### 2. Inspect the model config
Read the model's `config.json` (and `quantization_config` within it) to determine:
- `quant_method` (compressed-tensors, gptq, awq, fp8, mxfp4, etc.)
- `format` (e.g., mxfp4-pack-quantized, marlin, etc.)
- `model_type` (for architecture-specific dispatch)
- Any ignored layers
This tells you which quantization path vLLM will take.
### 3. Trace the code path
Follow the dispatch chain in vLLM source. The general pattern is:
```
quantization config (from config.json)
→ QuantizationConfig subclass (registered in __init__.py)
→ get_quant_method() returns a QuantizeMethodBase for the layer type
→ create_weights() / process_weights_after_loading()
→ apply_weights() or apply() → actual kernel call (ops.XXX)
```
Key directories to search:
- `vllm/model_executor/layers/quantization/` — all quant methods
- `vllm/model_executor/layers/quantization/compressed_tensors/schemes/` — compressed-tensors sub-schemes
- `vllm/model_executor/layers/quantization/utils/` — kernel wrappers (marlin, cutlass, etc.)
- `vllm/model_executor/layers/attention/` — attention backends
- `vllm/model_executor/layers/fused_moe/` — MoE kernels
- `vllm/_custom_ops.py` — the final dispatch to C++/CUDA ops
For each target layer, identify:
1. The scheme/method class that handles it
2. The `apply_weights()` or equivalent method
3. The actual `ops.XXX()` call (this is the kernel)
4. The scalar_type or other type identifiers passed to the kernel
### 4. Document dtypes and shapes
For the identified kernel call, document:
- Input activation: dtype, shape pattern `(M, K)`
- Weight: dtype after repacking, shape
- Scales: dtype, shape, group_size
- Any additional inputs (global_scale, zeros, bias)
- Output: dtype, shape pattern `(M, N)`
- Any quantization of activations (a_scales)
### 5. Create a profiling script
Write a self-contained Python script that:
- Loads the model with `vllm.LLM`
- Uses `profiler_config` with `torch_profiler_record_shapes: True`
- Runs a minimal generation (1 prompt, short max_tokens)
- Uses `enforce_eager=True` to avoid cudagraph complications
- Saves trace to a known directory
Template:
```python
import time
from vllm import LLM, SamplingParams
MODEL_PATH = "<user's model path>"
PROFILE_DIR = "./vllm_profile_<model_name>"
llm = LLM(
model=MODEL_PATH,
tensor_parallel_size=<N>,
max_model_len=128,
max_num_seqs=1,
enforce_eager=True,
profiler_config={
"profiler": "torch",
"torch_profiler_dir": PROFILE_DIR,
"torch_profiler_record_shapes": True,
},
)
llm.start_profile()
outputs = llm.generate(["Hello, my name is"], SamplingParams(temperature=0.0, max_tokens=16))
llm.stop_profile()From yiliu30/z2h, MIT.
More from yiliu30/z2h
- 0.563score
profile-cute-xpu
yiliu30
Profile and analyze CuTe/SYCL*TLA kernels on Intel XPU/GPU, especially Intel Xe/BMG/Xe20/Xe35 GEMM-style kernels using CuTe primitives such as XE_DPAS_TT…
SkillBFreshness: B★ 2Claude Code +9 - 0.559score
intel-xpu-cute-accuracy-debug
yiliu30
Debug numerical mismatches in Intel XPU CuTe/CUTLASS kernels, especially Xe DPAS/BDPAS fragment layouts, block-scale payloads, and fused SDPA/GEMM accumulators.
SkillBFreshness: B★ 2Claude Code +9 - 0.507score
confluence-html
yiliu30
Create rich, interactive HTML that survives Confluence's save sanitizer by using only inline styles, no external resources, and JavaScript for dynamic content.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
remote-debug
yiliu30
Drive Claude Code to debug an issue on a remote node over SSH — connect, set up an environment, copy scripts/probes across, run repros, and capture findings.
SkillCFreshness: C★ 2Claude Code +9 - 0.501score
read-arxiv-paper
yiliu30
Given an arxiv URL, download the TeX source, read the paper, and produce a summary markdown file
SkillCFreshness: C★ 2Claude Code +9 - 0.448score
reduce-model
yiliu30
Create a reduced (fewer-layer) version of a large HuggingFace model for fast testing and debugging.
SkillDFreshness: D★ 2Claude Code +9 - 0.443score
real-review
yiliu30
Fact-check written content (GitHub issues, docs, reports, posts) by verifying every claim, number, link, code reference, and conclusion against actual evidence.
SkillDFreshness: D★ 2Claude Code +9 - 0.443score
observe
yiliu30
Memory observer agent for recording structured observations from primary Claude Code sessions.
SkillDFreshness: D★ 2Claude Code +9 - 0.443score
find-sth
yiliu30
Investigate a technical question by searching across multiple sources (source code, documentation, academic papers, existing findings) and produce a sourced…
SkillDFreshness: D★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 0
- Open issues
- 1
- Last commit (this folder)
- Apr 20, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/yiliu30/z2h
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from yiliu30
- 0.563score
profile-cute-xpu
yiliu30
Profile and analyze CuTe/SYCL*TLA kernels on Intel XPU/GPU, especially Intel Xe/BMG/Xe20/Xe35 GEMM-style kernels using CuTe primitives such as XE_DPAS_TT…
SkillBFreshness: B★ 2Claude Code +9 - 0.559score
intel-xpu-cute-accuracy-debug
yiliu30
Debug numerical mismatches in Intel XPU CuTe/CUTLASS kernels, especially Xe DPAS/BDPAS fragment layouts, block-scale payloads, and fused SDPA/GEMM accumulators.
SkillBFreshness: B★ 2Claude Code +9 - 0.507score
confluence-html
yiliu30
Create rich, interactive HTML that survives Confluence's save sanitizer by using only inline styles, no external resources, and JavaScript for dynamic content.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
remote-debug
yiliu30
Drive Claude Code to debug an issue on a remote node over SSH — connect, set up an environment, copy scripts/probes across, run repros, and capture findings.
SkillCFreshness: C★ 2Claude Code +9 - 0.501score
read-arxiv-paper
yiliu30
Given an arxiv URL, download the TeX source, read the paper, and produce a summary markdown file
SkillCFreshness: C★ 2Claude Code +9 - 0.448score
reduce-model
yiliu30
Create a reduced (fewer-layer) version of a large HuggingFace model for fast testing and debugging.
SkillDFreshness: D★ 2Claude 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 vllm-kernel-trace 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
vllm-kernel-trace skill. Agent Mart. https://agentmart.dev/skills/yiliu30-vllm-kernel-trace (last updated 2026-10-24)