[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-pytorch-pytorch-.claude-skills-add-uint-support":3},{"error":4,"detail":5,"metadata":23,"markdownContent":24,"rawMarkdown":20},false,{"repo_full_name":6,"owner":7,"repo_name":7,"repo_forks":8,"skill_path":9,"repo_stars":10,"name":11,"category_id":12,"description":13,"file_tree":14,"skill_md_content":20,"skill_id":21,"skill_key":22},"pytorch/pytorch","pytorch",27249,".claude/skills/add-uint-support",98372,"add-uint-support",1,"Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.",[15],{"name":16,"path":17,"size":18,"type":19},"SKILL.md",".claude/skills/add-uint-support/SKILL.md",9281,"file","---\nname: add-uint-support\ndescription: Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.\n---\n\n# Add Unsigned Integer (uint) Support to Operators\n\nThis skill helps add support for unsigned integer types (uint16, uint32, uint64) to PyTorch operators by updating their AT_DISPATCH macros.\n\n## When to use this skill\n\nUse this skill when:\n- Adding uint16, uint32, or uint64 support to an operator\n- User mentions \"unsigned types\", \"uint support\", \"barebones unsigned types\"\n- Enabling support for kUInt16, kUInt32, kUInt64 in kernels\n- Working with operator implementations that need expanded type coverage\n\n## Quick reference\n\n**Add unsigned types to existing dispatch:**\n```cpp\n// Before\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_ALL_TYPES));\n\n// After (method 1: add unsigned types explicitly)\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES));\n\n// After (method 2: use V2 integral types if AT_INTEGRAL_TYPES present)\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_INTEGRAL_TYPES_V2), AT_EXPAND(AT_FLOATING_TYPES));\n```\n\n## Type group reference\n\n**Unsigned type groups:**\n- `AT_BAREBONES_UNSIGNED_TYPES`: kUInt16, kUInt32, kUInt64\n- `AT_INTEGRAL_TYPES_V2`: AT_INTEGRAL_TYPES + AT_BAREBONES_UNSIGNED_TYPES\n\n**Relationship:**\n```cpp\nAT_INTEGRAL_TYPES          // kByte, kChar, kInt, kLong, kShort\nAT_BAREBONES_UNSIGNED_TYPES  // kUInt16, kUInt32, kUInt64\nAT_INTEGRAL_TYPES_V2       // INTEGRAL_TYPES + BAREBONES_UNSIGNED_TYPES\n```\n\n## Instructions\n\n### Step 1: Determine if conversion to V2 is needed\n\nCheck if the file uses AT_DISPATCH_V2:\n\n**If using old AT_DISPATCH:**\n- First convert to AT_DISPATCH_V2 using the at-dispatch-v2 skill\n- Then proceed with adding uint support\n\n**If already using AT_DISPATCH_V2:**\n- Proceed directly to Step 2\n\n### Step 2: Analyze the current dispatch macro\n\nIdentify what type groups are currently in use:\n\n```cpp\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  // body\n}), AT_EXPAND(AT_ALL_TYPES), kHalf, kBFloat16);\n    ^^^^^^^^^^^^^^^^^^^^^^^^^\n    Current type coverage\n```\n\nCommon patterns:\n- `AT_EXPAND(AT_ALL_TYPES)` → includes AT_INTEGRAL_TYPES + AT_FLOATING_TYPES\n- `AT_EXPAND(AT_INTEGRAL_TYPES)` → signed integers only\n- `AT_EXPAND(AT_FLOATING_TYPES)` → floating point types\n\n### Step 3: Choose the uint addition method\n\nTwo approaches:\n\n**Method 1: Add AT_BAREBONES_UNSIGNED_TYPES explicitly**\n- Use when: You want to be explicit about adding uint support\n- Add `AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES)` to the type list\n\n**Method 2: Substitute AT_INTEGRAL_TYPES with AT_INTEGRAL_TYPES_V2**\n- Use when: The dispatch already uses `AT_EXPAND(AT_INTEGRAL_TYPES)`\n- More concise: replaces one type group with its superset\n- Only applicable if AT_INTEGRAL_TYPES is present\n\n### Step 4: Apply the transformation\n\n**Method 1 example:**\n```cpp\n// Before\nAT_DISPATCH_V2(\n    dtype,\n    \"min_values_cuda\",\n    AT_WRAP([&]() {\n      kernel_impl\u003Cscalar_t>(iter);\n    }),\n    AT_EXPAND(AT_ALL_TYPES),\n    kBFloat16, kHalf, kBool\n);\n\n// After (add unsigned types)\nAT_DISPATCH_V2(\n    dtype,\n    \"min_values_cuda\",\n    AT_WRAP([&]() {\n      kernel_impl\u003Cscalar_t>(iter);\n    }),\n    AT_EXPAND(AT_ALL_TYPES),\n    AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES),\n    kBFloat16, kHalf, kBool\n);\n```\n\n**Method 2 example:**\n```cpp\n// Before\nAT_DISPATCH_V2(\n    dtype,\n    \"integral_op\",\n    AT_WRAP([&]() {\n      kernel\u003Cscalar_t>();\n    }),\n    AT_EXPAND(AT_INTEGRAL_TYPES)\n);\n\n// After (substitute with V2)\nAT_DISPATCH_V2(\n    dtype,\n    \"integral_op\",\n    AT_WRAP([&]() {\n      kernel\u003Cscalar_t>();\n    }),\n    AT_EXPAND(AT_INTEGRAL_TYPES_V2)\n);\n```\n\n### Step 5: Handle AT_ALL_TYPES vs individual type groups\n\nIf the dispatch uses `AT_EXPAND(AT_ALL_TYPES)`:\n- `AT_ALL_TYPES` = `AT_INTEGRAL_TYPES` + `AT_FLOATING_TYPES`\n- To add uint: add `AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES)` to the list\n\nIf the dispatch separately lists INTEGRAL and FLOATING:\n```cpp\n// Before\nAT_EXPAND(AT_INTEGRAL_TYPES), AT_EXPAND(AT_FLOATING_TYPES)\n\n// After (Method 2 preferred)\nAT_EXPAND(AT_INTEGRAL_TYPES_V2), AT_EXPAND(AT_FLOATING_TYPES)\n```\n\n### Step 6: Verify all dispatch sites\n\nCheck the file for ALL dispatch macros that need uint support:\n- Some operators have multiple dispatch sites (CPU, CUDA, different functions)\n- Apply the transformation consistently across all sites\n- Ensure each gets the same type coverage updates\n\n### Step 7: Validate the changes\n\nCheck that:\n- [ ] AT_DISPATCH_V2 format is used (not old AT_DISPATCH)\n- [ ] Unsigned types are added via one of the two methods\n- [ ] All relevant dispatch sites in the file are updated\n- [ ] Type groups use `AT_EXPAND()`\n- [ ] Arguments are properly formatted and comma-separated\n\n## Common patterns\n\n### Pattern 1: AT_ALL_TYPES + extras\n\n```cpp\n// Before\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_ALL_TYPES), kHalf, kBFloat16);\n\n// After\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kHalf, kBFloat16);\n```\n\n### Pattern 2: Separate INTEGRAL + FLOATING\n\n```cpp\n// Before\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_INTEGRAL_TYPES), AT_EXPAND(AT_FLOATING_TYPES));\n\n// After\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_INTEGRAL_TYPES_V2), AT_EXPAND(AT_FLOATING_TYPES));\n```\n\n### Pattern 3: Old dispatch needs conversion first\n\n```cpp\n// Before (needs v2 conversion first)\nAT_DISPATCH_ALL_TYPES_AND2(kHalf, kBFloat16, dtype, \"op\", [&]() {\n  kernel\u003Cscalar_t>();\n});\n\n// After v2 conversion\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_ALL_TYPES), kHalf, kBFloat16);\n\n// After adding uint support\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kHalf, kBFloat16);\n```\n\n## Multiple dispatch sites example\n\nFor a file with multiple functions:\n\n```cpp\nvoid min_values_kernel_cuda(TensorIterator& iter) {\n  AT_DISPATCH_V2(iter.dtype(), \"min_values_cuda\", AT_WRAP([&]() {\n    impl\u003Cscalar_t>(iter);\n  }), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kBFloat16, kHalf);\n  //                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  //                           Added uint support\n}\n\nvoid min_launch_kernel(TensorIterator &iter) {\n  AT_DISPATCH_V2(iter.input_dtype(), \"min_cuda\", AT_WRAP([&]() {\n    gpu_reduce_kernel\u003Cscalar_t>(iter);\n  }), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kBFloat16, kHalf);\n  //                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  //                           Added uint support here too\n}\n```\n\n## Decision tree\n\nUse this decision tree to determine the approach:\n\n```\nIs the file using AT_DISPATCH_V2?\n├─ No → Use at-dispatch-v2 skill first, then continue\n└─ Yes\n   └─ Does it use AT_EXPAND(AT_INTEGRAL_TYPES)?\n      ├─ Yes → Replace with AT_EXPAND(AT_INTEGRAL_TYPES_V2)\n      └─ No → Add AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES) to type list\n```\n\n## Edge cases\n\n### Case 1: Dispatch with only floating types\n\nIf the operator only supports floating point types, don't add uint support:\n\n```cpp\n// Leave as-is - floating point only operator\nAT_DISPATCH_V2(dtype, \"float_op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_FLOATING_TYPES), kHalf);\n```\n\n### Case 2: Complex types present\n\nUnsigned types work alongside complex types:\n\n```cpp\nAT_DISPATCH_V2(dtype, \"op\", AT_WRAP([&]() {\n  kernel\u003Cscalar_t>();\n}), AT_EXPAND(AT_ALL_TYPES),\n    AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES),\n    AT_EXPAND(AT_COMPLEX_TYPES),\n    kHalf, kBFloat16);\n```\n\n### Case 3: Already has uint support\n\nCheck if uint types are already present:\n- If `AT_INTEGRAL_TYPES_V2` is used → already has uint support\n- If `AT_BAREBONES_UNSIGNED_TYPES` is already in list → already has uint support\n- Skip the file if uint support is already present\n\n## Workflow\n\nWhen asked to add uint support:\n\n1. Read the target file\n2. Check if using AT_DISPATCH_V2:\n   - If not → use at-dispatch-v2 skill first\n3. Identify all dispatch macro sites\n4. For each dispatch:\n   - Analyze current type groups\n   - Choose method (add BAREBONES_UNSIGNED or upgrade to V2)\n   - Apply transformation with Edit tool\n5. Show the user the changes\n6. Explain what was modified\n\n## Important notes\n\n- Always check if v2 conversion is needed first\n- Apply changes consistently across all dispatch sites in the file\n- Method 2 (AT_INTEGRAL_TYPES_V2) is cleaner when applicable\n- Method 1 (explicit AT_BAREBONES_UNSIGNED_TYPES) is more explicit\n- Unsigned types are: kUInt16, kUInt32, kUInt64 (not kByte which is uint8)\n- Some operators may not semantically support unsigned types - use judgment\n\n## Testing\n\nAfter adding uint support, the operator should accept uint16, uint32, and uint64 tensors. The user is responsible for functional testing.\n","57f2a53c-8122-5bc5-8786-29cbc108aa75","pytorch-pytorch-.claude-skills-add-uint-support",{"name":11,"description":13},"\u003Ch1>Add Unsigned Integer (uint) Support to Operators\u003C/h1>\n\u003Cp>This skill helps add support for unsigned integer types (uint16, uint32, uint64) to PyTorch operators by updating their AT_DISPATCH macros.\u003C/p>\n\u003Ch2>When to use this skill\u003C/h2>\n\u003Cp>Use this skill when:\u003C/p>\n\u003Cul>\n\u003Cli>Adding uint16, uint32, or uint64 support to an operator\u003C/li>\n\u003Cli>User mentions &quot;unsigned types&quot;, &quot;uint support&quot;, &quot;barebones unsigned types&quot;\u003C/li>\n\u003Cli>Enabling support for kUInt16, kUInt32, kUInt64 in kernels\u003C/li>\n\u003Cli>Working with operator implementations that need expanded type coverage\u003C/li>\n\u003C/ul>\n\u003Ch2>Quick reference\u003C/h2>\n\u003Cp>\u003Cstrong>Add unsigned types to existing dispatch:\u003C/strong>\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Before\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_ALL_TYPES));\n\n// After (method 1: add unsigned types explicitly)\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES));\n\n// After (method 2: use V2 integral types if AT_INTEGRAL_TYPES present)\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_INTEGRAL_TYPES_V2), AT_EXPAND(AT_FLOATING_TYPES));\u003C/code>\u003C/pre>\u003C/div>\u003Ch2>Type group reference\u003C/h2>\n\u003Cp>\u003Cstrong>Unsigned type groups:\u003C/strong>\u003C/p>\n\u003Cul>\n\u003Cli>\u003Ccode>AT_BAREBONES_UNSIGNED_TYPES\u003C/code>: kUInt16, kUInt32, kUInt64\u003C/li>\n\u003Cli>\u003Ccode>AT_INTEGRAL_TYPES_V2\u003C/code>: AT_INTEGRAL_TYPES + AT_BAREBONES_UNSIGNED_TYPES\u003C/li>\n\u003C/ul>\n\u003Cp>\u003Cstrong>Relationship:\u003C/strong>\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">AT_INTEGRAL_TYPES          // kByte, kChar, kInt, kLong, kShort\nAT_BAREBONES_UNSIGNED_TYPES  // kUInt16, kUInt32, kUInt64\nAT_INTEGRAL_TYPES_V2       // INTEGRAL_TYPES + BAREBONES_UNSIGNED_TYPES\u003C/code>\u003C/pre>\u003C/div>\u003Ch2>Instructions\u003C/h2>\n\u003Ch3>Step 1: Determine if conversion to V2 is needed\u003C/h3>\n\u003Cp>Check if the file uses AT_DISPATCH_V2:\u003C/p>\n\u003Cp>\u003Cstrong>If using old AT_DISPATCH:\u003C/strong>\u003C/p>\n\u003Cul>\n\u003Cli>First convert to AT_DISPATCH_V2 using the at-dispatch-v2 skill\u003C/li>\n\u003Cli>Then proceed with adding uint support\u003C/li>\n\u003C/ul>\n\u003Cp>\u003Cstrong>If already using AT_DISPATCH_V2:\u003C/strong>\u003C/p>\n\u003Cul>\n\u003Cli>Proceed directly to Step 2\u003C/li>\n\u003C/ul>\n\u003Ch3>Step 2: Analyze the current dispatch macro\u003C/h3>\n\u003Cp>Identify what type groups are currently in use:\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">AT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  // body\n}), AT_EXPAND(AT_ALL_TYPES), kHalf, kBFloat16);\n    ^^^^^^^^^^^^^^^^^^^^^^^^^\n    Current type coverage\u003C/code>\u003C/pre>\u003C/div>\u003Cp>Common patterns:\u003C/p>\n\u003Cul>\n\u003Cli>\u003Ccode>AT_EXPAND(AT_ALL_TYPES)\u003C/code> → includes AT_INTEGRAL_TYPES + AT_FLOATING_TYPES\u003C/li>\n\u003Cli>\u003Ccode>AT_EXPAND(AT_INTEGRAL_TYPES)\u003C/code> → signed integers only\u003C/li>\n\u003Cli>\u003Ccode>AT_EXPAND(AT_FLOATING_TYPES)\u003C/code> → floating point types\u003C/li>\n\u003C/ul>\n\u003Ch3>Step 3: Choose the uint addition method\u003C/h3>\n\u003Cp>Two approaches:\u003C/p>\n\u003Cp>\u003Cstrong>Method 1: Add AT_BAREBONES_UNSIGNED_TYPES explicitly\u003C/strong>\u003C/p>\n\u003Cul>\n\u003Cli>Use when: You want to be explicit about adding uint support\u003C/li>\n\u003Cli>Add \u003Ccode>AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES)\u003C/code> to the type list\u003C/li>\n\u003C/ul>\n\u003Cp>\u003Cstrong>Method 2: Substitute AT_INTEGRAL_TYPES with AT_INTEGRAL_TYPES_V2\u003C/strong>\u003C/p>\n\u003Cul>\n\u003Cli>Use when: The dispatch already uses \u003Ccode>AT_EXPAND(AT_INTEGRAL_TYPES)\u003C/code>\u003C/li>\n\u003Cli>More concise: replaces one type group with its superset\u003C/li>\n\u003Cli>Only applicable if AT_INTEGRAL_TYPES is present\u003C/li>\n\u003C/ul>\n\u003Ch3>Step 4: Apply the transformation\u003C/h3>\n\u003Cp>\u003Cstrong>Method 1 example:\u003C/strong>\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Before\nAT_DISPATCH_V2(\n    dtype,\n    &quot;min_values_cuda&quot;,\n    AT_WRAP([&amp;]() {\n      kernel_impl&lt;scalar_t&gt;(iter);\n    }),\n    AT_EXPAND(AT_ALL_TYPES),\n    kBFloat16, kHalf, kBool\n);\n\n// After (add unsigned types)\nAT_DISPATCH_V2(\n    dtype,\n    &quot;min_values_cuda&quot;,\n    AT_WRAP([&amp;]() {\n      kernel_impl&lt;scalar_t&gt;(iter);\n    }),\n    AT_EXPAND(AT_ALL_TYPES),\n    AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES),\n    kBFloat16, kHalf, kBool\n);\u003C/code>\u003C/pre>\u003C/div>\u003Cp>\u003Cstrong>Method 2 example:\u003C/strong>\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Before\nAT_DISPATCH_V2(\n    dtype,\n    &quot;integral_op&quot;,\n    AT_WRAP([&amp;]() {\n      kernel&lt;scalar_t&gt;();\n    }),\n    AT_EXPAND(AT_INTEGRAL_TYPES)\n);\n\n// After (substitute with V2)\nAT_DISPATCH_V2(\n    dtype,\n    &quot;integral_op&quot;,\n    AT_WRAP([&amp;]() {\n      kernel&lt;scalar_t&gt;();\n    }),\n    AT_EXPAND(AT_INTEGRAL_TYPES_V2)\n);\u003C/code>\u003C/pre>\u003C/div>\u003Ch3>Step 5: Handle AT_ALL_TYPES vs individual type groups\u003C/h3>\n\u003Cp>If the dispatch uses \u003Ccode>AT_EXPAND(AT_ALL_TYPES)\u003C/code>:\u003C/p>\n\u003Cul>\n\u003Cli>\u003Ccode>AT_ALL_TYPES\u003C/code> = \u003Ccode>AT_INTEGRAL_TYPES\u003C/code> + \u003Ccode>AT_FLOATING_TYPES\u003C/code>\u003C/li>\n\u003Cli>To add uint: add \u003Ccode>AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES)\u003C/code> to the list\u003C/li>\n\u003C/ul>\n\u003Cp>If the dispatch separately lists INTEGRAL and FLOATING:\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Before\nAT_EXPAND(AT_INTEGRAL_TYPES), AT_EXPAND(AT_FLOATING_TYPES)\n\n// After (Method 2 preferred)\nAT_EXPAND(AT_INTEGRAL_TYPES_V2), AT_EXPAND(AT_FLOATING_TYPES)\u003C/code>\u003C/pre>\u003C/div>\u003Ch3>Step 6: Verify all dispatch sites\u003C/h3>\n\u003Cp>Check the file for ALL dispatch macros that need uint support:\u003C/p>\n\u003Cul>\n\u003Cli>Some operators have multiple dispatch sites (CPU, CUDA, different functions)\u003C/li>\n\u003Cli>Apply the transformation consistently across all sites\u003C/li>\n\u003Cli>Ensure each gets the same type coverage updates\u003C/li>\n\u003C/ul>\n\u003Ch3>Step 7: Validate the changes\u003C/h3>\n\u003Cp>Check that:\u003C/p>\n\u003Cul>\n\u003Cli>\u003Cinput disabled=\"\" type=\"checkbox\"> AT_DISPATCH_V2 format is used (not old AT_DISPATCH)\u003C/li>\n\u003Cli>\u003Cinput disabled=\"\" type=\"checkbox\"> Unsigned types are added via one of the two methods\u003C/li>\n\u003Cli>\u003Cinput disabled=\"\" type=\"checkbox\"> All relevant dispatch sites in the file are updated\u003C/li>\n\u003Cli>\u003Cinput disabled=\"\" type=\"checkbox\"> Type groups use \u003Ccode>AT_EXPAND()\u003C/code>\u003C/li>\n\u003Cli>\u003Cinput disabled=\"\" type=\"checkbox\"> Arguments are properly formatted and comma-separated\u003C/li>\n\u003C/ul>\n\u003Ch2>Common patterns\u003C/h2>\n\u003Ch3>Pattern 1: AT_ALL_TYPES + extras\u003C/h3>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Before\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_ALL_TYPES), kHalf, kBFloat16);\n\n// After\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kHalf, kBFloat16);\u003C/code>\u003C/pre>\u003C/div>\u003Ch3>Pattern 2: Separate INTEGRAL + FLOATING\u003C/h3>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Before\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_INTEGRAL_TYPES), AT_EXPAND(AT_FLOATING_TYPES));\n\n// After\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_INTEGRAL_TYPES_V2), AT_EXPAND(AT_FLOATING_TYPES));\u003C/code>\u003C/pre>\u003C/div>\u003Ch3>Pattern 3: Old dispatch needs conversion first\u003C/h3>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Before (needs v2 conversion first)\nAT_DISPATCH_ALL_TYPES_AND2(kHalf, kBFloat16, dtype, &quot;op&quot;, [&amp;]() {\n  kernel&lt;scalar_t&gt;();\n});\n\n// After v2 conversion\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_ALL_TYPES), kHalf, kBFloat16);\n\n// After adding uint support\nAT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kHalf, kBFloat16);\u003C/code>\u003C/pre>\u003C/div>\u003Ch2>Multiple dispatch sites example\u003C/h2>\n\u003Cp>For a file with multiple functions:\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">void min_values_kernel_cuda(TensorIterator&amp; iter) {\n  AT_DISPATCH_V2(iter.dtype(), &quot;min_values_cuda&quot;, AT_WRAP([&amp;]() {\n    impl&lt;scalar_t&gt;(iter);\n  }), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kBFloat16, kHalf);\n  //                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  //                           Added uint support\n}\n\nvoid min_launch_kernel(TensorIterator &amp;iter) {\n  AT_DISPATCH_V2(iter.input_dtype(), &quot;min_cuda&quot;, AT_WRAP([&amp;]() {\n    gpu_reduce_kernel&lt;scalar_t&gt;(iter);\n  }), AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES), kBFloat16, kHalf);\n  //                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  //                           Added uint support here too\n}\u003C/code>\u003C/pre>\u003C/div>\u003Ch2>Decision tree\u003C/h2>\n\u003Cp>Use this decision tree to determine the approach:\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">Is the file using AT_DISPATCH_V2?\n├─ No → Use at-dispatch-v2 skill first, then continue\n└─ Yes\n   └─ Does it use AT_EXPAND(AT_INTEGRAL_TYPES)?\n      ├─ Yes → Replace with AT_EXPAND(AT_INTEGRAL_TYPES_V2)\n      └─ No → Add AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES) to type list\u003C/code>\u003C/pre>\u003C/div>\u003Ch2>Edge cases\u003C/h2>\n\u003Ch3>Case 1: Dispatch with only floating types\u003C/h3>\n\u003Cp>If the operator only supports floating point types, don&#39;t add uint support:\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">// Leave as-is - floating point only operator\nAT_DISPATCH_V2(dtype, &quot;float_op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_FLOATING_TYPES), kHalf);\u003C/code>\u003C/pre>\u003C/div>\u003Ch3>Case 2: Complex types present\u003C/h3>\n\u003Cp>Unsigned types work alongside complex types:\u003C/p>\n\u003Cdiv class=\"md-code-block\">\u003Cdiv class=\"md-code-lang\">cpp\u003C/div>\u003Cpre>\u003Ccode class=\"hljs language-plaintext\">AT_DISPATCH_V2(dtype, &quot;op&quot;, AT_WRAP([&amp;]() {\n  kernel&lt;scalar_t&gt;();\n}), AT_EXPAND(AT_ALL_TYPES),\n    AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES),\n    AT_EXPAND(AT_COMPLEX_TYPES),\n    kHalf, kBFloat16);\u003C/code>\u003C/pre>\u003C/div>\u003Ch3>Case 3: Already has uint support\u003C/h3>\n\u003Cp>Check if uint types are already present:\u003C/p>\n\u003Cul>\n\u003Cli>If \u003Ccode>AT_INTEGRAL_TYPES_V2\u003C/code> is used → already has uint support\u003C/li>\n\u003Cli>If \u003Ccode>AT_BAREBONES_UNSIGNED_TYPES\u003C/code> is already in list → already has uint support\u003C/li>\n\u003Cli>Skip the file if uint support is already present\u003C/li>\n\u003C/ul>\n\u003Ch2>Workflow\u003C/h2>\n\u003Cp>When asked to add uint support:\u003C/p>\n\u003Col>\n\u003Cli>Read the target file\u003C/li>\n\u003Cli>Check if using AT_DISPATCH_V2:\u003Cul>\n\u003Cli>If not → use at-dispatch-v2 skill first\u003C/li>\n\u003C/ul>\n\u003C/li>\n\u003Cli>Identify all dispatch macro sites\u003C/li>\n\u003Cli>For each dispatch:\u003Cul>\n\u003Cli>Analyze current type groups\u003C/li>\n\u003Cli>Choose method (add BAREBONES_UNSIGNED or upgrade to V2)\u003C/li>\n\u003Cli>Apply transformation with Edit tool\u003C/li>\n\u003C/ul>\n\u003C/li>\n\u003Cli>Show the user the changes\u003C/li>\n\u003Cli>Explain what was modified\u003C/li>\n\u003C/ol>\n\u003Ch2>Important notes\u003C/h2>\n\u003Cul>\n\u003Cli>Always check if v2 conversion is needed first\u003C/li>\n\u003Cli>Apply changes consistently across all dispatch sites in the file\u003C/li>\n\u003Cli>Method 2 (AT_INTEGRAL_TYPES_V2) is cleaner when applicable\u003C/li>\n\u003Cli>Method 1 (explicit AT_BAREBONES_UNSIGNED_TYPES) is more explicit\u003C/li>\n\u003Cli>Unsigned types are: kUInt16, kUInt32, kUInt64 (not kByte which is uint8)\u003C/li>\n\u003Cli>Some operators may not semantically support unsigned types - use judgment\u003C/li>\n\u003C/ul>\n\u003Ch2>Testing\u003C/h2>\n\u003Cp>After adding uint support, the operator should accept uint16, uint32, and uint64 tensors. The user is responsible for functional testing.\u003C/p>\n"]