torch-version-port

Ports torch_fl to a new PyTorch minor version by regenerating ATen codegen and reconciling dispatcher signatures.

12|18|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/flagos-ai/Torch-FL --skill torch-version-port-flagos-ai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: torch-version-port
Source: https://github.com/flagos-ai/Torch-FL/tree/main/.claude/skills/torch-version-port
Command: npx skills add https://github.com/flagos-ai/Torch-FL --skill torch-version-port-flagos-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When torch_fl must move to a different PyTorch minor version (e.g. creating a 2.9 branch or bumping to 2.11/2.12), the generated ATen bindings go stale and import torch_fl fails with "Mismatch in kernel C++ signatures". This Skill provides the hardware-independent workflow to pin a CPU-only torch, regenerate codegen against the new native_functions.yaml, and reconcile per-operator IListRef/ArrayRef signature rules. ## Core Features & Use Cases - Version branch management: Creates sibling per-torch-minor branches from main rather than inheriting stale signature fixes from other version branches. - ATen codegen regeneration: Runs scripts/codegen/codegen_ops.py against the newly pinned torch, with checks for dropped operators, failed FlagGems imports, and generator idempotency. - Signature reconciliation loop: Fixes the ArrayRef/IListRef rule in the generator (never hand-editing generated files) and iterates one operator at a time against the real import error. - Use Case: After bumping torch from 2.10 to 2.12, import torch_fl aborts on aten::cat with an IListRef/ArrayRef mismatch; use this Skill to re-derive the rule from the installed torchgen, regenerate, and verify the integration test suite. ## Quick Start Port torch_fl to PyTorch 2.9 by creating a new version branch, pinning a CPU-only torch 2.9, regenerating the ATen codegen, and fixing any kernel signature mismatches until import succeeds.

Frequently Asked Questions about torch-version-port

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

FAQPage Schema
How do I port torch_fl to a new PyTorch version?▼

Create a sibling branch from main, pin a CPU-only torch of the target version, then run FLAGOS_CODEGEN_ALL=1 python scripts/codegen/codegen_ops.py to regenerate the ATen bindings. Fix any signature mismatches in the generator and rebuild.

How to fix "Mismatch in kernel C++ signatures" after a torch upgrade?▼

The error means an operator's TensorList argument changed between ArrayRef<Tensor> and IListRef<Tensor> in the new torch version. Fix the rule or operator list in scripts/codegen/codegen_ops.py, regenerate, and repeat for each failing op.

Why must the torch pin be CPU-only during a version port?▼

The CUDA-compatible operator path supplies GPU symbols through a preloaded external libtorch_cuda.so. A pip CUDA torch introduces a second, possibly mismatched copy of those symbols, causing failures that get misattributed to codegen.

Can I hand-edit generated ATen binding files to fix signature errors?▼

No. Files under csrc/aten/generated/ are overwritten by the next codegen run, so hand edits revert and the bug returns. Always fix the rule or exception list in the generator script instead.

When should I not use the torch version port workflow?▼

Do not use it for chip enablement or hardware bringup; that belongs to the runtime-bringup skill. This workflow is strictly hardware-independent and covers only schema- and ABI-level version changes.