[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-nvidia-tilegym-adding-cutile-kernel":3,"mdc--k9kuae-key":33,"related-org-nvidia-tilegym-adding-cutile-kernel":2040,"related-repo-nvidia-tilegym-adding-cutile-kernel":2198},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":22,"repoUrl":23,"updatedAt":24,"license":25,"forks":26,"topics":27,"repo":28,"sourceUrl":31,"mdContent":32},"tilegym-adding-cutile-kernel","add cuTile GPU kernel operators","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\u002Fbenchmark. Use when adding, creating, or implementing a new cuTile operator\u002Fkernel in TileGym, or when asking how to register a new cuTile op.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"nvidia","NVIDIA","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fnvidia.png",[12,16,19],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":17,"slug":18,"type":15},"Engineering","engineering",{"name":20,"slug":21,"type":15},"Testing","testing",2473,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills","2026-07-14T05:26:07.548239","CC-BY-4.0 AND Apache-2.0",281,[],{"repoUrl":23,"stars":22,"forks":26,"topics":29,"description":30},[],"AI agent skills published by NVIDIA","https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills\u002Ftree\u002FHEAD\u002Fskills\u002Ftilegym-adding-cutile-kernel","---\nname: tilegym-adding-cutile-kernel\ndescription: 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\u002Fbenchmark. Use when adding, creating, or implementing a new cuTile operator\u002Fkernel in TileGym, or when asking how to register a new cuTile op.\nlicense: CC-BY-4.0 AND Apache-2.0\nmetadata:\n  author: \"TileGym Team \u003CTileGym@nvidia.com>\"\n  tags:\n    - cutile\n    - kernel\n    - tilegym\n    - gpu\n    - dispatch\n---\n\n# Adding a cuTile Kernel to TileGym\n\nEnd-to-end workflow for adding a new operator (e.g., `my_op`) with cuTile backend.\n\n## Execution Rules\n\n**MUST follow these rules strictly:**\n1. Use TodoWrite to create the checklist below BEFORE writing any code\n2. Execute steps **in order** — do NOT skip ahead or combine steps\n3. Mark each todo as `completed` after finishing, `in_progress` when starting\n4. If a step is not applicable (e.g., no cuTile impl), mark it `completed` with a note, do NOT silently skip\n5. Each step MUST result in a file write or explicit skip decision — no silent omissions\n\n## Instructions\n\nMUST copy this checklist to TodoWrite at the start:\n\n```\n- [ ] Step 1: Register dispatch interface in ops.py\n- [ ] Step 2: Implement cuTile backend\n- [ ] Step 3: Register in __init__.py (cutile)\n- [ ] Step 4: Add tests\n- [ ] Step 5: Add benchmark to tests\u002Fbenchmark\n- [ ] Step 6: Verify (run pytest + lint)\n```\n\n## Step 1: Register dispatch interface\n\n**File**: `src\u002Ftilegym\u002Fops\u002Fops.py`\n\nAdd a `@dispatch` function — this is the **single entry point** for all backends.\n\n```python\n@dispatch(\n    \"my_op\",\n)\ndef my_op(\n    input: torch.Tensor,\n    out: Optional[torch.Tensor] = None,\n    **kwargs: Any,\n):\n    \"\"\"\n    Description of my_op.\n\n    Args:\n        input: Input tensor\n        out: Optional preallocated output tensor\n        **kwargs: Additional arguments for backend-specific configurations\n\n    Returns:\n        torch.Tensor\n    \"\"\"\n    raise NotImplementedError(f\"my_op is not implemented for {get_current_backend()}\")\n```\n\n**Key rules:**\n- Function body only raises `NotImplementedError`\n- Include `**kwargs` for backend-specific parameters\n\n**Reference**: See existing ops in `src\u002Ftilegym\u002Fops\u002Fops.py` (e.g., `silu_and_mul`, `softmax`)\n\n## Step 2: Implement cuTile backend\n\n**File**: `src\u002Ftilegym\u002Fops\u002Fcutile\u002Fmy_op.py`\n\nThe file structure follows this template:\n\n```python\nimport torch\nimport cuda.tile as ct\n\nfrom tilegym.backend import register_impl\n\n\n@ct.kernel\ndef my_op_kernel_ct(x, output, n_elements: ct.Constant[int], BLOCK_SIZE: ct.Constant[int]):\n    bid = ct.bid(0)\n    indices = bid * BLOCK_SIZE + ct.arange(0, BLOCK_SIZE)\n    x_val = ct.gather(x, indices)\n    # ... compute ...\n    ct.scatter(output, indices, result)\n\n\n@register_impl(\"my_op\", backend=\"cutile\")\ndef my_op(input: torch.Tensor, out: torch.Tensor = None, **kwargs) -> torch.Tensor:\n    n = input.numel()\n    if out is None:\n        out = torch.empty_like(input)\n    grid = ((n + 1023) \u002F\u002F 1024,)\n    ct.launch(stream, grid, kernel, (some args, ...))\n    return out\n```\n\n**Reference**: `src\u002Ftilegym\u002Fops\u002Fcutile\u002Fsilu_and_mul.py`\n\n## Step 3: Register in `__init__.py` (CRITICAL)\n\nMissing this step means the cuTile backend implementation never gets loaded.\n\n**File**: `src\u002Ftilegym\u002Fops\u002Fcutile\u002F__init__.py`\n\nAdd inside `if is_backend_available(\"cutile\"):` block (alphabetically):\n\n```python\nfrom . import my_op\n```\n\nAnd in the function import section:\n\n```python\nfrom .my_op import my_op\n```\n\nAnd add `\"my_op\"` to `__all__`.\n\n## Step 4: Add tests\n\n**File**: `tests\u002Fops\u002Ftest_my_op.py`\n\n**CRITICAL**: Always import from `tilegym.ops`, NEVER from `tilegym.ops.cutile.my_op`.\n\n```python\nimport pytest\nimport torch\n\nfrom tilegym.backend import is_backend_available, set_backend\nfrom .. import common\n\n_backends = [\"cutile\"]\n\n\nclass Test_MY_OP(common.PyTestCase):\n    @staticmethod\n    def reference(input):\n        \"\"\"Reference implementation using PyTorch.\"\"\"\n        return torch.some_reference(input)\n\n    @pytest.mark.parametrize(\"shape, dtype\", [\n        ((1024,), torch.float16),\n        ((1024, 512), torch.float32),\n        ((64, 64, 64), torch.bfloat16),\n    ])\n    @pytest.mark.parametrize(\"backend\", _backends)\n    def test_op(self, shape, dtype, backend, arch):\n        if backend == \"cutile\" and not is_backend_available(\"cutile\"):\n            pytest.skip(\"Cutile backend not available\")\n        try:\n            set_backend(backend)\n        except Exception as e:\n            pytest.skip(f\"Backend is not supported: {e}\")\n\n        self.setUp()\n\n        from tilegym.ops import my_op\n\n        A = torch.randn(*shape, dtype=dtype, device=\"cuda\")\n        self.assertCorrectness(\n            my_op, self.reference, {\"input\": A},\n            atol=1e-3, rtol=1e-3,\n        )\n```\n\n**Key patterns:**\n- `_backends = [\"cutile\"]`\n- `test_op`: use `set_backend(backend)` with try-except, call `self.setUp()`\n\n**Reference**: `tests\u002Fops\u002Ftest_silu_and_mul.py`\n\nBelow is the common errors.\n```\n1. Missing _backends list (inside class)\n2. test_op \u002F test_op_xxx — missing @pytest.mark.parametrize(\"backend\", _backends), backend parameter, and tilegym.is_backend_available \u002F tilegym.set_backend pattern\n```\n\n## Step 5: Add benchmark to tests\u002Fbenchmark\n\n**File**: `tests\u002Fbenchmark\u002Fbench_my_op.py`\n\n**Key rules from benchmark_rules.md:**\n- Call the op via `tilegym.ops.my_op(a, b, ..., backend=backend)` — do **not** use `set_backend`.\n- Define `ALL_BACKENDS` (include at least `cutile` and `torch`), filter with `get_supported_backends()`.\n- Implement `reference_my_op(...)` and register it: `register_impl(\"my_op\", \"torch\")(reference_my_op)`.\n- Use `create_benchmark_config()` to build `triton.testing.Benchmark` configs (e.g. by shape\u002Fdtype).\n- Use `@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\u002Fs or TFLOPS, and return the metric.\n- Entry point: `if __name__ == \"__main__\": bench_my_op.run(print_data=True)`.\n\nTemplate structure:\n\n```python\nimport torch\nimport triton\nimport triton.testing\n\nimport tilegym\nfrom tilegym.backend import is_backend_available, register_impl\n\nALL_BACKENDS = [\n    (\"cutile\", \"cuTile\", (\"orange\", \"-\")) if is_backend_available(\"cutile\") else None,\n    (\"torch\", \"PyTorch\", (\"green\", \"-\")),\n]\n\ndef get_supported_backends():\n    return [p for p in ALL_BACKENDS if p is not None]\n\ndef reference_my_op(input: torch.Tensor, out: torch.Tensor = None, **kwargs):\n    \"\"\"Reference implementation using PyTorch.\"\"\"\n    ...\n\nregister_impl(\"my_op\", \"torch\")(reference_my_op)\n\ndef create_benchmark_config(datatype, ...):\n    available_backends = get_supported_backends()\n    if not available_backends:\n        return None\n    backends, names, styles = zip(*available_backends)\n    return triton.testing.Benchmark(\n        x_names=[\"M\"],  # or other dimension names\n        x_vals=[...],\n        line_arg=\"backend\",\n        line_vals=list(backends),\n        line_names=list(names),\n        styles=list(styles),\n        ylabel=\"GB\u002Fs\",  # or TFLOPS\n        plot_name=\"my-op-...\",\n        args={\"datatype\": datatype, ...},\n    )\n\n@triton.testing.perf_report([\n    create_benchmark_config(datatype, ...)\n    for datatype in [torch.float16, torch.float32]\n    for ... in [...]\n])\ndef bench_my_op(M, backend, datatype, ..., device=\"cuda\"):\n    x = torch.randn(..., dtype=datatype, device=device)\n\n    fn = lambda: tilegym.ops.my_op(x, backend=backend)\n    ref = lambda: reference_my_op(x)\n    torch.testing.assert_close(fn(), ref(), rtol=1e-2, atol=1e-2)\n\n    ms = triton.testing.do_bench(fn)  # or do_bench_cudagraph(fn)\n    # Compute metric (e.g. GB\u002Fs or TFLOPS) from ms and problem size\n    return metric\n\nif __name__ == \"__main__\":\n    bench_my_op.run(print_data=True)\n```\n\n**Benchmark Plot Names**: Must include `-TFLOPS` or `-GBps` suffix\n  - Example: `plot_name=f\"persistent-layer-norm-M{num_rows}-{dtype_name}-GBps\"`\n\n## Step 6: Verify\n\n```bash\n# Run tests\npytest tests\u002Fops\u002Ftest_my_op.py -v\n\n# Run benchmark (optional)\npython tests\u002Fbenchmark\u002Fbench_my_op.py\n\n# Lint\npre-commit run -a\n```\n",{"data":34,"body":43},{"name":4,"description":6,"license":25,"metadata":35},{"author":36,"tags":37},"TileGym Team \u003CTileGym@nvidia.com>",[38,39,40,41,42],"cutile","kernel","tilegym","gpu","dispatch",{"type":44,"children":45},"root",[46,55,70,77,86,146,152,157,169,175,191,211,401,409,437,470,476,490,495,684,698,712,717,731,744,758,763,777,798,804,818,843,1160,1168,1205,1219,1224,1233,1239,1253,1261,1423,1428,1890,1916,1930,1936,2034],{"type":47,"tag":48,"props":49,"children":51},"element","h1",{"id":50},"adding-a-cutile-kernel-to-tilegym",[52],{"type":53,"value":54},"text","Adding a cuTile Kernel to TileGym",{"type":47,"tag":56,"props":57,"children":58},"p",{},[59,61,68],{"type":53,"value":60},"End-to-end workflow for adding a new operator (e.g., ",{"type":47,"tag":62,"props":63,"children":65},"code",{"className":64},[],[66],{"type":53,"value":67},"my_op",{"type":53,"value":69},") with cuTile backend.",{"type":47,"tag":71,"props":72,"children":74},"h2",{"id":73},"execution-rules",[75],{"type":53,"value":76},"Execution Rules",{"type":47,"tag":56,"props":78,"children":79},{},[80],{"type":47,"tag":81,"props":82,"children":83},"strong",{},[84],{"type":53,"value":85},"MUST follow these rules strictly:",{"type":47,"tag":87,"props":88,"children":89},"ol",{},[90,96,108,129,141],{"type":47,"tag":91,"props":92,"children":93},"li",{},[94],{"type":53,"value":95},"Use TodoWrite to create the checklist below BEFORE writing any code",{"type":47,"tag":91,"props":97,"children":98},{},[99,101,106],{"type":53,"value":100},"Execute steps ",{"type":47,"tag":81,"props":102,"children":103},{},[104],{"type":53,"value":105},"in order",{"type":53,"value":107}," — do NOT skip ahead or combine steps",{"type":47,"tag":91,"props":109,"children":110},{},[111,113,119,121,127],{"type":53,"value":112},"Mark each todo as ",{"type":47,"tag":62,"props":114,"children":116},{"className":115},[],[117],{"type":53,"value":118},"completed",{"type":53,"value":120}," after finishing, ",{"type":47,"tag":62,"props":122,"children":124},{"className":123},[],[125],{"type":53,"value":126},"in_progress",{"type":53,"value":128}," when starting",{"type":47,"tag":91,"props":130,"children":131},{},[132,134,139],{"type":53,"value":133},"If a step is not applicable (e.g., no cuTile impl), mark it ",{"type":47,"tag":62,"props":135,"children":137},{"className":136},[],[138],{"type":53,"value":118},{"type":53,"value":140}," with a note, do NOT silently skip",{"type":47,"tag":91,"props":142,"children":143},{},[144],{"type":53,"value":145},"Each step MUST result in a file write or explicit skip decision — no silent omissions",{"type":47,"tag":71,"props":147,"children":149},{"id":148},"instructions",[150],{"type":53,"value":151},"Instructions",{"type":47,"tag":56,"props":153,"children":154},{},[155],{"type":53,"value":156},"MUST copy this checklist to TodoWrite at the start:",{"type":47,"tag":158,"props":159,"children":163},"pre",{"className":160,"code":162,"language":53},[161],"language-text","- [ ] Step 1: Register dispatch interface in ops.py\n- [ ] Step 2: Implement cuTile backend\n- [ ] Step 3: Register in __init__.py (cutile)\n- [ ] Step 4: Add tests\n- [ ] Step 5: Add benchmark to tests\u002Fbenchmark\n- [ ] Step 6: Verify (run pytest + lint)\n",[164],{"type":47,"tag":62,"props":165,"children":167},{"__ignoreMap":166},"",[168],{"type":53,"value":162},{"type":47,"tag":71,"props":170,"children":172},{"id":171},"step-1-register-dispatch-interface",[173],{"type":53,"value":174},"Step 1: Register dispatch interface",{"type":47,"tag":56,"props":176,"children":177},{},[178,183,185],{"type":47,"tag":81,"props":179,"children":180},{},[181],{"type":53,"value":182},"File",{"type":53,"value":184},": ",{"type":47,"tag":62,"props":186,"children":188},{"className":187},[],[189],{"type":53,"value":190},"src\u002Ftilegym\u002Fops\u002Fops.py",{"type":47,"tag":56,"props":192,"children":193},{},[194,196,202,204,209],{"type":53,"value":195},"Add a ",{"type":47,"tag":62,"props":197,"children":199},{"className":198},[],[200],{"type":53,"value":201},"@dispatch",{"type":53,"value":203}," function — this is the ",{"type":47,"tag":81,"props":205,"children":206},{},[207],{"type":53,"value":208},"single entry point",{"type":53,"value":210}," for all backends.",{"type":47,"tag":158,"props":212,"children":216},{"className":213,"code":214,"language":215,"meta":166,"style":166},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","@dispatch(\n    \"my_op\",\n)\ndef my_op(\n    input: torch.Tensor,\n    out: Optional[torch.Tensor] = None,\n    **kwargs: Any,\n):\n    \"\"\"\n    Description of my_op.\n\n    Args:\n        input: Input tensor\n        out: Optional preallocated output tensor\n        **kwargs: Additional arguments for backend-specific configurations\n\n    Returns:\n        torch.Tensor\n    \"\"\"\n    raise NotImplementedError(f\"my_op is not implemented for {get_current_backend()}\")\n","python",[217],{"type":47,"tag":62,"props":218,"children":219},{"__ignoreMap":166},[220,231,240,249,258,267,276,285,294,303,312,322,331,340,349,358,366,375,384,392],{"type":47,"tag":221,"props":222,"children":225},"span",{"class":223,"line":224},"line",1,[226],{"type":47,"tag":221,"props":227,"children":228},{},[229],{"type":53,"value":230},"@dispatch(\n",{"type":47,"tag":221,"props":232,"children":234},{"class":223,"line":233},2,[235],{"type":47,"tag":221,"props":236,"children":237},{},[238],{"type":53,"value":239},"    \"my_op\",\n",{"type":47,"tag":221,"props":241,"children":243},{"class":223,"line":242},3,[244],{"type":47,"tag":221,"props":245,"children":246},{},[247],{"type":53,"value":248},")\n",{"type":47,"tag":221,"props":250,"children":252},{"class":223,"line":251},4,[253],{"type":47,"tag":221,"props":254,"children":255},{},[256],{"type":53,"value":257},"def my_op(\n",{"type":47,"tag":221,"props":259,"children":261},{"class":223,"line":260},5,[262],{"type":47,"tag":221,"props":263,"children":264},{},[265],{"type":53,"value":266},"    input: torch.Tensor,\n",{"type":47,"tag":221,"props":268,"children":270},{"class":223,"line":269},6,[271],{"type":47,"tag":221,"props":272,"children":273},{},[274],{"type":53,"value":275},"    out: Optional[torch.Tensor] = None,\n",{"type":47,"tag":221,"props":277,"children":279},{"class":223,"line":278},7,[280],{"type":47,"tag":221,"props":281,"children":282},{},[283],{"type":53,"value":284},"    **kwargs: Any,\n",{"type":47,"tag":221,"props":286,"children":288},{"class":223,"line":287},8,[289],{"type":47,"tag":221,"props":290,"children":291},{},[292],{"type":53,"value":293},"):\n",{"type":47,"tag":221,"props":295,"children":297},{"class":223,"line":296},9,[298],{"type":47,"tag":221,"props":299,"children":300},{},[301],{"type":53,"value":302},"    \"\"\"\n",{"type":47,"tag":221,"props":304,"children":306},{"class":223,"line":305},10,[307],{"type":47,"tag":221,"props":308,"children":309},{},[310],{"type":53,"value":311},"    Description of my_op.\n",{"type":47,"tag":221,"props":313,"children":315},{"class":223,"line":314},11,[316],{"type":47,"tag":221,"props":317,"children":319},{"emptyLinePlaceholder":318},true,[320],{"type":53,"value":321},"\n",{"type":47,"tag":221,"props":323,"children":325},{"class":223,"line":324},12,[326],{"type":47,"tag":221,"props":327,"children":328},{},[329],{"type":53,"value":330},"    Args:\n",{"type":47,"tag":221,"props":332,"children":334},{"class":223,"line":333},13,[335],{"type":47,"tag":221,"props":336,"children":337},{},[338],{"type":53,"value":339},"        input: Input tensor\n",{"type":47,"tag":221,"props":341,"children":343},{"class":223,"line":342},14,[344],{"type":47,"tag":221,"props":345,"children":346},{},[347],{"type":53,"value":348},"        out: Optional preallocated output tensor\n",{"type":47,"tag":221,"props":350,"children":352},{"class":223,"line":351},15,[353],{"type":47,"tag":221,"props":354,"children":355},{},[356],{"type":53,"value":357},"        **kwargs: Additional arguments for backend-specific configurations\n",{"type":47,"tag":221,"props":359,"children":361},{"class":223,"line":360},16,[362],{"type":47,"tag":221,"props":363,"children":364},{"emptyLinePlaceholder":318},[365],{"type":53,"value":321},{"type":47,"tag":221,"props":367,"children":369},{"class":223,"line":368},17,[370],{"type":47,"tag":221,"props":371,"children":372},{},[373],{"type":53,"value":374},"    Returns:\n",{"type":47,"tag":221,"props":376,"children":378},{"class":223,"line":377},18,[379],{"type":47,"tag":221,"props":380,"children":381},{},[382],{"type":53,"value":383},"        torch.Tensor\n",{"type":47,"tag":221,"props":385,"children":387},{"class":223,"line":386},19,[388],{"type":47,"tag":221,"props":389,"children":390},{},[391],{"type":53,"value":302},{"type":47,"tag":221,"props":393,"children":395},{"class":223,"line":394},20,[396],{"type":47,"tag":221,"props":397,"children":398},{},[399],{"type":53,"value":400},"    raise NotImplementedError(f\"my_op is not implemented for {get_current_backend()}\")\n",{"type":47,"tag":56,"props":402,"children":403},{},[404],{"type":47,"tag":81,"props":405,"children":406},{},[407],{"type":53,"value":408},"Key rules:",{"type":47,"tag":410,"props":411,"children":412},"ul",{},[413,424],{"type":47,"tag":91,"props":414,"children":415},{},[416,418],{"type":53,"value":417},"Function body only raises ",{"type":47,"tag":62,"props":419,"children":421},{"className":420},[],[422],{"type":53,"value":423},"NotImplementedError",{"type":47,"tag":91,"props":425,"children":426},{},[427,429,435],{"type":53,"value":428},"Include ",{"type":47,"tag":62,"props":430,"children":432},{"className":431},[],[433],{"type":53,"value":434},"**kwargs",{"type":53,"value":436}," for backend-specific parameters",{"type":47,"tag":56,"props":438,"children":439},{},[440,445,447,452,454,460,462,468],{"type":47,"tag":81,"props":441,"children":442},{},[443],{"type":53,"value":444},"Reference",{"type":53,"value":446},": See existing ops in ",{"type":47,"tag":62,"props":448,"children":450},{"className":449},[],[451],{"type":53,"value":190},{"type":53,"value":453}," (e.g., ",{"type":47,"tag":62,"props":455,"children":457},{"className":456},[],[458],{"type":53,"value":459},"silu_and_mul",{"type":53,"value":461},", ",{"type":47,"tag":62,"props":463,"children":465},{"className":464},[],[466],{"type":53,"value":467},"softmax",{"type":53,"value":469},")",{"type":47,"tag":71,"props":471,"children":473},{"id":472},"step-2-implement-cutile-backend",[474],{"type":53,"value":475},"Step 2: Implement cuTile backend",{"type":47,"tag":56,"props":477,"children":478},{},[479,483,484],{"type":47,"tag":81,"props":480,"children":481},{},[482],{"type":53,"value":182},{"type":53,"value":184},{"type":47,"tag":62,"props":485,"children":487},{"className":486},[],[488],{"type":53,"value":489},"src\u002Ftilegym\u002Fops\u002Fcutile\u002Fmy_op.py",{"type":47,"tag":56,"props":491,"children":492},{},[493],{"type":53,"value":494},"The file structure follows this template:",{"type":47,"tag":158,"props":496,"children":498},{"className":213,"code":497,"language":215,"meta":166,"style":166},"import torch\nimport cuda.tile as ct\n\nfrom tilegym.backend import register_impl\n\n\n@ct.kernel\ndef my_op_kernel_ct(x, output, n_elements: ct.Constant[int], BLOCK_SIZE: ct.Constant[int]):\n    bid = ct.bid(0)\n    indices = bid * BLOCK_SIZE + ct.arange(0, BLOCK_SIZE)\n    x_val = ct.gather(x, indices)\n    # ... compute ...\n    ct.scatter(output, indices, result)\n\n\n@register_impl(\"my_op\", backend=\"cutile\")\ndef my_op(input: torch.Tensor, out: torch.Tensor = None, **kwargs) -> torch.Tensor:\n    n = input.numel()\n    if out is None:\n        out = torch.empty_like(input)\n    grid = ((n + 1023) \u002F\u002F 1024,)\n    ct.launch(stream, grid, kernel, (some args, ...))\n    return out\n",[499],{"type":47,"tag":62,"props":500,"children":501},{"__ignoreMap":166},[502,510,518,525,533,540,547,555,563,571,579,587,595,603,610,617,625,633,641,649,657,666,675],{"type":47,"tag":221,"props":503,"children":504},{"class":223,"line":224},[505],{"type":47,"tag":221,"props":506,"children":507},{},[508],{"type":53,"value":509},"import torch\n",{"type":47,"tag":221,"props":511,"children":512},{"class":223,"line":233},[513],{"type":47,"tag":221,"props":514,"children":515},{},[516],{"type":53,"value":517},"import cuda.tile as ct\n",{"type":47,"tag":221,"props":519,"children":520},{"class":223,"line":242},[521],{"type":47,"tag":221,"props":522,"children":523},{"emptyLinePlaceholder":318},[524],{"type":53,"value":321},{"type":47,"tag":221,"props":526,"children":527},{"class":223,"line":251},[528],{"type":47,"tag":221,"props":529,"children":530},{},[531],{"type":53,"value":532},"from tilegym.backend import register_impl\n",{"type":47,"tag":221,"props":534,"children":535},{"class":223,"line":260},[536],{"type":47,"tag":221,"props":537,"children":538},{"emptyLinePlaceholder":318},[539],{"type":53,"value":321},{"type":47,"tag":221,"props":541,"children":542},{"class":223,"line":269},[543],{"type":47,"tag":221,"props":544,"children":545},{"emptyLinePlaceholder":318},[546],{"type":53,"value":321},{"type":47,"tag":221,"props":548,"children":549},{"class":223,"line":278},[550],{"type":47,"tag":221,"props":551,"children":552},{},[553],{"type":53,"value":554},"@ct.kernel\n",{"type":47,"tag":221,"props":556,"children":557},{"class":223,"line":287},[558],{"type":47,"tag":221,"props":559,"children":560},{},[561],{"type":53,"value":562},"def my_op_kernel_ct(x, output, n_elements: ct.Constant[int], BLOCK_SIZE: ct.Constant[int]):\n",{"type":47,"tag":221,"props":564,"children":565},{"class":223,"line":296},[566],{"type":47,"tag":221,"props":567,"children":568},{},[569],{"type":53,"value":570},"    bid = ct.bid(0)\n",{"type":47,"tag":221,"props":572,"children":573},{"class":223,"line":305},[574],{"type":47,"tag":221,"props":575,"children":576},{},[577],{"type":53,"value":578},"    indices = bid * BLOCK_SIZE + ct.arange(0, BLOCK_SIZE)\n",{"type":47,"tag":221,"props":580,"children":581},{"class":223,"line":314},[582],{"type":47,"tag":221,"props":583,"children":584},{},[585],{"type":53,"value":586},"    x_val = ct.gather(x, indices)\n",{"type":47,"tag":221,"props":588,"children":589},{"class":223,"line":324},[590],{"type":47,"tag":221,"props":591,"children":592},{},[593],{"type":53,"value":594},"    # ... compute ...\n",{"type":47,"tag":221,"props":596,"children":597},{"class":223,"line":333},[598],{"type":47,"tag":221,"props":599,"children":600},{},[601],{"type":53,"value":602},"    ct.scatter(output, indices, result)\n",{"type":47,"tag":221,"props":604,"children":605},{"class":223,"line":342},[606],{"type":47,"tag":221,"props":607,"children":608},{"emptyLinePlaceholder":318},[609],{"type":53,"value":321},{"type":47,"tag":221,"props":611,"children":612},{"class":223,"line":351},[613],{"type":47,"tag":221,"props":614,"children":615},{"emptyLinePlaceholder":318},[616],{"type":53,"value":321},{"type":47,"tag":221,"props":618,"children":619},{"class":223,"line":360},[620],{"type":47,"tag":221,"props":621,"children":622},{},[623],{"type":53,"value":624},"@register_impl(\"my_op\", backend=\"cutile\")\n",{"type":47,"tag":221,"props":626,"children":627},{"class":223,"line":368},[628],{"type":47,"tag":221,"props":629,"children":630},{},[631],{"type":53,"value":632},"def my_op(input: torch.Tensor, out: torch.Tensor = None, **kwargs) -> torch.Tensor:\n",{"type":47,"tag":221,"props":634,"children":635},{"class":223,"line":377},[636],{"type":47,"tag":221,"props":637,"children":638},{},[639],{"type":53,"value":640},"    n = input.numel()\n",{"type":47,"tag":221,"props":642,"children":643},{"class":223,"line":386},[644],{"type":47,"tag":221,"props":645,"children":646},{},[647],{"type":53,"value":648},"    if out is None:\n",{"type":47,"tag":221,"props":650,"children":651},{"class":223,"line":394},[652],{"type":47,"tag":221,"props":653,"children":654},{},[655],{"type":53,"value":656},"        out = torch.empty_like(input)\n",{"type":47,"tag":221,"props":658,"children":660},{"class":223,"line":659},21,[661],{"type":47,"tag":221,"props":662,"children":663},{},[664],{"type":53,"value":665},"    grid = ((n + 1023) \u002F\u002F 1024,)\n",{"type":47,"tag":221,"props":667,"children":669},{"class":223,"line":668},22,[670],{"type":47,"tag":221,"props":671,"children":672},{},[673],{"type":53,"value":674},"    ct.launch(stream, grid, kernel, (some args, ...))\n",{"type":47,"tag":221,"props":676,"children":678},{"class":223,"line":677},23,[679],{"type":47,"tag":221,"props":680,"children":681},{},[682],{"type":53,"value":683},"    return out\n",{"type":47,"tag":56,"props":685,"children":686},{},[687,691,692],{"type":47,"tag":81,"props":688,"children":689},{},[690],{"type":53,"value":444},{"type":53,"value":184},{"type":47,"tag":62,"props":693,"children":695},{"className":694},[],[696],{"type":53,"value":697},"src\u002Ftilegym\u002Fops\u002Fcutile\u002Fsilu_and_mul.py",{"type":47,"tag":71,"props":699,"children":701},{"id":700},"step-3-register-in-__init__py-critical",[702,704,710],{"type":53,"value":703},"Step 3: Register in ",{"type":47,"tag":62,"props":705,"children":707},{"className":706},[],[708],{"type":53,"value":709},"__init__.py",{"type":53,"value":711}," (CRITICAL)",{"type":47,"tag":56,"props":713,"children":714},{},[715],{"type":53,"value":716},"Missing this step means the cuTile backend implementation never gets loaded.",{"type":47,"tag":56,"props":718,"children":719},{},[720,724,725],{"type":47,"tag":81,"props":721,"children":722},{},[723],{"type":53,"value":182},{"type":53,"value":184},{"type":47,"tag":62,"props":726,"children":728},{"className":727},[],[729],{"type":53,"value":730},"src\u002Ftilegym\u002Fops\u002Fcutile\u002F__init__.py",{"type":47,"tag":56,"props":732,"children":733},{},[734,736,742],{"type":53,"value":735},"Add inside ",{"type":47,"tag":62,"props":737,"children":739},{"className":738},[],[740],{"type":53,"value":741},"if is_backend_available(\"cutile\"):",{"type":53,"value":743}," block (alphabetically):",{"type":47,"tag":158,"props":745,"children":747},{"className":213,"code":746,"language":215,"meta":166,"style":166},"from . import my_op\n",[748],{"type":47,"tag":62,"props":749,"children":750},{"__ignoreMap":166},[751],{"type":47,"tag":221,"props":752,"children":753},{"class":223,"line":224},[754],{"type":47,"tag":221,"props":755,"children":756},{},[757],{"type":53,"value":746},{"type":47,"tag":56,"props":759,"children":760},{},[761],{"type":53,"value":762},"And in the function import section:",{"type":47,"tag":158,"props":764,"children":766},{"className":213,"code":765,"language":215,"meta":166,"style":166},"from .my_op import my_op\n",[767],{"type":47,"tag":62,"props":768,"children":769},{"__ignoreMap":166},[770],{"type":47,"tag":221,"props":771,"children":772},{"class":223,"line":224},[773],{"type":47,"tag":221,"props":774,"children":775},{},[776],{"type":53,"value":765},{"type":47,"tag":56,"props":778,"children":779},{},[780,782,788,790,796],{"type":53,"value":781},"And add ",{"type":47,"tag":62,"props":783,"children":785},{"className":784},[],[786],{"type":53,"value":787},"\"my_op\"",{"type":53,"value":789}," to ",{"type":47,"tag":62,"props":791,"children":793},{"className":792},[],[794],{"type":53,"value":795},"__all__",{"type":53,"value":797},".",{"type":47,"tag":71,"props":799,"children":801},{"id":800},"step-4-add-tests",[802],{"type":53,"value":803},"Step 4: Add tests",{"type":47,"tag":56,"props":805,"children":806},{},[807,811,812],{"type":47,"tag":81,"props":808,"children":809},{},[810],{"type":53,"value":182},{"type":53,"value":184},{"type":47,"tag":62,"props":813,"children":815},{"className":814},[],[816],{"type":53,"value":817},"tests\u002Fops\u002Ftest_my_op.py",{"type":47,"tag":56,"props":819,"children":820},{},[821,826,828,834,836,842],{"type":47,"tag":81,"props":822,"children":823},{},[824],{"type":53,"value":825},"CRITICAL",{"type":53,"value":827},": Always import from ",{"type":47,"tag":62,"props":829,"children":831},{"className":830},[],[832],{"type":53,"value":833},"tilegym.ops",{"type":53,"value":835},", NEVER from ",{"type":47,"tag":62,"props":837,"children":839},{"className":838},[],[840],{"type":53,"value":841},"tilegym.ops.cutile.my_op",{"type":53,"value":797},{"type":47,"tag":158,"props":844,"children":846},{"className":213,"code":845,"language":215,"meta":166,"style":166},"import pytest\nimport torch\n\nfrom tilegym.backend import is_backend_available, set_backend\nfrom .. import common\n\n_backends = [\"cutile\"]\n\n\nclass Test_MY_OP(common.PyTestCase):\n    @staticmethod\n    def reference(input):\n        \"\"\"Reference implementation using PyTorch.\"\"\"\n        return torch.some_reference(input)\n\n    @pytest.mark.parametrize(\"shape, dtype\", [\n        ((1024,), torch.float16),\n        ((1024, 512), torch.float32),\n        ((64, 64, 64), torch.bfloat16),\n    ])\n    @pytest.mark.parametrize(\"backend\", _backends)\n    def test_op(self, shape, dtype, backend, arch):\n        if backend == \"cutile\" and not is_backend_available(\"cutile\"):\n            pytest.skip(\"Cutile backend not available\")\n        try:\n            set_backend(backend)\n        except Exception as e:\n            pytest.skip(f\"Backend is not supported: {e}\")\n\n        self.setUp()\n\n        from tilegym.ops import my_op\n\n        A = torch.randn(*shape, dtype=dtype, device=\"cuda\")\n        self.assertCorrectness(\n            my_op, self.reference, {\"input\": A},\n            atol=1e-3, rtol=1e-3,\n        )\n",[847],{"type":47,"tag":62,"props":848,"children":849},{"__ignoreMap":166},[850,858,865,872,880,888,895,903,910,917,925,933,941,949,957,964,972,980,988,996,1004,1012,1020,1028,1037,1046,1055,1064,1073,1081,1090,1098,1107,1115,1124,1133,1142,1151],{"type":47,"tag":221,"props":851,"children":852},{"class":223,"line":224},[853],{"type":47,"tag":221,"props":854,"children":855},{},[856],{"type":53,"value":857},"import pytest\n",{"type":47,"tag":221,"props":859,"children":860},{"class":223,"line":233},[861],{"type":47,"tag":221,"props":862,"children":863},{},[864],{"type":53,"value":509},{"type":47,"tag":221,"props":866,"children":867},{"class":223,"line":242},[868],{"type":47,"tag":221,"props":869,"children":870},{"emptyLinePlaceholder":318},[871],{"type":53,"value":321},{"type":47,"tag":221,"props":873,"children":874},{"class":223,"line":251},[875],{"type":47,"tag":221,"props":876,"children":877},{},[878],{"type":53,"value":879},"from tilegym.backend import is_backend_available, set_backend\n",{"type":47,"tag":221,"props":881,"children":882},{"class":223,"line":260},[883],{"type":47,"tag":221,"props":884,"children":885},{},[886],{"type":53,"value":887},"from .. import common\n",{"type":47,"tag":221,"props":889,"children":890},{"class":223,"line":269},[891],{"type":47,"tag":221,"props":892,"children":893},{"emptyLinePlaceholder":318},[894],{"type":53,"value":321},{"type":47,"tag":221,"props":896,"children":897},{"class":223,"line":278},[898],{"type":47,"tag":221,"props":899,"children":900},{},[901],{"type":53,"value":902},"_backends = [\"cutile\"]\n",{"type":47,"tag":221,"props":904,"children":905},{"class":223,"line":287},[906],{"type":47,"tag":221,"props":907,"children":908},{"emptyLinePlaceholder":318},[909],{"type":53,"value":321},{"type":47,"tag":221,"props":911,"children":912},{"class":223,"line":296},[913],{"type":47,"tag":221,"props":914,"children":915},{"emptyLinePlaceholder":318},[916],{"type":53,"value":321},{"type":47,"tag":221,"props":918,"children":919},{"class":223,"line":305},[920],{"type":47,"tag":221,"props":921,"children":922},{},[923],{"type":53,"value":924},"class Test_MY_OP(common.PyTestCase):\n",{"type":47,"tag":221,"props":926,"children":927},{"class":223,"line":314},[928],{"type":47,"tag":221,"props":929,"children":930},{},[931],{"type":53,"value":932},"    @staticmethod\n",{"type":47,"tag":221,"props":934,"children":935},{"class":223,"line":324},[936],{"type":47,"tag":221,"props":937,"children":938},{},[939],{"type":53,"value":940},"    def reference(input):\n",{"type":47,"tag":221,"props":942,"children":943},{"class":223,"line":333},[944],{"type":47,"tag":221,"props":945,"children":946},{},[947],{"type":53,"value":948},"        \"\"\"Reference implementation using PyTorch.\"\"\"\n",{"type":47,"tag":221,"props":950,"children":951},{"class":223,"line":342},[952],{"type":47,"tag":221,"props":953,"children":954},{},[955],{"type":53,"value":956},"        return torch.some_reference(input)\n",{"type":47,"tag":221,"props":958,"children":959},{"class":223,"line":351},[960],{"type":47,"tag":221,"props":961,"children":962},{"emptyLinePlaceholder":318},[963],{"type":53,"value":321},{"type":47,"tag":221,"props":965,"children":966},{"class":223,"line":360},[967],{"type":47,"tag":221,"props":968,"children":969},{},[970],{"type":53,"value":971},"    @pytest.mark.parametrize(\"shape, dtype\", [\n",{"type":47,"tag":221,"props":973,"children":974},{"class":223,"line":368},[975],{"type":47,"tag":221,"props":976,"children":977},{},[978],{"type":53,"value":979},"        ((1024,), torch.float16),\n",{"type":47,"tag":221,"props":981,"children":982},{"class":223,"line":377},[983],{"type":47,"tag":221,"props":984,"children":985},{},[986],{"type":53,"value":987},"        ((1024, 512), torch.float32),\n",{"type":47,"tag":221,"props":989,"children":990},{"class":223,"line":386},[991],{"type":47,"tag":221,"props":992,"children":993},{},[994],{"type":53,"value":995},"        ((64, 64, 64), torch.bfloat16),\n",{"type":47,"tag":221,"props":997,"children":998},{"class":223,"line":394},[999],{"type":47,"tag":221,"props":1000,"children":1001},{},[1002],{"type":53,"value":1003},"    ])\n",{"type":47,"tag":221,"props":1005,"children":1006},{"class":223,"line":659},[1007],{"type":47,"tag":221,"props":1008,"children":1009},{},[1010],{"type":53,"value":1011},"    @pytest.mark.parametrize(\"backend\", _backends)\n",{"type":47,"tag":221,"props":1013,"children":1014},{"class":223,"line":668},[1015],{"type":47,"tag":221,"props":1016,"children":1017},{},[1018],{"type":53,"value":1019},"    def test_op(self, shape, dtype, backend, arch):\n",{"type":47,"tag":221,"props":1021,"children":1022},{"class":223,"line":677},[1023],{"type":47,"tag":221,"props":1024,"children":1025},{},[1026],{"type":53,"value":1027},"        if backend == \"cutile\" and not is_backend_available(\"cutile\"):\n",{"type":47,"tag":221,"props":1029,"children":1031},{"class":223,"line":1030},24,[1032],{"type":47,"tag":221,"props":1033,"children":1034},{},[1035],{"type":53,"value":1036},"            pytest.skip(\"Cutile backend not available\")\n",{"type":47,"tag":221,"props":1038,"children":1040},{"class":223,"line":1039},25,[1041],{"type":47,"tag":221,"props":1042,"children":1043},{},[1044],{"type":53,"value":1045},"        try:\n",{"type":47,"tag":221,"props":1047,"children":1049},{"class":223,"line":1048},26,[1050],{"type":47,"tag":221,"props":1051,"children":1052},{},[1053],{"type":53,"value":1054},"            set_backend(backend)\n",{"type":47,"tag":221,"props":1056,"children":1058},{"class":223,"line":1057},27,[1059],{"type":47,"tag":221,"props":1060,"children":1061},{},[1062],{"type":53,"value":1063},"        except Exception as e:\n",{"type":47,"tag":221,"props":1065,"children":1067},{"class":223,"line":1066},28,[1068],{"type":47,"tag":221,"props":1069,"children":1070},{},[1071],{"type":53,"value":1072},"            pytest.skip(f\"Backend is not supported: {e}\")\n",{"type":47,"tag":221,"props":1074,"children":1076},{"class":223,"line":1075},29,[1077],{"type":47,"tag":221,"props":1078,"children":1079},{"emptyLinePlaceholder":318},[1080],{"type":53,"value":321},{"type":47,"tag":221,"props":1082,"children":1084},{"class":223,"line":1083},30,[1085],{"type":47,"tag":221,"props":1086,"children":1087},{},[1088],{"type":53,"value":1089},"        self.setUp()\n",{"type":47,"tag":221,"props":1091,"children":1093},{"class":223,"line":1092},31,[1094],{"type":47,"tag":221,"props":1095,"children":1096},{"emptyLinePlaceholder":318},[1097],{"type":53,"value":321},{"type":47,"tag":221,"props":1099,"children":1101},{"class":223,"line":1100},32,[1102],{"type":47,"tag":221,"props":1103,"children":1104},{},[1105],{"type":53,"value":1106},"        from tilegym.ops import my_op\n",{"type":47,"tag":221,"props":1108,"children":1110},{"class":223,"line":1109},33,[1111],{"type":47,"tag":221,"props":1112,"children":1113},{"emptyLinePlaceholder":318},[1114],{"type":53,"value":321},{"type":47,"tag":221,"props":1116,"children":1118},{"class":223,"line":1117},34,[1119],{"type":47,"tag":221,"props":1120,"children":1121},{},[1122],{"type":53,"value":1123},"        A = torch.randn(*shape, dtype=dtype, device=\"cuda\")\n",{"type":47,"tag":221,"props":1125,"children":1127},{"class":223,"line":1126},35,[1128],{"type":47,"tag":221,"props":1129,"children":1130},{},[1131],{"type":53,"value":1132},"        self.assertCorrectness(\n",{"type":47,"tag":221,"props":1134,"children":1136},{"class":223,"line":1135},36,[1137],{"type":47,"tag":221,"props":1138,"children":1139},{},[1140],{"type":53,"value":1141},"            my_op, self.reference, {\"input\": A},\n",{"type":47,"tag":221,"props":1143,"children":1145},{"class":223,"line":1144},37,[1146],{"type":47,"tag":221,"props":1147,"children":1148},{},[1149],{"type":53,"value":1150},"            atol=1e-3, rtol=1e-3,\n",{"type":47,"tag":221,"props":1152,"children":1154},{"class":223,"line":1153},38,[1155],{"type":47,"tag":221,"props":1156,"children":1157},{},[1158],{"type":53,"value":1159},"        )\n",{"type":47,"tag":56,"props":1161,"children":1162},{},[1163],{"type":47,"tag":81,"props":1164,"children":1165},{},[1166],{"type":53,"value":1167},"Key patterns:",{"type":47,"tag":410,"props":1169,"children":1170},{},[1171,1180],{"type":47,"tag":91,"props":1172,"children":1173},{},[1174],{"type":47,"tag":62,"props":1175,"children":1177},{"className":1176},[],[1178],{"type":53,"value":1179},"_backends = [\"cutile\"]",{"type":47,"tag":91,"props":1181,"children":1182},{},[1183,1189,1191,1197,1199],{"type":47,"tag":62,"props":1184,"children":1186},{"className":1185},[],[1187],{"type":53,"value":1188},"test_op",{"type":53,"value":1190},": use ",{"type":47,"tag":62,"props":1192,"children":1194},{"className":1193},[],[1195],{"type":53,"value":1196},"set_backend(backend)",{"type":53,"value":1198}," with try-except, call ",{"type":47,"tag":62,"props":1200,"children":1202},{"className":1201},[],[1203],{"type":53,"value":1204},"self.setUp()",{"type":47,"tag":56,"props":1206,"children":1207},{},[1208,1212,1213],{"type":47,"tag":81,"props":1209,"children":1210},{},[1211],{"type":53,"value":444},{"type":53,"value":184},{"type":47,"tag":62,"props":1214,"children":1216},{"className":1215},[],[1217],{"type":53,"value":1218},"tests\u002Fops\u002Ftest_silu_and_mul.py",{"type":47,"tag":56,"props":1220,"children":1221},{},[1222],{"type":53,"value":1223},"Below is the common errors.",{"type":47,"tag":158,"props":1225,"children":1228},{"className":1226,"code":1227,"language":53},[161],"1. Missing _backends list (inside class)\n2. test_op \u002F test_op_xxx — missing @pytest.mark.parametrize(\"backend\", _backends), backend parameter, and tilegym.is_backend_available \u002F tilegym.set_backend pattern\n",[1229],{"type":47,"tag":62,"props":1230,"children":1231},{"__ignoreMap":166},[1232],{"type":53,"value":1227},{"type":47,"tag":71,"props":1234,"children":1236},{"id":1235},"step-5-add-benchmark-to-testsbenchmark",[1237],{"type":53,"value":1238},"Step 5: Add benchmark to tests\u002Fbenchmark",{"type":47,"tag":56,"props":1240,"children":1241},{},[1242,1246,1247],{"type":47,"tag":81,"props":1243,"children":1244},{},[1245],{"type":53,"value":182},{"type":53,"value":184},{"type":47,"tag":62,"props":1248,"children":1250},{"className":1249},[],[1251],{"type":53,"value":1252},"tests\u002Fbenchmark\u002Fbench_my_op.py",{"type":47,"tag":56,"props":1254,"children":1255},{},[1256],{"type":47,"tag":81,"props":1257,"children":1258},{},[1259],{"type":53,"value":1260},"Key rules from benchmark_rules.md:",{"type":47,"tag":410,"props":1262,"children":1263},{},[1264,1291,1326,1346,1367,1411],{"type":47,"tag":91,"props":1265,"children":1266},{},[1267,1269,1275,1277,1282,1284,1290],{"type":53,"value":1268},"Call the op via ",{"type":47,"tag":62,"props":1270,"children":1272},{"className":1271},[],[1273],{"type":53,"value":1274},"tilegym.ops.my_op(a, b, ..., backend=backend)",{"type":53,"value":1276}," — do ",{"type":47,"tag":81,"props":1278,"children":1279},{},[1280],{"type":53,"value":1281},"not",{"type":53,"value":1283}," use ",{"type":47,"tag":62,"props":1285,"children":1287},{"className":1286},[],[1288],{"type":53,"value":1289},"set_backend",{"type":53,"value":797},{"type":47,"tag":91,"props":1292,"children":1293},{},[1294,1296,1302,1304,1309,1311,1317,1319,1325],{"type":53,"value":1295},"Define ",{"type":47,"tag":62,"props":1297,"children":1299},{"className":1298},[],[1300],{"type":53,"value":1301},"ALL_BACKENDS",{"type":53,"value":1303}," (include at least ",{"type":47,"tag":62,"props":1305,"children":1307},{"className":1306},[],[1308],{"type":53,"value":38},{"type":53,"value":1310}," and ",{"type":47,"tag":62,"props":1312,"children":1314},{"className":1313},[],[1315],{"type":53,"value":1316},"torch",{"type":53,"value":1318},"), filter with ",{"type":47,"tag":62,"props":1320,"children":1322},{"className":1321},[],[1323],{"type":53,"value":1324},"get_supported_backends()",{"type":53,"value":797},{"type":47,"tag":91,"props":1327,"children":1328},{},[1329,1331,1337,1339,1345],{"type":53,"value":1330},"Implement ",{"type":47,"tag":62,"props":1332,"children":1334},{"className":1333},[],[1335],{"type":53,"value":1336},"reference_my_op(...)",{"type":53,"value":1338}," and register it: ",{"type":47,"tag":62,"props":1340,"children":1342},{"className":1341},[],[1343],{"type":53,"value":1344},"register_impl(\"my_op\", \"torch\")(reference_my_op)",{"type":53,"value":797},{"type":47,"tag":91,"props":1347,"children":1348},{},[1349,1351,1357,1359,1365],{"type":53,"value":1350},"Use ",{"type":47,"tag":62,"props":1352,"children":1354},{"className":1353},[],[1355],{"type":53,"value":1356},"create_benchmark_config()",{"type":53,"value":1358}," to build ",{"type":47,"tag":62,"props":1360,"children":1362},{"className":1361},[],[1363],{"type":53,"value":1364},"triton.testing.Benchmark",{"type":53,"value":1366}," configs (e.g. by shape\u002Fdtype).",{"type":47,"tag":91,"props":1368,"children":1369},{},[1370,1371,1377,1379,1385,1387,1393,1395,1401,1403,1409],{"type":53,"value":1350},{"type":47,"tag":62,"props":1372,"children":1374},{"className":1373},[],[1375],{"type":53,"value":1376},"@triton.testing.perf_report([...])",{"type":53,"value":1378}," on ",{"type":47,"tag":62,"props":1380,"children":1382},{"className":1381},[],[1383],{"type":53,"value":1384},"bench_my_op(...)",{"type":53,"value":1386},"; inside the bench function: correctness check with ",{"type":47,"tag":62,"props":1388,"children":1390},{"className":1389},[],[1391],{"type":53,"value":1392},"torch.testing.assert_close(fn(), ref(), ...)",{"type":53,"value":1394},", then ",{"type":47,"tag":62,"props":1396,"children":1398},{"className":1397},[],[1399],{"type":53,"value":1400},"ms = triton.testing.do_bench(fn)",{"type":53,"value":1402}," (or ",{"type":47,"tag":62,"props":1404,"children":1406},{"className":1405},[],[1407],{"type":53,"value":1408},"do_bench_cudagraph",{"type":53,"value":1410},"), compute GB\u002Fs or TFLOPS, and return the metric.",{"type":47,"tag":91,"props":1412,"children":1413},{},[1414,1416,1422],{"type":53,"value":1415},"Entry point: ",{"type":47,"tag":62,"props":1417,"children":1419},{"className":1418},[],[1420],{"type":53,"value":1421},"if __name__ == \"__main__\": bench_my_op.run(print_data=True)",{"type":53,"value":797},{"type":47,"tag":56,"props":1424,"children":1425},{},[1426],{"type":53,"value":1427},"Template structure:",{"type":47,"tag":158,"props":1429,"children":1431},{"className":213,"code":1430,"language":215,"meta":166,"style":166},"import torch\nimport triton\nimport triton.testing\n\nimport tilegym\nfrom tilegym.backend import is_backend_available, register_impl\n\nALL_BACKENDS = [\n    (\"cutile\", \"cuTile\", (\"orange\", \"-\")) if is_backend_available(\"cutile\") else None,\n    (\"torch\", \"PyTorch\", (\"green\", \"-\")),\n]\n\ndef get_supported_backends():\n    return [p for p in ALL_BACKENDS if p is not None]\n\ndef reference_my_op(input: torch.Tensor, out: torch.Tensor = None, **kwargs):\n    \"\"\"Reference implementation using PyTorch.\"\"\"\n    ...\n\nregister_impl(\"my_op\", \"torch\")(reference_my_op)\n\ndef create_benchmark_config(datatype, ...):\n    available_backends = get_supported_backends()\n    if not available_backends:\n        return None\n    backends, names, styles = zip(*available_backends)\n    return triton.testing.Benchmark(\n        x_names=[\"M\"],  # or other dimension names\n        x_vals=[...],\n        line_arg=\"backend\",\n        line_vals=list(backends),\n        line_names=list(names),\n        styles=list(styles),\n        ylabel=\"GB\u002Fs\",  # or TFLOPS\n        plot_name=\"my-op-...\",\n        args={\"datatype\": datatype, ...},\n    )\n\n@triton.testing.perf_report([\n    create_benchmark_config(datatype, ...)\n    for datatype in [torch.float16, torch.float32]\n    for ... in [...]\n])\ndef bench_my_op(M, backend, datatype, ..., device=\"cuda\"):\n    x = torch.randn(..., dtype=datatype, device=device)\n\n    fn = lambda: tilegym.ops.my_op(x, backend=backend)\n    ref = lambda: reference_my_op(x)\n    torch.testing.assert_close(fn(), ref(), rtol=1e-2, atol=1e-2)\n\n    ms = triton.testing.do_bench(fn)  # or do_bench_cudagraph(fn)\n    # Compute metric (e.g. GB\u002Fs or TFLOPS) from ms and problem size\n    return metric\n\nif __name__ == \"__main__\":\n    bench_my_op.run(print_data=True)\n",[1432],{"type":47,"tag":62,"props":1433,"children":1434},{"__ignoreMap":166},[1435,1442,1450,1458,1465,1473,1481,1488,1496,1504,1512,1520,1527,1535,1543,1550,1558,1566,1574,1581,1589,1596,1604,1612,1620,1628,1636,1644,1652,1660,1668,1676,1684,1692,1700,1708,1716,1724,1731,1740,1749,1758,1767,1776,1785,1794,1802,1811,1820,1829,1837,1846,1855,1864,1872,1881],{"type":47,"tag":221,"props":1436,"children":1437},{"class":223,"line":224},[1438],{"type":47,"tag":221,"props":1439,"children":1440},{},[1441],{"type":53,"value":509},{"type":47,"tag":221,"props":1443,"children":1444},{"class":223,"line":233},[1445],{"type":47,"tag":221,"props":1446,"children":1447},{},[1448],{"type":53,"value":1449},"import triton\n",{"type":47,"tag":221,"props":1451,"children":1452},{"class":223,"line":242},[1453],{"type":47,"tag":221,"props":1454,"children":1455},{},[1456],{"type":53,"value":1457},"import triton.testing\n",{"type":47,"tag":221,"props":1459,"children":1460},{"class":223,"line":251},[1461],{"type":47,"tag":221,"props":1462,"children":1463},{"emptyLinePlaceholder":318},[1464],{"type":53,"value":321},{"type":47,"tag":221,"props":1466,"children":1467},{"class":223,"line":260},[1468],{"type":47,"tag":221,"props":1469,"children":1470},{},[1471],{"type":53,"value":1472},"import tilegym\n",{"type":47,"tag":221,"props":1474,"children":1475},{"class":223,"line":269},[1476],{"type":47,"tag":221,"props":1477,"children":1478},{},[1479],{"type":53,"value":1480},"from tilegym.backend import is_backend_available, register_impl\n",{"type":47,"tag":221,"props":1482,"children":1483},{"class":223,"line":278},[1484],{"type":47,"tag":221,"props":1485,"children":1486},{"emptyLinePlaceholder":318},[1487],{"type":53,"value":321},{"type":47,"tag":221,"props":1489,"children":1490},{"class":223,"line":287},[1491],{"type":47,"tag":221,"props":1492,"children":1493},{},[1494],{"type":53,"value":1495},"ALL_BACKENDS = [\n",{"type":47,"tag":221,"props":1497,"children":1498},{"class":223,"line":296},[1499],{"type":47,"tag":221,"props":1500,"children":1501},{},[1502],{"type":53,"value":1503},"    (\"cutile\", \"cuTile\", (\"orange\", \"-\")) if is_backend_available(\"cutile\") else None,\n",{"type":47,"tag":221,"props":1505,"children":1506},{"class":223,"line":305},[1507],{"type":47,"tag":221,"props":1508,"children":1509},{},[1510],{"type":53,"value":1511},"    (\"torch\", \"PyTorch\", (\"green\", \"-\")),\n",{"type":47,"tag":221,"props":1513,"children":1514},{"class":223,"line":314},[1515],{"type":47,"tag":221,"props":1516,"children":1517},{},[1518],{"type":53,"value":1519},"]\n",{"type":47,"tag":221,"props":1521,"children":1522},{"class":223,"line":324},[1523],{"type":47,"tag":221,"props":1524,"children":1525},{"emptyLinePlaceholder":318},[1526],{"type":53,"value":321},{"type":47,"tag":221,"props":1528,"children":1529},{"class":223,"line":333},[1530],{"type":47,"tag":221,"props":1531,"children":1532},{},[1533],{"type":53,"value":1534},"def get_supported_backends():\n",{"type":47,"tag":221,"props":1536,"children":1537},{"class":223,"line":342},[1538],{"type":47,"tag":221,"props":1539,"children":1540},{},[1541],{"type":53,"value":1542},"    return [p for p in ALL_BACKENDS if p is not None]\n",{"type":47,"tag":221,"props":1544,"children":1545},{"class":223,"line":351},[1546],{"type":47,"tag":221,"props":1547,"children":1548},{"emptyLinePlaceholder":318},[1549],{"type":53,"value":321},{"type":47,"tag":221,"props":1551,"children":1552},{"class":223,"line":360},[1553],{"type":47,"tag":221,"props":1554,"children":1555},{},[1556],{"type":53,"value":1557},"def reference_my_op(input: torch.Tensor, out: torch.Tensor = None, **kwargs):\n",{"type":47,"tag":221,"props":1559,"children":1560},{"class":223,"line":368},[1561],{"type":47,"tag":221,"props":1562,"children":1563},{},[1564],{"type":53,"value":1565},"    \"\"\"Reference implementation using PyTorch.\"\"\"\n",{"type":47,"tag":221,"props":1567,"children":1568},{"class":223,"line":377},[1569],{"type":47,"tag":221,"props":1570,"children":1571},{},[1572],{"type":53,"value":1573},"    ...\n",{"type":47,"tag":221,"props":1575,"children":1576},{"class":223,"line":386},[1577],{"type":47,"tag":221,"props":1578,"children":1579},{"emptyLinePlaceholder":318},[1580],{"type":53,"value":321},{"type":47,"tag":221,"props":1582,"children":1583},{"class":223,"line":394},[1584],{"type":47,"tag":221,"props":1585,"children":1586},{},[1587],{"type":53,"value":1588},"register_impl(\"my_op\", \"torch\")(reference_my_op)\n",{"type":47,"tag":221,"props":1590,"children":1591},{"class":223,"line":659},[1592],{"type":47,"tag":221,"props":1593,"children":1594},{"emptyLinePlaceholder":318},[1595],{"type":53,"value":321},{"type":47,"tag":221,"props":1597,"children":1598},{"class":223,"line":668},[1599],{"type":47,"tag":221,"props":1600,"children":1601},{},[1602],{"type":53,"value":1603},"def create_benchmark_config(datatype, ...):\n",{"type":47,"tag":221,"props":1605,"children":1606},{"class":223,"line":677},[1607],{"type":47,"tag":221,"props":1608,"children":1609},{},[1610],{"type":53,"value":1611},"    available_backends = get_supported_backends()\n",{"type":47,"tag":221,"props":1613,"children":1614},{"class":223,"line":1030},[1615],{"type":47,"tag":221,"props":1616,"children":1617},{},[1618],{"type":53,"value":1619},"    if not available_backends:\n",{"type":47,"tag":221,"props":1621,"children":1622},{"class":223,"line":1039},[1623],{"type":47,"tag":221,"props":1624,"children":1625},{},[1626],{"type":53,"value":1627},"        return None\n",{"type":47,"tag":221,"props":1629,"children":1630},{"class":223,"line":1048},[1631],{"type":47,"tag":221,"props":1632,"children":1633},{},[1634],{"type":53,"value":1635},"    backends, names, styles = zip(*available_backends)\n",{"type":47,"tag":221,"props":1637,"children":1638},{"class":223,"line":1057},[1639],{"type":47,"tag":221,"props":1640,"children":1641},{},[1642],{"type":53,"value":1643},"    return triton.testing.Benchmark(\n",{"type":47,"tag":221,"props":1645,"children":1646},{"class":223,"line":1066},[1647],{"type":47,"tag":221,"props":1648,"children":1649},{},[1650],{"type":53,"value":1651},"        x_names=[\"M\"],  # or other dimension names\n",{"type":47,"tag":221,"props":1653,"children":1654},{"class":223,"line":1075},[1655],{"type":47,"tag":221,"props":1656,"children":1657},{},[1658],{"type":53,"value":1659},"        x_vals=[...],\n",{"type":47,"tag":221,"props":1661,"children":1662},{"class":223,"line":1083},[1663],{"type":47,"tag":221,"props":1664,"children":1665},{},[1666],{"type":53,"value":1667},"        line_arg=\"backend\",\n",{"type":47,"tag":221,"props":1669,"children":1670},{"class":223,"line":1092},[1671],{"type":47,"tag":221,"props":1672,"children":1673},{},[1674],{"type":53,"value":1675},"        line_vals=list(backends),\n",{"type":47,"tag":221,"props":1677,"children":1678},{"class":223,"line":1100},[1679],{"type":47,"tag":221,"props":1680,"children":1681},{},[1682],{"type":53,"value":1683},"        line_names=list(names),\n",{"type":47,"tag":221,"props":1685,"children":1686},{"class":223,"line":1109},[1687],{"type":47,"tag":221,"props":1688,"children":1689},{},[1690],{"type":53,"value":1691},"        styles=list(styles),\n",{"type":47,"tag":221,"props":1693,"children":1694},{"class":223,"line":1117},[1695],{"type":47,"tag":221,"props":1696,"children":1697},{},[1698],{"type":53,"value":1699},"        ylabel=\"GB\u002Fs\",  # or TFLOPS\n",{"type":47,"tag":221,"props":1701,"children":1702},{"class":223,"line":1126},[1703],{"type":47,"tag":221,"props":1704,"children":1705},{},[1706],{"type":53,"value":1707},"        plot_name=\"my-op-...\",\n",{"type":47,"tag":221,"props":1709,"children":1710},{"class":223,"line":1135},[1711],{"type":47,"tag":221,"props":1712,"children":1713},{},[1714],{"type":53,"value":1715},"        args={\"datatype\": datatype, ...},\n",{"type":47,"tag":221,"props":1717,"children":1718},{"class":223,"line":1144},[1719],{"type":47,"tag":221,"props":1720,"children":1721},{},[1722],{"type":53,"value":1723},"    )\n",{"type":47,"tag":221,"props":1725,"children":1726},{"class":223,"line":1153},[1727],{"type":47,"tag":221,"props":1728,"children":1729},{"emptyLinePlaceholder":318},[1730],{"type":53,"value":321},{"type":47,"tag":221,"props":1732,"children":1734},{"class":223,"line":1733},39,[1735],{"type":47,"tag":221,"props":1736,"children":1737},{},[1738],{"type":53,"value":1739},"@triton.testing.perf_report([\n",{"type":47,"tag":221,"props":1741,"children":1743},{"class":223,"line":1742},40,[1744],{"type":47,"tag":221,"props":1745,"children":1746},{},[1747],{"type":53,"value":1748},"    create_benchmark_config(datatype, ...)\n",{"type":47,"tag":221,"props":1750,"children":1752},{"class":223,"line":1751},41,[1753],{"type":47,"tag":221,"props":1754,"children":1755},{},[1756],{"type":53,"value":1757},"    for datatype in [torch.float16, torch.float32]\n",{"type":47,"tag":221,"props":1759,"children":1761},{"class":223,"line":1760},42,[1762],{"type":47,"tag":221,"props":1763,"children":1764},{},[1765],{"type":53,"value":1766},"    for ... in [...]\n",{"type":47,"tag":221,"props":1768,"children":1770},{"class":223,"line":1769},43,[1771],{"type":47,"tag":221,"props":1772,"children":1773},{},[1774],{"type":53,"value":1775},"])\n",{"type":47,"tag":221,"props":1777,"children":1779},{"class":223,"line":1778},44,[1780],{"type":47,"tag":221,"props":1781,"children":1782},{},[1783],{"type":53,"value":1784},"def bench_my_op(M, backend, datatype, ..., device=\"cuda\"):\n",{"type":47,"tag":221,"props":1786,"children":1788},{"class":223,"line":1787},45,[1789],{"type":47,"tag":221,"props":1790,"children":1791},{},[1792],{"type":53,"value":1793},"    x = torch.randn(..., dtype=datatype, device=device)\n",{"type":47,"tag":221,"props":1795,"children":1797},{"class":223,"line":1796},46,[1798],{"type":47,"tag":221,"props":1799,"children":1800},{"emptyLinePlaceholder":318},[1801],{"type":53,"value":321},{"type":47,"tag":221,"props":1803,"children":1805},{"class":223,"line":1804},47,[1806],{"type":47,"tag":221,"props":1807,"children":1808},{},[1809],{"type":53,"value":1810},"    fn = lambda: tilegym.ops.my_op(x, backend=backend)\n",{"type":47,"tag":221,"props":1812,"children":1814},{"class":223,"line":1813},48,[1815],{"type":47,"tag":221,"props":1816,"children":1817},{},[1818],{"type":53,"value":1819},"    ref = lambda: reference_my_op(x)\n",{"type":47,"tag":221,"props":1821,"children":1823},{"class":223,"line":1822},49,[1824],{"type":47,"tag":221,"props":1825,"children":1826},{},[1827],{"type":53,"value":1828},"    torch.testing.assert_close(fn(), ref(), rtol=1e-2, atol=1e-2)\n",{"type":47,"tag":221,"props":1830,"children":1832},{"class":223,"line":1831},50,[1833],{"type":47,"tag":221,"props":1834,"children":1835},{"emptyLinePlaceholder":318},[1836],{"type":53,"value":321},{"type":47,"tag":221,"props":1838,"children":1840},{"class":223,"line":1839},51,[1841],{"type":47,"tag":221,"props":1842,"children":1843},{},[1844],{"type":53,"value":1845},"    ms = triton.testing.do_bench(fn)  # or do_bench_cudagraph(fn)\n",{"type":47,"tag":221,"props":1847,"children":1849},{"class":223,"line":1848},52,[1850],{"type":47,"tag":221,"props":1851,"children":1852},{},[1853],{"type":53,"value":1854},"    # Compute metric (e.g. GB\u002Fs or TFLOPS) from ms and problem size\n",{"type":47,"tag":221,"props":1856,"children":1858},{"class":223,"line":1857},53,[1859],{"type":47,"tag":221,"props":1860,"children":1861},{},[1862],{"type":53,"value":1863},"    return metric\n",{"type":47,"tag":221,"props":1865,"children":1867},{"class":223,"line":1866},54,[1868],{"type":47,"tag":221,"props":1869,"children":1870},{"emptyLinePlaceholder":318},[1871],{"type":53,"value":321},{"type":47,"tag":221,"props":1873,"children":1875},{"class":223,"line":1874},55,[1876],{"type":47,"tag":221,"props":1877,"children":1878},{},[1879],{"type":53,"value":1880},"if __name__ == \"__main__\":\n",{"type":47,"tag":221,"props":1882,"children":1884},{"class":223,"line":1883},56,[1885],{"type":47,"tag":221,"props":1886,"children":1887},{},[1888],{"type":53,"value":1889},"    bench_my_op.run(print_data=True)\n",{"type":47,"tag":56,"props":1891,"children":1892},{},[1893,1898,1900,1906,1908,1914],{"type":47,"tag":81,"props":1894,"children":1895},{},[1896],{"type":53,"value":1897},"Benchmark Plot Names",{"type":53,"value":1899},": Must include ",{"type":47,"tag":62,"props":1901,"children":1903},{"className":1902},[],[1904],{"type":53,"value":1905},"-TFLOPS",{"type":53,"value":1907}," or ",{"type":47,"tag":62,"props":1909,"children":1911},{"className":1910},[],[1912],{"type":53,"value":1913},"-GBps",{"type":53,"value":1915}," suffix",{"type":47,"tag":410,"props":1917,"children":1918},{},[1919],{"type":47,"tag":91,"props":1920,"children":1921},{},[1922,1924],{"type":53,"value":1923},"Example: ",{"type":47,"tag":62,"props":1925,"children":1927},{"className":1926},[],[1928],{"type":53,"value":1929},"plot_name=f\"persistent-layer-norm-M{num_rows}-{dtype_name}-GBps\"",{"type":47,"tag":71,"props":1931,"children":1933},{"id":1932},"step-6-verify",[1934],{"type":53,"value":1935},"Step 6: Verify",{"type":47,"tag":158,"props":1937,"children":1941},{"className":1938,"code":1939,"language":1940,"meta":166,"style":166},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","# Run tests\npytest tests\u002Fops\u002Ftest_my_op.py -v\n\n# Run benchmark (optional)\npython tests\u002Fbenchmark\u002Fbench_my_op.py\n\n# Lint\npre-commit run -a\n","bash",[1942],{"type":47,"tag":62,"props":1943,"children":1944},{"__ignoreMap":166},[1945,1954,1974,1981,1989,2001,2008,2016],{"type":47,"tag":221,"props":1946,"children":1947},{"class":223,"line":224},[1948],{"type":47,"tag":221,"props":1949,"children":1951},{"style":1950},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[1952],{"type":53,"value":1953},"# Run tests\n",{"type":47,"tag":221,"props":1955,"children":1956},{"class":223,"line":233},[1957,1963,1969],{"type":47,"tag":221,"props":1958,"children":1960},{"style":1959},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1961],{"type":53,"value":1962},"pytest",{"type":47,"tag":221,"props":1964,"children":1966},{"style":1965},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[1967],{"type":53,"value":1968}," tests\u002Fops\u002Ftest_my_op.py",{"type":47,"tag":221,"props":1970,"children":1971},{"style":1965},[1972],{"type":53,"value":1973}," -v\n",{"type":47,"tag":221,"props":1975,"children":1976},{"class":223,"line":242},[1977],{"type":47,"tag":221,"props":1978,"children":1979},{"emptyLinePlaceholder":318},[1980],{"type":53,"value":321},{"type":47,"tag":221,"props":1982,"children":1983},{"class":223,"line":251},[1984],{"type":47,"tag":221,"props":1985,"children":1986},{"style":1950},[1987],{"type":53,"value":1988},"# Run benchmark (optional)\n",{"type":47,"tag":221,"props":1990,"children":1991},{"class":223,"line":260},[1992,1996],{"type":47,"tag":221,"props":1993,"children":1994},{"style":1959},[1995],{"type":53,"value":215},{"type":47,"tag":221,"props":1997,"children":1998},{"style":1965},[1999],{"type":53,"value":2000}," tests\u002Fbenchmark\u002Fbench_my_op.py\n",{"type":47,"tag":221,"props":2002,"children":2003},{"class":223,"line":269},[2004],{"type":47,"tag":221,"props":2005,"children":2006},{"emptyLinePlaceholder":318},[2007],{"type":53,"value":321},{"type":47,"tag":221,"props":2009,"children":2010},{"class":223,"line":278},[2011],{"type":47,"tag":221,"props":2012,"children":2013},{"style":1950},[2014],{"type":53,"value":2015},"# Lint\n",{"type":47,"tag":221,"props":2017,"children":2018},{"class":223,"line":287},[2019,2024,2029],{"type":47,"tag":221,"props":2020,"children":2021},{"style":1959},[2022],{"type":53,"value":2023},"pre-commit",{"type":47,"tag":221,"props":2025,"children":2026},{"style":1965},[2027],{"type":53,"value":2028}," run",{"type":47,"tag":221,"props":2030,"children":2031},{"style":1965},[2032],{"type":53,"value":2033}," -a\n",{"type":47,"tag":2035,"props":2036,"children":2037},"style",{},[2038],{"type":53,"value":2039},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2041,"total":2197},[2042,2060,2077,2088,2100,2114,2127,2141,2152,2163,2177,2186],{"slug":2043,"name":2043,"fn":2044,"description":2045,"org":2046,"tags":2047,"stars":2057,"repoUrl":2058,"updatedAt":2059},"nemoclaw-user-guide","retrieve NemoClaw documentation and configuration","Guides human users' AI agents to the NemoClaw docs MCP server and canonical Fern documentation in Markdown form. Use when users ask how to install, configure, operate, troubleshoot, secure, or learn NemoClaw with an AI coding assistant. Trigger keywords - nemoclaw docs, use nemoclaw with ai agent, nemoclaw mcp docs, nemoclaw install help, nemoclaw quickstart, nemoclaw markdown docs, llms.txt, agent skills.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2048,2051,2054],{"name":2049,"slug":2050,"type":15},"Documentation","documentation",{"name":2052,"slug":2053,"type":15},"MCP","mcp",{"name":2055,"slug":2056,"type":15},"Search","search",21777,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FNemoClaw","2026-07-20T06:00:01.461044",{"slug":2061,"name":2061,"fn":2062,"description":2063,"org":2064,"tags":2065,"stars":2074,"repoUrl":2075,"updatedAt":2076},"mcore-build-and-dependency","manage Megatron-LM development environments","Container-based dev environment setup and dependency management for Megatron-LM. Covers acquiring and launching the CI container, uv package management, and updating uv.lock.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2066,2069,2072],{"name":2067,"slug":2068,"type":15},"Containers","containers",{"name":2070,"slug":2071,"type":15},"Deployment","deployment",{"name":2073,"slug":215,"type":15},"Python",17049,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FMegatron-LM","2026-07-27T06:06:11.249662",{"slug":2078,"name":2078,"fn":2079,"description":2080,"org":2081,"tags":2082,"stars":2074,"repoUrl":2075,"updatedAt":2087},"mcore-bump-base-image","update NVIDIA PyTorch base images","Bump the NVIDIA PyTorch base image (`nvcr.io\u002Fnvidia\u002Fpytorch:YY.MM-py3`) used by Megatron-LM CI. Covers the two pin sites (GitHub CI in `docker\u002F.ngc_version.dev` and GitLab CI in `.gitlab\u002Fstages\u002F01.build.yml`), the post-bump CI loop (re-run functional tests, refresh golden values, mark broken tests), and the gotchas that bit PRs",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2083,2086],{"name":2084,"slug":2085,"type":15},"CI\u002FCD","ci-cd",{"name":2070,"slug":2071,"type":15},"2026-07-14T05:25:59.97109",{"slug":2089,"name":2089,"fn":2090,"description":2091,"org":2092,"tags":2093,"stars":2074,"repoUrl":2075,"updatedAt":2099},"mcore-cicd","manage CI\u002FCD pipelines for Megatron-LM","CI\u002FCD reference for Megatron-LM. Covers CI pipeline structure, PR scope labels, triggering internal GitLab CI (which force-pushes the current branch to a pull-request\u002FBRANCH ref — always dry-run and verify the destination first; never run against shared or protected branches), and CI failure investigation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2094,2095,2096],{"name":2084,"slug":2085,"type":15},{"name":2070,"slug":2071,"type":15},{"name":2097,"slug":2098,"type":15},"GitHub","github","2026-07-27T06:06:12.278222",{"slug":2101,"name":2101,"fn":2102,"description":2103,"org":2104,"tags":2105,"stars":2074,"repoUrl":2075,"updatedAt":2113},"mcore-create-issue","investigate CI failures and create issues","Investigate a failing GitHub Actions run or job and create a GitHub issue for the failure.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2106,2109,2110],{"name":2107,"slug":2108,"type":15},"Debugging","debugging",{"name":2097,"slug":2098,"type":15},{"name":2111,"slug":2112,"type":15},"Triage","triage","2026-07-14T05:25:57.442089",{"slug":2115,"name":2115,"fn":2116,"description":2117,"org":2118,"tags":2119,"stars":2074,"repoUrl":2075,"updatedAt":2126},"mcore-linting-and-formatting","lint and format Megatron-LM code","Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2120,2123],{"name":2121,"slug":2122,"type":15},"Best Practices","best-practices",{"name":2124,"slug":2125,"type":15},"Code Analysis","code-analysis","2026-07-14T05:25:56.18433",{"slug":2128,"name":2128,"fn":2129,"description":2130,"org":2131,"tags":2132,"stars":2074,"repoUrl":2075,"updatedAt":2140},"mcore-migrate-gpt-to-hybrid","migrate Megatron-LM models to HybridModel","Migration guide for moving Megatron Core GPTModel checkpoints, model providers, training commands, and layer mappings to HybridModel.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2133,2136,2139],{"name":2134,"slug":2135,"type":15},"Machine Learning","machine-learning",{"name":2137,"slug":2138,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:11.777011",{"slug":2142,"name":2142,"fn":2143,"description":2144,"org":2145,"tags":2146,"stars":2074,"repoUrl":2075,"updatedAt":2151},"mcore-onboard-gb200-1node-tests","onboard functional tests for GB200","Onboard 1-node GitHub MR functional tests for GB200 from existing mr-scoped 2-node tests.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2147,2150],{"name":2148,"slug":2149,"type":15},"QA","qa",{"name":20,"slug":21,"type":15},"2026-07-14T05:25:53.673039",{"slug":2153,"name":2153,"fn":2154,"description":2155,"org":2156,"tags":2157,"stars":2074,"repoUrl":2075,"updatedAt":2162},"mcore-run-on-slurm","launch distributed training jobs on SLURM","How to launch distributed Megatron-LM training jobs on a SLURM cluster. Covers a minimal sbatch skeleton, environment-variable setup for torch.distributed.run, CUDA_DEVICE_MAX_CONNECTIONS rules across hardware and parallelism modes, container conventions, monitoring, and per-rank failure diagnosis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2158,2159],{"name":2070,"slug":2071,"type":15},{"name":2160,"slug":2161,"type":15},"Infrastructure","infrastructure","2026-07-14T05:25:49.362534",{"slug":2164,"name":2164,"fn":2165,"description":2166,"org":2167,"tags":2168,"stars":2074,"repoUrl":2075,"updatedAt":2176},"mcore-split-pr","split pull requests to reduce review load","Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2169,2172,2173],{"name":2170,"slug":2171,"type":15},"Code Review","code-review",{"name":2097,"slug":2098,"type":15},{"name":2174,"slug":2175,"type":15},"Pull Requests","pull-requests","2026-07-14T05:26:01.226578",{"slug":2178,"name":2178,"fn":2179,"description":2180,"org":2181,"tags":2182,"stars":2074,"repoUrl":2075,"updatedAt":2185},"mcore-testing","run and manage Megatron-LM tests","Test system for Megatron-LM. Covers test layout, recipe YAML structure, adding and running unit and functional tests, golden values, marker filters, and CI parity.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2183,2184],{"name":2148,"slug":2149,"type":15},{"name":20,"slug":21,"type":15},"2026-07-14T05:25:54.928983",{"slug":2187,"name":2187,"fn":2188,"description":2189,"org":2190,"tags":2191,"stars":2074,"repoUrl":2075,"updatedAt":2196},"nightly-sync","manage nightly main-to-dev sync workflows","Domain knowledge for the nightly main-to-dev sync workflow. Covers merge strategy, CI architecture, failure investigation, and known issues.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2192,2195],{"name":2193,"slug":2194,"type":15},"Automation","automation",{"name":2084,"slug":2085,"type":15},"2026-07-30T05:29:03.275638",496,{"items":2199,"total":2293},[2200,2215,2225,2239,2249,2264,2279],{"slug":2201,"name":2201,"fn":2202,"description":2203,"org":2204,"tags":2205,"stars":22,"repoUrl":23,"updatedAt":2214},"accelerated-computing-cudf","accelerate data processing with cuDF","Official NVIDIA-authored guidance for NVIDIA cuDF GPU DataFrames, pandas acceleration, dask-cuDF, ETL, joins, groupby, CSV\u002FParquet I\u002FO, nullable semantics, and multi-GPU DataFrame workloads.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2206,2209,2212,2213],{"name":2207,"slug":2208,"type":15},"Data Analysis","data-analysis",{"name":2210,"slug":2211,"type":15},"Data Engineering","data-engineering",{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},"2026-07-14T05:28:43.176466",{"slug":2216,"name":2216,"fn":2217,"description":2218,"org":2219,"tags":2220,"stars":22,"repoUrl":23,"updatedAt":2224},"aiq-deploy","deploy and manage NVIDIA AI-Q infrastructure","Use when asked to install, deploy, run, validate, troubleshoot, or stop NVIDIA AI-Q Blueprint infrastructure.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2221,2222,2223],{"name":2070,"slug":2071,"type":15},{"name":2160,"slug":2161,"type":15},{"name":9,"slug":8,"type":15},"2026-07-14T05:29:06.667109",{"slug":2226,"name":2226,"fn":2227,"description":2228,"org":2229,"tags":2230,"stars":22,"repoUrl":23,"updatedAt":2238},"aiq-research","conduct deep research with AI-Q","Use when asked to run deep research or AI-Q research through a reachable NVIDIA AI-Q Blueprint backend.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2231,2234,2235],{"name":2232,"slug":2233,"type":15},"Agents","agents",{"name":9,"slug":8,"type":15},{"name":2236,"slug":2237,"type":15},"Research","research","2026-07-14T05:28:06.816956",{"slug":2240,"name":2240,"fn":2241,"description":2242,"org":2243,"tags":2244,"stars":22,"repoUrl":23,"updatedAt":2248},"amc-run-sample-calibration","run AMC sample dataset 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'.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2245,2246,2247],{"name":2207,"slug":2208,"type":15},{"name":9,"slug":8,"type":15},{"name":20,"slug":21,"type":15},"2026-07-17T05:29:03.913266",{"slug":2250,"name":2250,"fn":2251,"description":2252,"org":2253,"tags":2254,"stars":22,"repoUrl":23,"updatedAt":2263},"amc-run-video-calibration","calibrate video datasets with AutoMagicCalib","Calibrate a new dataset from pre-recorded video files via the AutoMagicCalib REST API. Use when user has local MP4s and says 'calibrate my videos', 'run AMC on these videos', or similar. For RTSP\u002Flive streams, use amc-run-rtsp-calibration instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2255,2256,2259,2260],{"name":2193,"slug":2194,"type":15},{"name":2257,"slug":2258,"type":15},"Imaging","imaging",{"name":9,"slug":8,"type":15},{"name":2261,"slug":2262,"type":15},"Video","video","2026-07-17T05:28:53.905004",{"slug":2265,"name":2265,"fn":2266,"description":2267,"org":2268,"tags":2269,"stars":22,"repoUrl":23,"updatedAt":2278},"amc-setup-calibration-stack","deploy AutoMagicCalib microservice with Docker","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.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2270,2271,2274,2275],{"name":2070,"slug":2071,"type":15},{"name":2272,"slug":2273,"type":15},"Docker","docker",{"name":9,"slug":8,"type":15},{"name":2276,"slug":2277,"type":15},"Operations","operations","2026-07-17T05:28:56.913999",{"slug":2280,"name":2280,"fn":2281,"description":2282,"org":2283,"tags":2284,"stars":22,"repoUrl":23,"updatedAt":2292},"cudaq-guide","develop quantum applications with CUDA-Q","CUDA-Q onboarding guide for installation, test programs, GPU simulation, QPU hardware, and quantum applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2285,2286,2289],{"name":9,"slug":8,"type":15},{"name":2287,"slug":2288,"type":15},"Quantum Computing","quantum-computing",{"name":2290,"slug":2291,"type":15},"Simulation","simulation","2026-07-14T05:26:58.898253",305]