flaggems-integration

Enable and validate FlagGems Python or C++ operator routing on torch-fl accelerators.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, flag_gems, triton.

What problem does it solve? Integrating FlagGems portable compiler kernels into a torch-fl accelerator backend is error-prone: environment mismatches, non-idempotent codegen, RNG state bugs, and inflated support claims from routing tables that were never measured. This Skill provides a rigorous, step-by-step workflow to enable and validate FlagGems operator routing with real hardware evidence. ## Core Features & Use Cases - Environment Isolation and Discovery: Records torch, FlagGems, and Triton versions, isolates vendor compiler environments, and runs torchgen-based discovery via codegen_ops.py without leaking a second PyTorch into the build. - Idempotent Code Generation: Verifies the generator produces identical patches across runs and regenerates wrappers, registration, and platform conf files together. - Measured Correctness Validation: Runs config consistency tests, RNG state probes, and a per-overload CPU-referenced survey producing STRICT, BASIC_ONLY, FAILED, or UNTESTED verdicts. - Use Case: After bringing up a new Ascend or MUSA platform, use this Skill to route operators to FlagGems, measure per-overload correctness on hardware, and update operator-support documentation with honest evidence. ## Quick Start Use the flaggems-integration skill to enable FlagGems routing on my accelerator platform and validate the operator support with the overload survey.

Frequently Asked Questions about flaggems-integration

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

FAQPage Schema
How do I integrate FlagGems kernels into a PyTorch accelerator plugin?▼

Run torchgen-based discovery with codegen_ops.py in the exact build environment, regenerate wrappers and platform conf files together, then validate each routed overload against a CPU reference on hardware. Routing presence alone is not operator support.

How do I choose between FlagGems Python and C++ operator routes?▼

Python routes use the flagos_python backend discovered from flag_gems._FULL_CONFIG, while the C++ path routes a small explicit kernel set without the Python GIL. Both are per-op keys inside one platform conf, selected with flaggems or flaggems_cpp values.

Can FlagGems coexist with CUDA boxing or native vendor kernels?▼

Yes, FlagGems and CUDA boxing may coexist per operator, and native backends handle operators FlagGems cannot express. Establish the boxing or native path first, then route additional operators to FlagGems with documented fallback policy.

Why does FlagGems codegen produce different output on repeated runs?▼

Non-idempotent output usually comes from unordered discovery, unstable config ordering, embedded timestamps, or a mutable FlagGems registry. Fix the generator in codegen_ops.py rather than editing generated files, then confirm two runs produce identical patches.

Why is a successful FlagGems import not proof of operator support?▼

Import success and routing table entries only indicate candidates for testing. Support verdicts come from the overload survey, which executes synthesized cases against a CPU reference and classifies operators as STRICT, BASIC_ONLY, FAILED, or UNTESTED.

When should I not use FlagGems for an operator?▼

Do not use FlagGems when the vendor API cannot be expressed by its kernels or when the platform compiler cannot run the route. Route that operator through the CUDA-compatible or native backend and document the boundary instead of handwriting bypass kernels.