#!/usr/bin/env python3 """重建批量测试的算子清单(inventory),并可校验迁移 shape yaml。 对每个 FlagGems 仓库静态扫描 benchmark/ 下的 test_*.py(含 test_ 前缀的 子目录,如 test_FLA/——op_file 记相对路径去前后缀,run_pytest.sh 的 `benchmark/test_${OP_FILE}.py` 拼接对其天然成立;models_benchmark/ 等 非 test_ 前缀路径不在性能批量范围): - 每个模块级 test_* 函数出一行 inventory:op(函数名去 test_ 前缀,即 run_pytest.sh 的 OP)、op_file(文件名去 test_ 前缀/.py 后缀,即 OP_FILE); - 标注 marked_skip(函数带无条件 pytest.mark.skip,跑了必 SKIP,批量驱动默认剔除); - 提取 op_name 字符串常量(op_name= 关键字实参,以及 *Benchmark 类 __init__ 里 super().__init__ 的首个字符串位置实参),用于 shape yaml 键校验; - --verify-collect 时额外跑一次 pytest --collect-only 核实函数确实可被收集 (AST 见到 ≠ pytest 收得到,import 失败/条件定义都会导致差异)。 产物: ops/inventory_