Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Converts cuTile GPU kernels (@ct.kernel) to Triton (@triton.jit). Handles standard in-repo conversion, debugging (cudaErrorIllegalAddress, shape mismatch, numerical mismatch), and mapping cuTile idioms (ct.load/ct.store, ct.Constant, ct.launch) to Triton equivalents. Covers dual-kernel layout flags (e.g. transpose=True/False + autotune grid via META) per translations/advanced-patterns.md. Use when converting, porting, or translating cuTile kernels to Triton, or debugging existing Triton translat
.claude/skills/nvidia-tilegym-converting-cutile-to-triton/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-07 | ✗→✓ | ▲ Improved | 118% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 231% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 207% | 0% |
| case-14 | ✓→✓ | = Same ✓ | 124% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 215% | 0% |
Convert @ct.kernel kernels to @triton.jit. API mapping: references/api-mapping.md (cuTile → Triton).
In this skill’s Markdown, Triton launch syntax kernel[grid](…) uses Unicode brackets so link checkers do not parse [grid](…) as a hyperlink; use normal ASCII brackets in real Triton code.
Follow the phase-gated workflow in translations/workflow.md. Every conversion should go through analyze → convert → validate → test → benchmark, with explicit gates before moving on. Use the documents in Workflow Selection when the task matches a special case (errors, layout flags, perf).
gemma_attention), read references/optimization-strategy.md before converting the inner loop, then apply §4 Gemma FMHA checklist. For other GEMM/BMM/attention-adjacent kernels, still skim §2–§3 of that file after TMA is done.translations/workflow.md. If the cuTile source uses transpose / transpose_v, dual layouts, or MLA-style paths, read translations/advanced-patterns.md before writing Triton (two kernels + META grid, not one kernel + tl.trans).@ct.kernel definitions; note TMA-relevant ct.load/ct.store, ct.launch, Constant, and layout flags.tl.make_tensor_descriptor (TMA), not raw tl.load(ptr+offs, mask=…) for full tiles—skipping this is the most common source of large regressions. Host side: Triton bracket launch <code>kernel[grid](args)</code> with tuple or lambda META: (…) for autotune; no ct.launch.pytest tests/ops/test_<op>.py -k "triton" -vs. Fix failures before benchmarking.Execution rules (MUST):
cudaErrorIllegalAddress, shape mismatch, numerical mismatch) → references/debugging.mdtranspose, autotune + META grid, Array.slice, ct.gather().item()) → translations/advanced-patterns.md (MLA-style two kernels, avoid 3–15× regression on transpose=False).loop_unroll_factor, occupancy autotuning, TMEM-friendly block sizes, slab allocator, dual-path kernel designtranspose=True only, collapse on transpose=False (or opposite) → translations/advanced-patterns.md — §1 Dual layout flag; two @triton.jit kernels + grid = lambda META: (... META["BLOCK_H"] ...)bash# Count kernels (only main kernel gets @triton.jit, helpers stay plain def) grep "@ct\.kernel" source.py | wc -l # Check for patterns needing special handling grep "ct\.transpose\|ct\.permute" source.py # → use tl.trans/tl.permute grep "ct\.astype" source.py # → use .to(dtype) grep "ct\.load\|ct\.store" source.py # → TMA for 2D+ (tl.make_tensor_descriptor), NOT raw tl.load(ptr+offs) grep "ct\.launch" source.py # → bracket launch: kernel then [grid] then (args) grep "ct\.Constant\|ct\.ConstInt" source.py # → tl.constexpr grep "ct\.cdiv" source.py # → triton.cdiv (host) or Python (a+b-1)//b grep "ct\.bid\|ct\.num_blocks" source.py # → tl.program_id/tl.num_programs grep "1 << .*\.bit_length" source.py # → triton.next_power_of_2 if needed grep "transpose\|transpose_v" source.py # → if hit, read translations/advanced-patterns.md (dual kernels + META grid)
Copy this checklist and track progress:
Conversion Progress:
[ ] Step 0 (attention / Gemma FMHA / GQA / soft cap / sliding window): Read [references/optimization-strategy.md](./references/optimization-strategy.md) and apply §4 checklist before inner-loop Triton
[ ] Step 1: Pre-flight — run grep commands above, note special patterns and 2D+ loads (→ TMA)
[ ] Step 2: Analyze source cuTile kernel (identify patterns, shapes, dtypes)
[ ] Step 3: Create Triton file with correct structure (see translations/file-structure.md)
[ ] Step 4: Convert kernel signature (tensor args → pointer args, Constant → constexpr)
[ ] Step 4b: TMA (MANDATORY for 2D+ loads) — use tl.make_tensor_descriptor for every 2D+ tile load/store; do NOT ship raw tl.load(ptr+offs,mask) for block-shaped access (see workflow.md § TMA OPTIMIZATION)
[ ] Step 5: Convert kernel body (apply gotchas table below + API mapping)
[ ] Step 6: Convert host wrapper (grid tuple/lambda, bracket-style launch: kernel, grid, then arguments; no ct.launch); call triton.set_allocator(alloc_fn) if using TMA
[ ] Step 7: Validate — run pytest or syntax check on Triton file
[ ] Step 8: Test — run pytest, verify X passed 0 failed
[ ] Step 9: If test fails → fix → re-validate → re-test (loop until green)
[ ] Step 10: Benchmark — run perf test, compare vs cuTile (see workflow.md § PERFORMANCE ANALYSIS)
[ ] Step 10b: If GEMM/BMM/attention and Triton >20% slower → walk [references/optimization-strategy.md](./references/optimization-strategy.md) §2–§3 then [references/optimizing-reference.md](./references/optimizing-reference.md) (EVEN_K, transpose, grid, autotune, epilogue subtile), then re-benchmark
[ ] Step 10c: If op has `transpose` / layout flag → read [translations/advanced-patterns.md](./translations/advanced-patterns.md); verify **separate kernels** per layout (not transpose-kernel + `tl.trans`); **autotuned** launches use `lambda META: (triton.cdiv(..., META["BLOCK_H"]), ...)` — no fixed `BLOCK_H`/`BLOCK_N` through `apply()` unless autotune is disabled
Post-conversion Verification (TMA is mandatory for 2D+ loads):
[ ] TMA: All 2D+ tile loads use tl.make_tensor_descriptor(...).load([...]); no raw ptr+mask for block-shaped 2D+ access (else 5x-20x regression)
[ ] Grid uses tuple or lambda (not 3-tuple required like cuTile)
[ ] Triton autotune added if cuTile op used kernel_configs/autotune (see workflow § PERFORMANCE ANALYSIS)
[ ] Host grid uses triton.cdiv where appropriate (not (a+b-1)//b only)
[ ] Pointer/offset indexing: Triton uses element offsets (ptr + offs), not block index in tl.load (or use TMA descriptor)
[ ] ct.astype(x, dtype) → x.to(dtype) in Triton
[ ] ct.mma(a, b, acc=acc) → tl.dot(a, b, acc) (no keyword in Triton)
[ ] Optional/None args: Triton allows None in kernel args if desired (cuTile required dummy+flag)
[ ] Masking applied when BLOCK_SIZE > actual dimension (same as cuTile); with TMA, masks can often be removed for full tiles
[ ] Reduction divisor uses actual_size, NOT BLOCK_SIZE
[ ] fp32/tf32: Triton defaults allow_tf32=True; match cuTile behavior if you had explicit tf32 cast
[ ] If any 2D+ load uses raw ptr+mask (exception only): document WHY TMA was not used
[ ] tl.assume() alignment hints added for strides and pointersComprehensive table of patterns that frequently break or regress when porting @ct.kernel to @triton.jit — mma accumulator, type cast, grid, TMA usage, dtype handling, layout flags, batched matmul, etc.
See: references/gotchas.md — read this BEFORE writing the Triton kernel.
⚠️ These cause CATASTROPHIC slowdowns. Check BEFORE benchmarking.
Patterns and their impact: TMA vs raw ptr+mask (5-20×), autotune vs fixed tile sizes (2-3×), broadcast_to + tl.dot (10-50×), extract_slice chains (2-5×), and more.
See: references/performance-gotchas.md — full regression-risk table.
Full details: translations/workflow.md — section CRITICAL PERFORMANCE PATTERNS (AVOID 10-50x REGRESSION).
Full API mapping: references/api-mapping.md.
Triton math dtype (erf/erfc/exp/log/sqrt) and the "don't substitute erf with tanh" pattern: references/debugging.md — section Triton Math Function Dtype Requirements (CRITICAL).
File: references/optimization-strategy.md
Summarizes translations/advanced-patterns.md (layout flags, dual kernels, autotune+META, batched launch, Blackwell pointers) and references/optimizing-reference.md (post-TMA micro-opts, §9) into §1–§3 plus a mandatory §4 Gemma FMHA checklist.
Rule: For attention / FMHA / Gemma-style conversions, open optimization-strategy in the same session as workflow — do not rely on TMA alone for perf sign-off.
Read from cuTile → Triton perspective. Core files live in this skill under .
| Category | Document | Content | |----------|----------|---------| | Strategy | optimization-strategy.md | Ordered hub: advanced-patterns + optimizing-reference; §4 Gemma FMHA mandatory checklist | | Workflows | translations/workflow.md | Standard c2t conversion (phases + checklist) | | | translations/file-structure.md | Where to place Triton files when converting from cuTile | | | translations/advanced-patterns.md | Dual layout flags (transpose), autotune + META grid, MLA-style two kernels | | API | api-mapping.md | cuTile → Triton mapping | | | optimizing-reference.md | GEMM/BMM/attention optimizations (EVEN_K, transpose, grid, autotune, epilogue subtile) | | Gotchas | gotchas.md | Common cuTile→Triton translation errors (mma, dtype, grid, TMA, layout flags) | | | performance-gotchas.md | 10-50× regression-risk table (TMA vs ptr+mask, broadcast_to, extract_slice chains, autotune) | | Testing & errors | references/debugging.md | Triton runtime errors (cudaErrorIllegalAddress, pointer type, stride overflow) |
Use cutile_kernel.py as source and triton_kernel.py as target:
| Example | Directory | Complexity | |---------|-----------|------------| | Vector Add | examples/01_vector_add/ | Basic | | Softmax | examples/02_softmax/ | Intermediate | | LayerNorm | examples/03_layernorm/ | Intermediate | | MatMul | examples/04_matmul/ | Advanced | | Attention | examples/05_attention/ | Advanced |
Read cutile_kernel.py first, then triton_kernel.py, to see the inverse mapping.
A conversion is NOT COMPLETE until ALL items are checked. Copy and complete:
MANDATORY COMPLETION GATES:
[ ] 1. CORRECTNESS: pytest passes with 0 failures
Command: python -m pytest {test_path} -k "test_op and triton" -vs --tb=short
Gate: "X passed, 0 failed"
[ ] 2. TMA OPTIMIZATION: All 2D+ tile loads use tl.make_tensor_descriptor
Verify: grep -n "tl.load.*mask" triton_file.py | wc -l # Should be 0 for 2D+ ops
Skip = 5-20x performance regression
[ ] 3. PERFORMANCE TEST: Triton within 20% of cuTile baseline
Command: python -m pytest {test_path} -k "test_perf" --print-record -v
OR: Run benchmark script: cd tests/benchmark && python bench_{op}.py
Gate: Triton TFLOPS >= 0.8 * CuTile TFLOPS
[ ] 4. PERFORMANCE COMPARISON RECORDED:
Document results:
| Config | Triton (TFLOPS) | CuTile (TFLOPS) | Ratio |
|--------|-----------------|-----------------|-------|
| [fill] | [fill] | [fill] | [fill]|
CONVERSION COMPLETE: All 4 gates passed? → YES / NOWhy this matters:
If any gate fails: Fix and re-verify before declaring complete.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 4,494 | 4,125 | -8% | 1 | 1 | 0% | 182 | 4,664 | +2463% | 0 | 0 | — |
case-14 | pass→pass | 17,701 | 17,991 | +2% | 1 | 1 | 0% | 3,434 | 7,698 | +124% | 0 | 0 | — |
case-02 | fail→fail | 26,517 | 24,346 | -8% | 1 | 1 | 0% | 6,223 | 9,830 | +58% | 0 | 0 | — |
case-03 | fail→fail | 24,769 | 4,060 | -84% | 1 | 1 | 0% | 5,505 | 4,617 | -16% | 0 | 0 | — |
case-04 | pass→pass | 8,539 | 4,479 | -48% | 1 | 1 | 0% | 1,722 | 5,427 | +215% | 0 | 0 | — |
case-05 | pass→pass | 11,424 | 8,364 | -27% | 1 | 1 | 0% | 2,337 | 6,195 | +165% | 0 | 0 | — |
case-06 | pass→pass | 10,747 | 7,647 | -29% | 1 | 1 | 0% | 2,375 | 5,980 | +152% | 0 | 0 | — |
case-07 | fail→pass | 15,519 | 9,851 | -37% | 1 | 1 | 0% | 2,840 | 6,197 | +118% | 0 | 0 | — |
case-08 | fail→pass | 8,637 | 4,320 | -50% | 1 | 1 | 0% | 1,564 | 5,183 | +231% | 0 | 0 | — |
case-09 | pass→pass | 6,306 | 4,190 | -34% | 1 | 1 | 0% | 1,292 | 5,308 | +311% | 0 | 0 | — |
case-10 | pass→pass | 10,899 | 5,671 | -48% | 1 | 1 | 0% | 2,014 | 5,555 | +176% | 0 | 0 | — |
case-11 | pass→pass | 13,005 | 7,309 | -44% | 1 | 1 | 0% | 2,545 | 5,818 | +129% | 0 | 0 | — |
case-12 | pass→pass | 7,304 | 4,113 | -44% | 1 | 1 | 0% | 1,283 | 5,189 | +304% | 0 | 0 | — |
case-13 | pass→pass | 6,009 | 5,610 | -7% | 1 | 1 | 0% | 1,190 | 5,559 | +367% | 0 | 0 | — |
case-15 | pass→pass | 10,975 | 7,169 | -35% | 1 | 1 | 0% | 1,975 | 5,845 | +196% | 0 | 0 | — |
case-16 | fail→pass | 10,670 | 4,794 | -55% | 1 | 1 | 0% | 1,684 | 5,168 | +207% | 0 | 0 | — |
case-17 | pass→pass | 8,493 | 5,426 | -36% | 1 | 1 | 0% | 1,442 | 5,471 | +279% | 0 | 0 | — |
case-18 | fail→fail | 18,847 | 11,293 | -40% | 1 | 1 | 0% | 3,459 | 6,496 | +88% | 0 | 0 | — |
case-19 | pass→pass | 13,800 | 8,931 | -35% | 1 | 1 | 0% | 2,280 | 5,986 | +163% | 0 | 0 | — |
case-20 | pass→pass | 20,401 | 20,530 | +1% | 1 | 1 | 0% | 4,507 | 9,164 | +103% | 0 | 0 | — |
case-21 | pass→pass | 22,675 | 18,965 | -16% | 1 | 1 | 0% | 4,823 | 8,397 | +74% | 0 | 0 | — |
case-22 | pass→pass | 18,155 | 14,005 | -23% | 1 | 1 | 0% | 3,798 | 7,629 | +101% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +14 percentage points is the difference between those two pass rates over the 20 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.