npx skills add ...
npx skills add nvidia/skills --skill tilegym-adding-cutile-kernel
Add a new cuTile GPU kernel operator to TileGym. Covers dispatch registration in ops.py, cuTile backend implementation, __init__.py exports, test creation, and benchmark in tests/benchmark. Use when adding, creating, or implementing a new cuTile operator/kernel in TileGym, or when asking how to register a new cuTile op.
npx skills add nvidia/skills --skill tilegym-adding-cutile-kernel
End-to-end workflow for adding a new operator (e.g., my_op) with cuTile backend.
MUST follow these rules strictly:
completed after finishing, in_progress when startingcompleted with a note, do NOT silently skipMUST copy this checklist to TodoWrite at the start:
File: src/tilegym/ops/ops.py
Add a @dispatch function — this is the single entry point for all backends.
Key rules:
NotImplementedError**kwargs for backend-specific parametersReference: See existing ops in src/tilegym/ops/ops.py (e.g., silu_and_mul, softmax)
File: src/tilegym/ops/cutile/my_op.py
The file structure follows this template:
Reference: src/tilegym/ops/cutile/silu_and_mul.py
__init__.py (CRITICAL)Missing this step means the cuTile backend implementation never gets loaded.
File: src/tilegym/ops/cutile/__init__.py
Add inside if is_backend_available("cutile"): block (alphabetically):
And in the function import section:
And add "my_op" to __all__.
File: tests/ops/test_my_op.py
CRITICAL: Always import from tilegym.ops, NEVER from tilegym.ops.cutile.my_op.
Key patterns:
_backends = ["cutile"]test_op: use set_backend(backend) with try-except, call self.setUp()Reference: tests/ops/test_silu_and_mul.py
Below is the common errors.
File: tests/benchmark/bench_my_op.py
Key rules from benchmark_rules.md:
tilegym.ops.my_op(a, b, ..., backend=backend) — do not use set_backend.ALL_BACKENDS (include at least cutile and torch), filter with get_supported_backends().reference_my_op(...) and register it: register_impl("my_op", "torch")(reference_my_op).create_benchmark_config() to build triton.testing.Benchmark configs (e.g. by shape/dtype).@triton.testing.perf_report([...]) on bench_my_op(...); inside the bench function: correctness check with torch.testing.assert_close(fn(), ref(), ...), then ms = triton.testing.do_bench(fn) (or do_bench_cudagraph), compute GB/s or TFLOPS, and return the metric.if __name__ == "__main__": bench_my_op.run(print_data=True).Template structure:
Benchmark Plot Names: Must include -TFLOPS or -GBps suffix
plot_name=f"persistent-layer-norm-M{num_rows}-{dtype_name}-GBps"