Autotune Kernel#

KernelGen Operator Development MCP Toolkit integrates an MCP tool for autotuning Kernels. You only need to provide a functional description of the operator. Through multiple rounds of intelligent iteration, the KernelGen automatically generates, verifies, and continuously optimizes the operator implementation, ultimately delivering a high-performance Triton Kernel along with a complete test report.

The autotune Kernel function is supported on all testing devices. See Supported Hardware Platforms. You can invoke this tool through AI agents, including VSCode (and Github Copilot), Cursor, Claude Code, and OpenClaw.

If you haven’t connected to the KernelGen Operator Development MCP Toolkit, see Configure and connect to KernelGen Operator Development MCP Toolkit.

To autotune kernels, a typical prompt should include the mandatory and optional elements. See such information in Auto-tune template.

Auto-tune template#

Call the MCP tool to iteratively generate the **[operator name]** operator on **[target device]**.
Task description: [Detailed description of the operator's functionality, inputs/outputs, and constraints]
- Iterations: [N]
- Speedup target: [X]

Mandatory elements#

  1. Invoke the KernelGen MCP tool

  2. Operator name

  3. Task description

Auto-tune examples#

Example 1 — Basic version#

Call the KernelGen MCP tool to iteratively generate the **rmsnorm** operator on MetaX.
Task description: Implement RMSNorm with an input tensor of shape `(batch, hidden_size)` and produce the normalized output.
Use defaults:
- Iterations = 3
- Speedup target = 1.2Ă—

Example 3 — Production-grade version#

Call the KernelGen MCP tool to iteratively generate a **fused softmax** operator on an **NVIDIA GPU**.
Task description: Implement a fused softmax with masking. The input is an attention score tensor of shape `(batch, head, seq_len, seq_len)`. The goal is to minimize memory access and maximize throughput.
Iterations: 6
Speedup target: 2.0Ă—

Tips for better results#

The more specific your task description, the better the auto-tuning outcome.

Do specify:

  • Data type: fp16 / bf16 / fp32

  • Tensor shape

  • Whether kernel fusion is required

  • Performance bottleneck: memory-bound vs. compute-bound

Avoid:

  • Vague descriptions like “implement an operator”

  • Omitting input/output specifications