tilegym-cutile-python

Write and validate high-performance GPU kernels using cuTile's tile-based Python programming model.

3.2k|370|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/NVIDIA/skills --skill tilegym-cutile-python
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tilegym-cutile-python
Source: https://github.com/NVIDIA/skills/tree/main/skills/tilegym-cutile-python
Command: npx skills add https://github.com/NVIDIA/skills --skill tilegym-cutile-python

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, cuda.tile, and includes references (resource) components.

What problem does it solve?

Writing correct, high-performance GPU kernels with NVIDIA cuTile requires deep knowledge of tile-based indexing, power-of-2 tile shapes, dtype promotion, and kernel fusion. This Skill guides an AI agent through the full cuTile development workflow—design, implementation, execution, and numerical validation—so kernels compile and match PyTorch references on the first iterations.

Core Features & Use Cases

  • Guided kernel authoring: Step-by-step workflow for writing @ct.kernel functions with correct tile indexing, ct.load/ct.store usage, typed constants, and float32 accumulators.
  • Mandatory validation loop: Generated kernels are executed and compared against PyTorch references with dtype-appropriate tolerances until they pass.
  • Deep agent orchestration: Complex multi-kernel tasks (e.g., transformer blocks, multi-layer nn.Modules) are decomposed by an Analyzer, implemented by parallel Kernel Agents, and composed into a single validated file.
  • Use Case: Ask your agent to convert a PyTorch Conv+BatchNorm+ReLU module into pure cuTile kernels; it searches TileGym examples, generates fused kernels, and validates the composed output end-to-end.

Quick Start

Ask your agent to write a cuTile kernel for RMSNorm on a 2-D float16 tensor and validate it against a PyTorch reference.

Frequently Asked Questions about tilegym-cutile-python

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a cuTile GPU kernel in Python?

Define a function decorated with @ct.kernel that loads tiles with ct.load using tile indices, performs tile operations, and stores results with ct.store. Launch it with ct.launch using a grid computed via ct.cdiv, then validate output against a PyTorch reference.

How do I convert a PyTorch nn.Module to cuTile kernels?

For modules with three or more operations, the skill uses an orchestration workflow: an Analyzer decomposes the forward pass into kernel specs, Kernel Agents generate each kernel in parallel, and a Composer merges them into one validated file. Every compute op must run through ct.launch.

Why does my cuTile kernel fail with tile dimension errors?

cuTile requires every tile dimension in ct.load and ct.store to be a power of 2. Round sizes up with 2**((size-1).bit_length()) and pass both the original and padded sizes as ct.Constant-annotated kernel parameters.

What is the difference between cuTile tile indices and element indices?

ct.load and ct.store use tile indices, not element indices. Use ct.load(A, index=(bid_m, k), shape=(BLOCK_M, BLOCK_K)) rather than multiplying the block id by the block size, which is a common source of wrong results.

Can cuTile kernels use PyTorch functions like F.conv2d in the forward pass?

No. The skill enforces a pure cuTile forward path where all compute goes through @ct.kernel and ct.launch. PyTorch is only permitted for tensor allocation, reshaping, concatenation, and weight storage in __init__.

What tolerances should I use when validating cuTile kernels against PyTorch?

Use atol=1e-3 and rtol=1e-3 for float32 outputs, and atol=1e-2 and rtol=1e-2 for float16 or bfloat16. Accumulate in float32 and cast back to the output dtype to avoid precision failures.