add-uint-support

Update AT_DISPATCH macros to add uint16, uint32, and uint64 support.

2|Updated May 9, 2025
One-click install
npx skills add https://github.com/linjunhui/cuda-learning --skill add-uint-support
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-uint-support
Source: https://github.com/linjunhui/cuda-learning/tree/main/Pytorch学习/pytorch/.claude/skills/add-uint-support
Command: npx skills add https://github.com/linjunhui/cuda-learning --skill add-uint-support

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates the complex and error-prone process of adding unsigned integer (uint) type support to PyTorch operators, saving developers time and ensuring consistent implementation across kernels.

Core Features & Use Cases

  • Automated Type Expansion: Automatically updates AT_DISPATCH macros to include uint16, uint32, and uint64 types.
  • Consistent Implementation: Ensures that PyTorch operators correctly handle unsigned integer data, preventing type-related bugs.
  • Decision Tree Guidance: Provides a clear decision tree to determine the best method for adding uint support (explicitly or by upgrading type groups).
  • Use Case: You are porting a numerical algorithm to PyTorch that heavily relies on unsigned 32-bit integers. Instead of manually modifying every AT_DISPATCH macro and risking errors, you use this Skill to automatically update the necessary operator definitions, ensuring your algorithm runs correctly with uint types.

Quick Start

Add unsigned integer support to the PyTorch operator defined in my_cuda_kernel.cpp.

Frequently Asked Questions about add-uint-support

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add unsigned integer type support to PyTorch operators?

Add unsigned integer support by updating AT_DISPATCH macros to include uint16, uint32, and uint64 types. Convert to AT_DISPATCH_V2, choose between explicit AT_BAREBONES_UNSIGNED_TYPES or AT_INTEGRAL_TYPES_V2, and apply changes consistently across all dispatch sites to broaden type coverage for CPU and CUDA kernels.

Can I use unsigned integers with PyTorch CUDA kernels?

Yes. This Skill enables unsigned integer support across CUDA and CPU contexts by automating AT_DISPATCH macro updates. It ensures PyTorch operators correctly handle uint16, uint32, and uint64 types in kernel implementations.

What's the best way to extend PyTorch operators to handle uint types?

Use AT_DISPATCH_V2 with either explicit AT_BAREBONES_UNSIGNED_TYPES or AT_INTEGRAL_TYPES_V2 type groups. The Skill provides a decision tree to determine which method fits your operator, then applies the changes consistently across all dispatch sites.

Why should I use AT_DISPATCH_V2 instead of the older AT_DISPATCH macro?

AT_DISPATCH_V2 provides cleaner type group management and better support for unsigned integer expansion. It reduces manual errors when adding uint16, uint32, and uint64 support across multiple dispatch sites in operator kernels.

Do I need to modify every AT_DISPATCH macro when adding uint support?

Yes. Consistent implementation across all dispatch sites is required to prevent type-related bugs and ensure PyTorch operators correctly handle unsigned integers throughout your kernel definitions.

What's the difference between AT_BAREBONES_UNSIGNED_TYPES and AT_INTEGRAL_TYPES_V2?

AT_BAREBONES_UNSIGNED_TYPES explicitly targets only unsigned types, while AT_INTEGRAL_TYPES_V2 includes both signed and unsigned integers. The Skill's decision tree guides you to choose based on your operator's type requirements.