Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

cuda-tile

БесплатноБез исполняемых скриптовНе проверен

CUDA Tile skill for tile-based GPU kernels with cuTile Python and the CUDA Tile C++ API. Use when writing cuTile kernels with ct.load/ct.store/ct.mma…

mohitmishra786от mohitmishra786★ 307 звёзд на GitHub

Об этом скилле

CUDA Tile

Purpose

Guide agents through NVIDIA's tile programming model (checked with CUDA 13.5 and cuda-tile 1.8.1): cuTile Python kernels, the C++ Tile API, ahead-of-time export, and when tiles are the right tool.

Triggers

  • "How do I write a kernel with cuTile Python?"
  • "What is CUDA Tile / Tile IR and how is it different from SIMT CUDA?"
  • "How do I compile a C++ tile kernel with nvcc?"
  • "Can I compile a cuTile kernel to a cubin without a GPU?"
  • "Should I use cuTile or Triton?"
  • "Which GPUs support CUDA Tile?"

Workflow

1. The model

In SIMT CUDA you write one thread's work and manage threads, warps and shared memory. In CUDA Tile you write one block's work on whole tiles (small arrays); the compiler maps tiles to threads, tensor cores, TMA and shared memory.

SIMT CUDA CUDA Tile
Unit of code One thread One block, operating on tiles
Memory movement Manual (shared memory, __syncthreads) load/store of tiles; compiler stages data
Tensor cores wmma/mma PTX or CUTLASS ct.mma / ct::mma on tiles
IR PTX Tile IR (bytecode), lowered by tileiras
Hardware All supported GPUs Compute capability 8.0+ (Ampere and newer)
New GPU kernel?
├── Dense tensor math (GEMM, attention, reductions) → CUDA Tile or Triton
├── Irregular control flow, per-thread logic, atomics everywhere → SIMT CUDA
├── Python stack, want NVIDIA's own compiler and Tile IR → cuTile Python
├── Existing C++/CUDA codebase → CUDA Tile C++ (nvcc --enable-tile)
└── Need AMD/Intel portability → Triton (also has a Tile IR backend for NVIDIA)

2. cuTile Python

pip install cuda-tile               # with a CUDA Toolkit installed (see table below)
pip install "cuda-tile[tileiras]"   # no toolkit: pulls tileiras, nvcc and NVVM wheels
pip install cupy-cuda13x            # device arrays for the examples (not a cuda-tile dependency)
# Needs driver r580+, Linux x86_64/aarch64 or Windows x86_64, Python 3.11+
GPU generation Minimum toolkit / tileiras for Tile
Blackwell (sm_100, sm_120) 13.1
Ampere, Ada (sm_80, sm_86, sm_89) 13.2 (FP8 on Ada: 13.5)
Hopper (sm_90) 13.3
import cupy as cp
import cuda.tile as ct

TILE = 1024


@ct.kernel
def vector_add(a, b, c, tile: ct.Constant[int]):
    pid = ct.bid(0)                                   # this block's index along axis 0
    ta = ct.load(a, index=(pid,), shape=(tile,))      # load one tile from each input
    tb = ct.load(b, index=(pid,), shape=(tile,))
    ct.store(c, index=(pid,), tile=ta + tb)          # element-wise add, store the tile


n = 1 << 20
a = cp.random.rand(n, dtype=cp.float32)
b = cp.random.rand(n, dtype=cp.float32)
c = cp.empty_like(a)

grid = (ct.cdiv(n, TILE), 1, 1)                       # one block per tile
ct.launch(cp.cuda.get_current_stream(), grid, vector_add, (a, b, c, TILE))
assert cp.allclose(c, a + b)
  • index is in tile units: index=(pid,) with shape=(1024,) covers elements pid*1024 ... pid*1024+1023.
  • ct.Constant[int] parameters are compile-time constants; each distinct value compiles a new variant.
  • Arrays are device arrays such as CuPy's (as in NVIDIA's quickstart); the runtime looks for __cuda_array_interface__ / __dlpack__.

3. Matrix multiply with tensor cores

@ct.kernel
def matmul(A, B, C, tm: ct.Constant[int], tn: ct.Constant[int], tk: ct.Constant[int]):
    bm, bn = ct.bid(0), ct.bid(1)                     # output tile coordinates
    acc = ct.full((tm, tn), 0, dtype=ct.float32)      # fp32 accumulator tile
    for k in range(ct.cdiv(A.shape[1], tk)):
        # Zero-pad the partial last K tile so out-of-range elements add nothing
        a = ct.load(A, index=(bm, k), shape=(tm, tk), padding_mode=ct.PaddingMode.ZERO)
        b = ct.load(B, index=(k, bn), shape=(tk, tn), padding_mode=ct.PaddingMode.ZERO)
        acc = ct.mma(a, b, acc)                       # tensor-core multiply-accumulate
    ct.store(C, index=(bm, bn), tile=ct.astype(acc, C.dtype))

# fp16 inputs, 128x128 output tiles, K step 64
grid = (ct.cdiv(M, 128), ct.cdiv(N, 128), 1)
ct.launch(cp.cuda.get_current_stream(), grid, matmul, (A, B, C, 128, 128, 64))

Other tile operations: ct.sum, ct.max, ct.exp, ct.where, ct.matmul, ct.zeros, ct.astype, ct.num_blocks(axis). Tile dimensions must be powers of two (Dimension #0 of shape (1000,) is not a power of two).

4. Ahead-of-time export (no GPU needed)

import cuda.tile as ct
from cuda.tile.compilation import (ArrayConstraint, ConstantConstraint, KernelSignature,
                                   CallingConvention, export_kernel)

def f32_1d():
    return ArrayConstraint(ct.float32, 1, index_dtype=ct.int32, stride_lower_bound_incl=0,
                           alias_groups=(), may_alias_internally=False)

sig = KernelSignature([f32_1d(), f32_1d(), f32_1d(), Con
Полный SKILL.md на GitHub

Установить cuda-tile в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл cuda-tile?

CUDA Tile skill for tile-based GPU kernels with cuTile Python and the CUDA Tile C++ API. Use when writing cuTile kernels with ct.load/ct.store/ct.mma, compiling C++ tile kernels with nvcc --enable-tile, exporting Tile IR or cubins ahead of time, choosing between tiles, SIMT CUDA and Triton, or debugging tileiras errors. Activates on queries about CUDA Tile, cuTile, cuda.tile, Tile IR, tileiras, __tile_global__, cuda::tiles, partition_view, ct.kernel, or ct.launch.

Как установить скилл cuda-tile?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл cuda-tile запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить cuda-tile с