converting-cutile-to-julia
Original:🇺🇸 English
Translated
4 scripts
Converts cuTile Python GPU kernels (@ct.kernel) to cuTile.jl Julia equivalents. Handles kernel syntax translation, 0-indexed to 1-indexed conversion, broadcasting differences, memory layout (row-major to column-major), type system mapping, and launch API differences. Use when converting, porting, or translating cuTile Python kernels to Julia cuTile.jl, or debugging/optimizing existing Julia cuTile translations.
8installs
Sourcenvidia/skills
Added on
NPX Install
npx skill4agent add nvidia/skills converting-cutile-to-juliaTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →cuTile Python → cuTile.jl (Julia) Conversion
Convert Python kernels to Julia cuTile.jl kernels.
@ct.kernelfunction ... endWorkflow Selection
- Standard conversion → Full workflow:
translations/workflow.md - Errors (,
MethodError, numerical mismatch) →IRErrorreferences/debugging.md - Quick reference → +
references/api-mapping.mdreferences/critical-rules.md - Test patterns →
references/testing.md
Architecture
Julia kernels are standalone — no Python bridge, no pytest integration. The Julia sub-project
lives in at the repo root with its own for dependency management.
julia/Project.tomljulia/ # Self-contained Julia sub-project
├── Project.toml # Dependencies: CUDA.jl, cuTile.jl, NNlib.jl, Test
├── kernels/ # cuTile.jl kernel implementations
│ ├── add.jl # ← Ground-truth: 1D element-wise with alpha scaling (tensor+tensor, tensor+scalar)
│ ├── matmul.jl # ← Ground-truth: 2D tiled MMA, standard Julia layout (M,K)×(K,N)→(M,N)
│ └── softmax.jl # ← Ground-truth: 3 strategies (TMA, online, chunked) using ct.load/ct.store
└── test/ # Julia-native tests (using Test stdlib)
├── runtests.jl # Test runner entry point
├── test_add.jl
├── test_matmul.jl
└── test_softmax.jlGround-truth reference: Always consult and for patterns that compile and pass tests. These are the canonical examples of working cuTile.jl code.
julia/kernels/*.jljulia/test/*.jlInstructions
- Analyze the Python kernel: identify patterns, shapes, dtypes, operations
- Write Julia kernel — with cuTile.jl kernel + bridge function(s)
julia/kernels/<op>.jl - Convert kernel signature (see Phase 2)
translations/workflow.md - Convert kernel body (apply +
references/api-mapping.md)references/critical-rules.md - Write Julia test — using
julia/test/test_<op>.jlstdlib +Testfor referenceNNlib.jl - Register test — add in
include(...)julia/test/runtests.jl - Validate — run the bundled validator:
python <skill-dir>/scripts/validate_cutile_jl.py <file.jl> - Test — run
julia --project=julia/ julia/test/runtests.jl
Full conversion checklist with post-conversion verification →
translations/workflow.md⚠️ Top Pitfalls
The most dangerous translation errors. Full rules (17 total) in .
references/critical-rules.md| # | Pitfall | One-line fix |
|---|---|---|
| 1 | | Use |
| 2 | | Use |
| 3 | | Compiler bug — file upstream with minimal reproducer |
| 4 | | Args are positional — match kernel signature exactly |
| 5 | | |
Worked Examples
Side-by-side Python → Julia conversions matching the released Julia kernels in . Each directory contains (before) and (after).
julia/kernels/cutile_python.pycutile_julia.jl| # | Example | Key Patterns | When to Reference |
|---|---|---|---|
| 01 | | 1D | Starting point; basic TMA + element-wise patterns |
| 02 | | | MMA / tensor core operations |
| 03 | | Persistent scheduling, | Large-tensor reduction patterns |
These match the released kernels in (, , ). The examples are simplified teaching versions — always consult for the canonical, tested implementations.
julia/kernels/add.jlmatmul.jlsoftmax.jljulia/kernels/*.jlReference Documents
| Category | Document | Content |
|---|---|---|
| Workflows | | Full conversion workflow with todo list, validation loop, checklist |
| Rules | | 17 Critical Rules for cuTile Python → Julia conversion |
| API | | Python↔Julia bidirectional API mapping + kernel patterns |
| Testing | | Julia-native test patterns, tolerances, failure diagnosis |
| Debugging | | Julia-specific error diagnosis + IR debug commands |
| Scripts | | Static validation for Julia anti-patterns (run it) |
| Ground Truth | | Actual working implementations in the codebase |
Environment Setup
Prerequisite — Julia: this skill requires the Julia version declared in under . If is missing or older than that, install from the official Julia site at https://julialang.org/install/ following the verified installer instructions for your OS. Resume below once is compatible.
julia/Project.toml[compat] juliajulia --versionjulia --versionThen, from the repo root:
bash
# Install Julia dependencies declared in julia/Project.toml
julia --project=julia/ -e 'using Pkg; Pkg.instantiate()'
# Run tests
julia --project=julia/ julia/test/runtests.jlRequirements:
- Julia (minimum version declared in under
julia/Project.toml)[compat] julia - CUDA 13.1+ driver
- Blackwell GPU (compute capability 10+)
- Dependencies managed via : CUDA.jl, cuTile.jl, NNlib.jl, Test
julia/Project.toml