/flagos-skills:flaggems-pr-submit-flagosfrom flagos-skills
Automates FlagGems operator PR submission: validates code compliance, runs pre-commit and worktree tests, generates PR descriptions with speedup data, and submits to upstream.
Ships in flagos-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
提交流程:规范名查询 → 建分支 → 提取 worktree 代码(6文件) → 脚本验证 → pre-commit → push → 创建 PR → 回填链接。
25+ 项检查已由
check_operator.py自动执行(详见下方检查表),以下仅列出模型需主动注意的规则。
check_operator.py --strict 必须 0 errorsoperator_registry.py lookup 查询operator_registry.py backfillgen_pr_description.py 输出 JSON,映射到模板(英文)_ 的算子,mark/yaml id/文件名去掉下划线,其余保留(详见 references/naming.md)utils.FLOAT_DTYPES,benchmark 用 consts.FLOAT_DTYPES;CUDA 不支持时可硬编码但必须加注释GenericBenchmark(input_fn=...);需要自定义 shape 时继承并覆盖 set_shapeseq / eq_scalar 模式flag_gems.device,不用 .is_cuda 或 device.type == "cuda"(多后端)logger.debug("GEMS <OP_NAME_UPPER>"),不用其他格式src/flag_gems/fused/,不放 src/flag_gems/ops/| 环境变量 | 必需 | 说明 | 默认值 |
|---|---|---|---|
FLAGGEMS_REPO | 是 | FlagGems 仓库本地路径 | — |
GH_TOKEN | 是 | GitHub Personal Access Token | — |
FLAGGEMS_FORK | 否 | Fork 仓库(自动从 git remote 推断) | XDYuanzhuLee/FlagGems |
FLAGGEMS_UPSTREAM | 否 | 上游仓库 | flagos-ai/FlagGems |
FLAGGEMS_NORM_XLSX | 否 | 规范名 Excel 路径 | /workspace/规范名.xlsx |
FLAGGEMS_PR_XLSX | 否 | 待提交算子 Excel 路径 | /workspace/第一批pr算子.xlsx |
FLAGGEMS_DOMESTIC_DIR | 否 | 国产 GPU 测试数据目录 | /workspace/国产GPU算子测试情况 |
每次新会话需确保 FLAGGEMS_REPO 和 GH_TOKEN 已设置(禁止硬编码)。
cd $FLAGGEMS_REPO
python <SCRIPTS_DIR>/operator_registry.py lookup <op>
cd $FLAGGEMS_REPO
git checkout -b pr/<op> upstream/master
确认算子不存在于上游。Never cherry-pick or rebase。
python <SCRIPTS_DIR>/extract_from_worktree.py <op> --repo-dir $FLAGGEMS_REPO
脚本自动从 worktree 提取 6 个文件:kernel、test、benchmark、ops/init.py、init.py、operators.yaml。 所有注册按字母序插入,所有代码从 worktree 原样提取。禁止手动编写 test/benchmark 代码。
脚本完成后检查 operators.yaml 的 description 是否需要补充(脚本可能使用默认占位描述)。
CUDA_VISIBLE_DEVICES=<N> python <SCRIPTS_DIR>/submit_operator.py <op> --repo-dir $FLAGGEMS_REPO
脚本串行执行 9 步(含 1.5 多重载检查):check_operator → 多重载一致性检查 → pre-commit → 本地测试 → 本地 benchmark → PR描述生成 → commit → push → 创建 PR → 回填链接。 任何一步失败立即中断退出。不允许手动执行单独步骤来绕过。
可选参数:
--dry-run — 只验证不提交(调试用)--skip-test — 跳过本地测试(仅当环境不支持时)--skip-benchmark — 跳过 benchmark,仅查国产卡数据references/workflow.md — Phase 2 六文件详细模板、代码 review 要点references/pr-template.md — PR 描述模板、JSON 字段映射references/naming.md — 下划线算子命名规则对照表references/pr-checklist.md — 提交前逐项检查清单references/common-issues.md — 历史 review 问题汇总scripts/check_operator.py — 自动化验证脚本(25+ 检查项)scripts/check_overload_consistency.py — 多重载算子 yaml/mark/op_name 一致性检查scripts/extract_from_worktree.py — 从 worktree 提取 6 个 PR 文件scripts/gen_pr_description.py — PR 描述数据生成scripts/submit_operator.py — 一站式提交(9 步串行)scripts/operator_registry.py — 规范名查询 + PR 链接回填scripts/pr_gate_check.sh — git push 前门禁(PreToolUse hook)| 检查 | 级别 |
|---|---|
| Kernel 文件存在 + KernelGen 首行 | error |
| 无 print()、无重复函数 | error |
| ops/init.py 注册 + 字母序 | error |
| _FULL_CONFIG 注册(映射到 wrapper) | error |
| Fallback 递归检测(kernel 中禁止 torch.()) | error |
| operators.yaml 完整性 + 唯一性 | error |
| 测试 pytest mark + import 方式 + gems_assert | error |
| gems_assert_close 无 rtol | error |
| dtype 硬编码检查(需常量或加注释) | error |
| 私有 API torch._xxx | error |
| Benchmark pytest mark + op_name + dtype | error |
| Git commit 无 Co-Authored-By | error |
| Inplace mark 守卫 | error |
| yaml/config 一致性交叉验证 | error |
| Anti-hack Layer 1 (AST) + Layer 2 (dual execution) | error |
| 单算子 PR(git diff 验证) | error |
| @use_tl_extra 未使用桩函数 | error |
| 硬编码超参无注释 | error |
| 上游冲突检查 | error |
| 测试函数命名规范 | warning |
| logging 模块、torch import | warning |
| 代码质量(行长、EOF、行尾空白) | warning |
| 别名封装、NaN 处理、Worktree 一致性、Wrapper dtype assert | warning |
| Benchmark case 数量 | info |
.is_cuda / device.type == "cuda" 硬编码设备判断 | error |
| Autotune configs 内联硬编码(应在 config 文件) | error |
Logger 格式不符合 "GEMS <OP_NAME_UPPER>" | error |
| Benchmark torch/gems 测量范围不一致 | error |
| 测试文件或 Benchmark 文件缺失 | error |
| Fused 算子放在 ops/ 而非 fused/ 目录 | error |
| 自定义 shapes 与 core_shapes.yaml 重复 | warning |
以下规则依赖领域判断,模型每次提交前必须逐项确认:
set_shapes?.is_cuda 或 device.type == "cuda"?必须用 flag_gems.devicelogger.debug 是否使用 "GEMS <OP_NAME_UPPER>" 格式?src/flag_gems/fused/ 而非 ops/?core_shapes.yaml 已有条目重复?submit_operator.py 使用 --strict 模式,所有 warning 升级为 error。模型不得手动绕过脚本。submit_operator.py 的 fatal() 自动追加事件到 pr状态记录.md,无需手动记录。LICENSE.txt (opens in a new tab)README.md (opens in a new tab)references/common-issues.md (opens in a new tab)references/naming.md (opens in a new tab)references/pr-checklist.md (opens in a new tab)references/pr-template.md (opens in a new tab)references/workflow.md (opens in a new tab)scripts/check_operator.py (opens in a new tab)scripts/check_overload_consistency.py (opens in a new tab)scripts/extract_from_worktree.py (opens in a new tab)scripts/gen_pr_description.py (opens in a new tab)scripts/operator_registry.py (opens in a new tab)scripts/pr_gate_check.sh (opens in a new tab)scripts/submit_operator.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub flagos-ai/skills --plugin flagos-skills12 skills in this plugin
/flaggems-pr-review-flagosThis skill should be used when reviewing FlagGems operator PRs, performing code review, self-reviewing before submission, or when the user mentions "review PR", "审PR", "代码review", "code review", "review #123", "self-review", "自审", "检查PR", "审查算子", "review operator". It fetches PR diffs, applies FlagGems domain-specific review rules (structural checks, naming, registration, tests, benchmarks), and posts inline review comments directly on GitHub.
/flagrelease-entrance-flagosFull FlagRelease pipeline orchestrator. Runs the complete LLM deployment, verification,
and benchmarking pipeline for multi-chip GPU backends. Executes: install-stack →
env-verify → model-verify → perf-test in sequence, passing state between steps
and producing a final structured report. Assumes gpu-container-setup (Step 1) is
already done — a running container with PyTorch + GPU access must exist.
/gpu-container-setup-flagosAutomatically detect GPU vendor, find appropriate PyTorch container image,
launch with correct mounts, and validate GPU functionality. Supports NVIDIA,
Ascend, Metax, Iluvatar, and AMD/ROCm. Use when user says "setup container",
"start pytorch container", or invokes /gpu-container-setup.
/install-stack-flagosInstall the 5-package multi-chip software stack (vLLM, FlagTree, FlagGems, FlagCX,
vllm-plugin-FL) inside a GPU container. Handles network mirror detection, dependency
ordering, wheel selection, and per-package validation. Use after gpu-container-setup
has produced a running container with PyTorch + GPU access.
/kernelgen-flagosUnified GPU kernel operator generation and optimization skill. Automatically detects the target repository type (FlagGems, vLLM, or general Python/Triton) and dispatches to the appropriate specialized sub-skill. Includes operator generation, MCP-based iterative optimization, and feedback submission sub-skills. Use this skill when the user wants to generate or optimize a GPU kernel operator, create a Triton kernel, or says things like "generate an operator", "create a kernel for X", "optimize triton kernel", or "/kernelgen-flagos".
/model-migrate-flagosMigrate a model from the latest vLLM upstream repository into the vllm-plugin-FL project (pinned at vLLM v0.13.0). Use this skill whenever someone wants to add support for a new model to vllm-plugin-FL, port model code from upstream vLLM, or backport a newly released model. Trigger when the user says things like "migrate X model", "add X model support", "port X from upstream vLLM", "make X work with the FL plugin", or simply "/model-migrate-flagos model_name". The model_name argument uses snake_case (e.g. qwen3_5, kimi_k25, deepseek_v4). Do NOT use for models already supported by vLLM 0.13.0 core, or for multimodal-only components that don't need backporting.
Other plugins' skills for the same job