add-uint-support
Update PyTorch AT_DISPATCH_V2 macros to enable uint16, uint32, and uint64 support in operators and kernels.
Introduction
This skill automates the process of extending PyTorch operator type coverage by modifying AT_DISPATCH_V2 macros to include unsigned integer types. It is designed for software engineers working on the PyTorch core codebase who need to integrate uint16, uint32, and uint64 support into existing kernels. By ensuring type consistency across AT_DISPATCH_V2 definitions, the skill helps prevent dispatch errors and ensures that unsigned data types are handled correctly within the dispatcher framework.
The skill provides a systematic approach to identifying whether an operator is using modern V2 dispatch macros or needs migration. It handles various scenarios, including basic addition of barebones unsigned types, substitution of integral type groups, and updating complex dispatch sites that combine floating-point and integral types. It is specifically useful when you encounter build errors related to missing type support or when expanding the library's utility to better support unsigned integer inputs in tensor operations.
-
Enables support for kUInt16, kUInt32, and kUInt64 in C++ PyTorch kernels.
-
Automates the migration of legacy AT_DISPATCH macros to the modern AT_DISPATCH_V2 standard.
-
Integrates AT_BAREBONES_UNSIGNED_TYPES or AT_INTEGRAL_TYPES_V2 into dispatch logic to ensure type safety.
-
Updates all dispatch sites across a file to ensure consistent type support for CPU and CUDA implementations.
-
Maintains compatibility with existing AT_ALL_TYPES, AT_INTEGRAL_TYPES, and floating-point type groups.
-
Always verify the current dispatch configuration before modifying; use Method 2 (substituting with AT_INTEGRAL_TYPES_V2) for cleaner code when possible.
-
Ensure all occurrences of the dispatcher in a file are updated consistently to avoid runtime mismatches.
-
Inputs typically involve source files containing C++ dispatch macros; outputs are transformed code blocks compliant with PyTorch's V2 type dispatch standards.
-
Requires familiarity with the AT_EXPAND macro and the differences between integral and floating-point type group definitions.
-
If an operator uses the older AT_DISPATCH format, it must be refactored to AT_DISPATCH_V2 before applying the unsigned type enhancements.
Repository Stats
- Stars
- 99,514
- Forks
- 27,619
- Open Issues
- 18,535
- Language
- Python
- Default Branch
- main
- Sync Status
- Syncing
- Last Synced
- Apr 29, 2026, 07:01 AM