tilegym-converting-cutile-to-julia
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
- 01GitHub stars
- 3.8K
- 02Installs
- New
- 03Files scanned
- 13
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 7537d225ea8d8cdc… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
cuTile Python → cuTile.jl (Julia) Conversion
Convert @ct.kernel Python kernels to Julia function ... end cuTile.jl kernels.
Workflow Selection
- Standard conversion → Full workflow:
translations/workflow.md - Errors (
CodegenErrors,MethodError,UndefVarError, numerical mismatch) →references/debugging.md - Quick reference →
references/api-mapping.md+references/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 julia/ at the repo root with its own Project.toml for dependency management.
julia/ # 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.jl
Ground-truth reference: Always consult julia/kernels/*.jl and julia/test/*.jl for patterns that compile and pass tests. These are the canonical examples of working cuTile.jl code.
Instructions
- Analyze the Python kernel: identify patterns, shapes, dtypes, operations
- Write Julia kernel —
julia/kernels/<op>.jlwith cuTile.jl kernel + bridge function(s) - Convert kernel signature (see
translations/workflow.mdPhase 2) - Convert kernel body (apply
references/api-mapping.md+references/critical-rules.md) - Write Julia test —
julia/test/test_<op>.jlusingTeststdlib +NNlib.jlfor reference - Register test — add
include(...)injulia/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 (18 total) in references/critical-rules.md.
| # | Pitfall | One-line fix |
|---|---|---|
| 1 | ct.full() doesn't exist in Julia | Use fill(val, shape), zeros(T, dims...), or ones(T, dims...) |
| 2 | max(a, b) on tiles → CodegenErrors (unsupported isless) | Use max.(a, b) (broadcast dot) |
| 3 | IRError / MethodError mentioning IRStructurizer | Compiler bug — file upstream with minimal reproducer |
| 4 | Launch arg order silently wrong | @cuda backend=cuTile blocks=grid kernel(args...) — args are positional, match kernel signature exactly |
| 5 | ct.max(t, axis=0) → max(...) | Python ct.max is a reduction → maximum(t; dims=1); Julia max is element-wise |
| 6 | ct.load with order — index positions wrong | order remaps BOTH shape AND index (Critical Rule 16) |
| 7 | Kept Python's (M, N) shape → strided loads, 3–8× slower | Reverse dims: Python row-major (M, N) = Julia (N, M); reduce over dims=1 (Critical Rule 7) |
Worked Examples
Side-by-side Python → Julia conversions matching the released Julia kernels in julia/kernels/. Each directory contains cutile_python.py (before) and cutile_julia.jl (after).
| # | Example | Key Patterns | When to Reference |
|---|---|---|---|
| 01 | add | 1D ct.load/ct.store, alpha scaling, scalar broadcast, fill/zeros, keyword load/store | Starting point; basic TMA + element-wise patterns |
| 02 | matmul | muladd, TF32 conversion, K-loop with for, 2D swizzle, standard Julia layout, tile sizes and num_ctas chosen per problem size at launch | MMA / tensor core operations |
| 03 | softmax | Row-major (M, N) → column-major (N, M) layout, persistent scheduling, for loops, gather/scatter, padding_mode, multi-pass | Large-tensor reduction patterns; any per-row Python kernel |
These match the released kernels in julia/kernels/ (add.jl, matmul.jl, softmax.jl). The examples are simplified teaching versions — always consult julia/kernels/*.jl for the canonical, tested implementations.
Reference Documents
| Category | Document | Content |
|---|---|---|
| Workflows | translations/workflow.md | Full conversion workflow with todo list, validation loop, checklist |
| Rules | references/critical-rules.md | 18 Critical Rules for cuTile Python → Julia conversion |
| API | references/api-mapping.md | Python↔Julia bidirectional API mapping + kernel patterns |
| Testing | references/testing.md | Julia-native test patterns, tolerances, failure diagnosis |
| Debugging | references/debugging.md | Julia-specific error diagnosis + IR debug commands |
| Scripts | scripts/validate_cutile_jl.py | Static validation for Julia anti-patterns (run it) |
| Ground Truth | julia/kernels/*.jl + julia/test/*.jl | Actual working implementations in the codebase |
Environment Setup
Prerequisite — Julia: this skill requires the Julia version declared in julia/Project.toml under [compat] julia. If julia --version 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 julia --version is compatible.
Then, from the repo root:
# Install Julia dependencies declared in julia/Project.toml
julia --project=julia/ -e 'using Pkg; Pkg.instantiate()'
# Run tests
julia --project=julia/ julia/test/runtests.jl
Requirements:
- Julia (minimum version declared in
julia/Project.tomlunder[compat] julia) - NVIDIA driver supporting CUDA 13 (r580+); CUDA.jl downloads the toolkit and
tileirasartifacts itself - GPU with compute capability 8.0+ (TileGym CI targets Blackwell)
- Dependencies managed via
julia/Project.toml(versions pinned injulia/Manifest.toml): cuTile.jl 1.x, CUDA.jl 6.3+, NNlib.jl, Test
CUDA versions follow cuTile.jl and CUDA.jl upstream: use the CUDA.jl version cuTile.jl's compat
allows and the toolchain artifacts CUDA.jl selects by default. Do not pin a CUDA toolkit version
(e.g., via LocalPreferences.toml) in this repo.
Kernels are launched with @cuda backend=cuTile blocks=grid kernel(args...), which needs both
using cuTile: cuTile (for the backend=cuTile name) and import cuTile as ct (for the API) —
see julia/kernels/*.jl.
Files
13- BENCHMARK.md
1a35cd61b511.2 KB - SKILL.md
2f8d0329cf7.9 KB - evals/evals.json
6e5e47a8b45.2 KB - examples/01_add/cutile_python.py
fdf0aae91c3.7 KB - examples/02_matmul/cutile_python.py
6ab70da6382.4 KB - examples/03_softmax/cutile_python.py
c5f4d9192f8.5 KB - references/api-mapping.md
0adfc7f6cb21.6 KB - references/critical-rules.md
412d348d596.7 KB - references/debugging.md
cfe2b174bc5.4 KB - references/testing.md
64748fe7e54.6 KB - scripts/validate_cutile_jl.py
016658eeb19.9 KB - skill-card.md
229255794b4.5 KB - translations/workflow.md
567fd669a418.2 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from NVIDIA/skills8
Official NVIDIA-authored guidance for NVIDIA cuDF GPU DataFrames, pandas acceleration, dask-cuDF, ETL, joins, groupby, CSV/Parquet I/O, nullable semantics, and multi-GPU DataFrame workloads.
Use when asked to install, deploy, run, validate, troubleshoot, or stop NVIDIA AI-Q Blueprint infrastructure.
Use when asked to run deep research or AI-Q research through a reachable NVIDIA AI-Q Blueprint backend.
Customize NVIDIA Nemotron Voice Agent's Generic Pipecat example for healthcare appointment, five-field patient intake, or custom tool-calling workflows without a separate backend.
Calibrate a new dataset from live RTSP camera streams via the AutoMagicCalib REST API. Use when the user provides RTSP URLs or asks to calibrate live cameras; VIOS records clips, AMC ingests them, then runs calibration.
Run end-to-end calibration on the shipped sample dataset (sdg_08_2_sample_data_010926.zip) against a running AMC microservice. Use when user says 'test sample dataset', 'run sample calibration', 'verify AMC install', or 'launch and test'.
Calibrates pre-recorded `cam_*.mp4` datasets through the AutoMagicCalib REST API. Use for user-supplied local MP4s; route live RTSP streams to `amc-run-rtsp-calibration`.
Launch AutoMagicCalib microservice and web UI from NGC release images via Docker Compose. Use when user says 'deploy auto calibration', 'launch auto calibration', 'launch AMC', 'start MS+UI', or 'set up auto-magic-calib'. Requires NGC API key.
Related backend skillsscan passed
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Use this when generating RTK Query endpoints from OpenAPI schemas with @rtk-query/codegen-openapi. Covers the empty API pattern, filterEndpoints, endpointOverrides, generated tags, and reviewing generated output before it becomes part of the app.
Report browser/API/CLI/job/worker/webhook bugs. Use for: qa report only, just report bugs, test but dont fix. (gstack)
Build read models and projections from event streams. Use when implementing CQRS read sides, building materialized views, or optimizing query performance in event-sourced systems.
PostHog integration for FastAPI applications
Use when building HTTP servers with Bun.serve, handling requests/responses, implementing routing, creating REST APIs, or configuring fetch handlers.