Merged
feat(ops-registry-invoke): 需求分析内容验收——生成侧适配+五维度逐子项验收skill #239
景明Add on Oct 30
feat(ops-registry-invoke): 需求分析内容验收——生成侧适配+五维度逐子项验收skill #239
Merged
景明Add on Oct 30
Total: 7 files changed+181-5
@@ -13,6 +13,7 @@
13 "workflow-dispatch",13 "workflow-dispatch",
14 "ops-incremental",14 "ops-incremental",
15 "ops-requirement-analysis",15 "ops-requirement-analysis",
16+ "req-content-acceptance",
16 "design-template",17 "design-template",
17 "ascendc-build-system",18 "ascendc-build-system",
18 "blackbox-tester",19 "blackbox-tester",
@@ -178,6 +178,7 @@ nodes:
178 - "Consult the local built-in proto at $ASCEND_OPP_PATH/built-in/op_proto/inc/ as the highest-authority CANN fact source."178 - "Consult the local built-in proto at $ASCEND_OPP_PATH/built-in/op_proto/inc/ as the highest-authority CANN fact source."
179 - "Use the chip platform recorded in $WORK_DIR/npu-arch.json as the runtime-environment evidence."179 - "Use the chip platform recorded in $WORK_DIR/npu-arch.json as the runtime-environment evidence."
180 - "Fill any missing customer-requirement fields with the skill's defaults (Ascend 950PR/950DT, single-op + PyTorch) and mark them as assumptions; decide autonomously, never ask the user."180 - "Fill any missing customer-requirement fields with the skill's defaults (Ascend 950PR/950DT, single-op + PyTorch) and mark them as assumptions; decide autonomously, never ask the user."
181+ - "After the requirements document is produced, load the req-content-acceptance skill (mandatory) and execute its acceptance procedure end-to-end, including its FAIL-remediation loop (the skill defines the per-sub-item evidence rules, the RECORD path and the per-stage redo routing); do not fabricate content to pass the gate."
181 acceptance:182 acceptance:
182 - "$WORK_DIR/requirements/REQUIREMENTS.md exists and is non-empty."183 - "$WORK_DIR/requirements/REQUIREMENTS.md exists and is non-empty."
183 - "The document has the fixed section structure (## 1 需求背景 through ## 8 需求分析总结) with all sections filled."184 - "The document has the fixed section structure (## 1 需求背景 through ## 8 需求分析总结) with all sections filled."
@@ -193,8 +194,9 @@ nodes:
193 - "Variant full coverage: every tiling and kernel variant in the overview tables has its own detailed subsection (compute flow + buffer allocation + tiling strategy); no 'same as template 1' skips."194 - "Variant full coverage: every tiling and kernel variant in the overview tables has its own detailed subsection (compute flow + buffer allocation + tiling strategy); no 'same as template 1' skips."
194 - "Framework registration is enumerated per evidence: any found plugin (TF/ONNX/Caffe) is listed with its ParseParams attribute mapping and registration code, each marked ✅/❌; none found is recorded as ❌, never silently omitted."195 - "Framework registration is enumerated per evidence: any found plugin (TF/ONNX/Caffe) is listed with its ParseParams attribute mapping and registration code, each marked ✅/❌; none found is recorded as ❌, never silently omitted."
195 - "The verifier reviews the document item by item against the fixed section, COPY, numbering, TOC, research, performance, and API requirements; every check passes."196 - "The verifier reviews the document item by item against the fixed section, COPY, numbering, TOC, research, performance, and API requirements; every check passes."
197+ - "The content acceptance is recorded at $WORK_DIR/requirements/req-content-acceptance.RECORD.md: the file exists and is non-empty (test -s), contains all 33 sub-item verdict rows, and carries an overall PASS verdict (a FAILED overall verdict fails this task); the verifier independently re-checks the RECORD's cited evidence against REQUIREMENTS.md rather than trusting the executor-written RECORD alone."
196 out_of_scope:198 out_of_scope:
197- - "Do not write spec.yaml, DESIGN.md, or any implementation code; this task only produces the requirements document and its research intermediates."199+ - "Do not write spec.yaml, DESIGN.md, or any implementation code; this task produces the requirements document, its research intermediates, and the req-content-acceptance RECORD."
198 depends_on:200 depends_on:
199 - setup-reference-repos201 - setup-reference-repos
200 max_retries: 1202 max_retries: 1
@@ -20,6 +20,7 @@ nodes:
20 - "Consult the local built-in proto at $ASCEND_OPP_PATH/built-in/op_proto/inc/ as the highest-authority CANN fact source."20 - "Consult the local built-in proto at $ASCEND_OPP_PATH/built-in/op_proto/inc/ as the highest-authority CANN fact source."
21 - "Use the chip platform recorded in $WORK_DIR/npu-arch.json as the runtime-environment evidence."21 - "Use the chip platform recorded in $WORK_DIR/npu-arch.json as the runtime-environment evidence."
22 - "Fill any missing customer-requirement fields with the skill's defaults (Ascend 950PR/950DT, single-op + PyTorch) and mark them as assumptions; decide autonomously, never ask the user."22 - "Fill any missing customer-requirement fields with the skill's defaults (Ascend 950PR/950DT, single-op + PyTorch) and mark them as assumptions; decide autonomously, never ask the user."
23+ - "After the requirements document is produced, load the req-content-acceptance skill (mandatory) and execute its acceptance procedure end-to-end, including its FAIL-remediation loop (the skill defines the per-sub-item evidence rules, the RECORD path and the per-stage redo routing); do not fabricate content to pass the gate."
23 acceptance:24 acceptance:
24 - "$WORK_DIR/requirements/REQUIREMENTS.md exists and is non-empty."25 - "$WORK_DIR/requirements/REQUIREMENTS.md exists and is non-empty."
25 - "The document has the fixed section structure (## 1 需求背景 through ## 8 需求分析总结) with all sections filled."26 - "The document has the fixed section structure (## 1 需求背景 through ## 8 需求分析总结) with all sections filled."
@@ -35,8 +36,9 @@ nodes:
35 - "Variant full coverage: every tiling and kernel variant in the overview tables has its own detailed subsection (compute flow + buffer allocation + tiling strategy); no 'same as template 1' skips."36 - "Variant full coverage: every tiling and kernel variant in the overview tables has its own detailed subsection (compute flow + buffer allocation + tiling strategy); no 'same as template 1' skips."
36 - "Framework registration is enumerated per evidence: any found plugin (TF/ONNX/Caffe) is listed with its ParseParams attribute mapping and registration code, each marked ✅/❌; none found is recorded as ❌, never silently omitted."37 - "Framework registration is enumerated per evidence: any found plugin (TF/ONNX/Caffe) is listed with its ParseParams attribute mapping and registration code, each marked ✅/❌; none found is recorded as ❌, never silently omitted."
37 - "The verifier reviews the document item by item against the fixed section, COPY, numbering, TOC, research, performance, and API requirements; every check passes."38 - "The verifier reviews the document item by item against the fixed section, COPY, numbering, TOC, research, performance, and API requirements; every check passes."
39+ - "The content acceptance is recorded at $WORK_DIR/requirements/req-content-acceptance.RECORD.md: the file exists and is non-empty (test -s), contains all 33 sub-item verdict rows, and carries an overall PASS verdict (a FAILED overall verdict fails this task); the verifier independently re-checks the RECORD's cited evidence against REQUIREMENTS.md rather than trusting the executor-written RECORD alone."
38 out_of_scope:40 out_of_scope:
39- - "Do not write spec.yaml, DESIGN.md, or any implementation code; this task only produces the requirements document and its research intermediates."41+ - "Do not write spec.yaml, DESIGN.md, or any implementation code; this task produces the requirements document, its research intermediates, and the req-content-acceptance RECORD."
40 depends_on: []42 depends_on: []
41 max_retries: 143 max_retries: 1
42 on_exhaust: exit44 on_exhaust: exit
@@ -109,7 +109,9 @@ aclnn 函数 `aclnn{PascalCase}`。版本后缀(V2/V3)是算子名组成部
109 109 
1101. **`code_walkthrough.md`**:按调用链路走读(Python 接口 → 注册/dispatch → OP 定义 → Kernel 实现),1101. **`code_walkthrough.md`**:按调用链路走读(Python 接口 → 注册/dispatch → OP 定义 → Kernel 实现),
111 贴关键代码 + 内联注释(规范同 `references/code_walkthrough_guide.md`)。111 贴关键代码 + 内联注释(规范同 `references/code_walkthrough_guide.md`)。
112-2. **`code_design.md`**:算子基本信息(含**正反向身份**)/ 对外接口与 dtype / 声明 / 注册与 dispatch 与类型支持 /112+2. **`code_design.md`**:算子基本信息(含**正反向身份**)/ 对外接口(Python 接口签名 + **调用示例**)与 dtype /
113+ **调用链路概述**(Python 接口 → 注册/dispatch → OP 定义 → Kernel 实现,浓缩自 walkthrough)/
114+ 声明 / 注册与 dispatch 与类型支持 /
113 OP 定义与封装(Shape 推导 / dtype 转换 / 规格约束)/ Kernel 实现(空 Tensor / 确定性 / 边界值 / workspace /115 OP 定义与封装(Shape 推导 / dtype 转换 / 规格约束)/ Kernel 实现(空 Tensor / 确定性 / 边界值 / workspace /
114 tiling / 计算步骤 / 分支)/ 实现评估(优化点 / NPU 可迁移性 / 不足)。116 tiling / 计算步骤 / 分支)/ 实现评估(优化点 / NPU 可迁移性 / 不足)。
1153. **`formula.md`**:从竞品 **Kernel 实现**直接提取公式(规则同 `references/formula_template.md`),1173. **`formula.md`**:从竞品 **Kernel 实现**直接提取公式(规则同 `references/formula_template.md`),
@@ -160,7 +162,8 @@ aclnn 函数 `aclnn{PascalCase}`。版本后缀(V2/V3)是算子名组成部
160 162 
1611. **COPY 研究中间件**:模板中标 `COPY: <file>` 的章节,把对应 research 文件**逐字复制原文**(禁止摘要 / 改写 / 省略),1631. **COPY 研究中间件**:模板中标 `COPY: <file>` 的章节,把对应 research 文件**逐字复制原文**(禁止摘要 / 改写 / 省略),
162 遵守 `references/output_template.md` 的「COPY 规范」(丢一级标题、标题降档、开头追加源链接)。164 遵守 `references/output_template.md` 的「COPY 规范」(丢一级标题、标题降档、开头追加源链接)。
163-2. **自行生成章节**:需求背景(帮助读者从 0 理解算子功能,关注算子本身)、框架差异对比(据各 code_design.md 汇总对比表)、165+2. **自行生成章节**:需求背景(帮助读者从 0 理解算子功能,关注算子本身;并按输出模板 §1 明确写出
166+ **支持的通路 / 既有算子支持度(A2) / 新旧兼容性(A5↔A2)**三项)、框架差异对比(据各 code_design.md 汇总对比表)、
164 客户需求(网络信息 / 运行环境 / 调用方式 / 性能要求,用默认值时标「假设」)、需求分析总结(交付件清单 + ACLNN/GEIR 接口设计 + 框架兼容性)。167 客户需求(网络信息 / 运行环境 / 调用方式 / 性能要求,用默认值时标「假设」)、需求分析总结(交付件清单 + ACLNN/GEIR 接口设计 + 框架兼容性)。
165 其中**交付件清单按输出模板的「调用方式 → 交付件」映射推导取并集**(不写固定全"是");168 其中**交付件清单按输出模板的「调用方式 → 交付件」映射推导取并集**(不写固定全"是");
166 **接口设计遵守能力并集不可收窄原则**(代际补齐 / 新增 kernel 场景:不减 dtype、不移参数,新 kernel 声明子集 +169 **接口设计遵守能力并集不可收窄原则**(代际补齐 / 新增 kernel 场景:不减 dtype、不移参数,新 kernel 声明子集 +
@@ -36,3 +36,6 @@
363. 数值稳定性:逐项标来源363. 数值稳定性:逐项标来源
374. 源码位置关联表:公式步骤 | 源码位置 | 指令链374. 源码位置关联表:公式步骤 | 源码位置 | 指令链
385. 多 dtype 分支说明(有则必列)385. 多 dtype 分支说明(有则必列)
39+6. python 小算子参考实现:与接口语义一致的 golden 表达式或小算子拼接约定(优先竞品接口;
40+ 无竞品算子时用 PyTorch/TF 小算子拼接,禁 numpy),保证与竞品接口调用结果一致;
41+ 用于后续 golden 实现与需求侧公式互证。
@@ -25,7 +25,12 @@
25## 1 需求背景25## 1 需求背景
26 26 
27<!-- 自行生成:帮助开发者从 0 理解这个算子是什么,描述算子必要功能,关注算子本身。来源:客户 prompt + 模型知识 + WebSearch。27<!-- 自行生成:帮助开发者从 0 理解这个算子是什么,描述算子必要功能,关注算子本身。来源:客户 prompt + 模型知识 + WebSearch。
28- 末段点明本次需求:目标芯片、目标框架、支持 dtype、以何种方式(registry-invoke / Ascend C)开发。 -->28+ 末段点明本次需求:目标芯片、目标框架、支持 dtype、以何种方式(registry-invoke / Ascend C)开发。
29+ 另须明确写出三项(验收标准 §5.1 需求背景维度):
30+ 1. 支持的通路:单算子/图模型 + 具体框架(与 §7.3 调用方式一致);
31+ 2. 既有算子支持度:A2 既有实现存在/不存在/部分覆盖(与 §5 交付件总览一致,一句话并指向 §5);
32+ 3. 新旧兼容性:A5 与 A2 的兼容说明(含所有通路、kernel;代际补齐时对应 §8.2 不可收窄原则;
33+ 全新算子写明"无既有实现,不涉及新旧兼容")。 -->
29 34 
30## 2 模型分析35## 2 模型分析
31 36 
@@ -0,0 +1,160 @@
1+---
2+name: req-content-acceptance
3+description: >-
4+ 对已生成的 REQUIREMENTS.md 做内容级验收——按算子需求分析的五块维度(需求背景/模型场景/
5+ 竞品算子/存量算子/需求总结)逐子项检查内容覆盖度,每个子项必须引用文档章节或原文片段
6+ 作为证据;不适用子项以文档写明的"无/❌"声明为证据。只做验收,不改文档。输出 PASS/FAILED
7+ 与逐项判定表,写入 requirements/req-content-acceptance.RECORD.md。
8+disable-model-invocation: true
9+---
10+ 
11+# 需求文档内容验收 Skill
12+ 
13+## 你的角色
14+ 
15+你是**需求文档的内容验收者**——在 `analyze-requirements` 节点产出 REQUIREMENTS.md 后,
16+按下方验收清单逐维度、逐子项检查内容是否写到位。只判定 PASS 或 FAILED,
17+不改文档、不补内容、不给修改建议。
18+ 
19+**只信文档里写出的内容**:子项证据必须来自 REQUIREMENTS.md 本身;research/ 下的研究中间件
20+里"其实做过"不等于文档里写了——本 skill 验收的是文档内容覆盖度,不是生成过程。
21+ 
22+## 输入
23+ 
24+- `$WORK_DIR/requirements/REQUIREMENTS.md`(被验收的需求文档,由 ops-requirement-analysis skill 产出)
25+ 
26+## 执行程序
27+ 
28+1. 通读 REQUIREMENTS.md 全文(含目录),建立各维度对应的章节定位。
29+2. 按下方清单逐子项取证:每个子项沿"维度 → 章节锚点"定位后,判定
30+ **PASS**(内容已写出,证据 = 章节号 + 对应内容要点或原文片段)、
31+ **N/A**(对本算子不适用,证据 = 文档中明确写出的"无/❌/不支持"声明及所在章节)或
32+ **FAIL**(两者皆无——既没写出内容,也没写明不适用)。空白不等于不适用。
33+3. 汇总判定:任一维度整块缺失 → 该维度所有子项 FAIL,总判定 FAILED。
34+4. 写入 `$WORK_DIR/requirements/req-content-acceptance.RECORD.md`(逐项判定表 + 证据 + 总判定)。
35+5. 自检:RECORD 的判定行数 = 子项总数(33 项,见清单),无跳行、无整段概判;
36+ greenfield 豁免必须引用 §5 的 greenfield 声明原文。
37+ 
38+## 维度 → 章节锚点
39+ 
40+| 验收维度 | 子项 ID | REQUIREMENTS.md 对应章节 |
41+|---|---|---|
42+| 需求背景 | B1–B3 | §1 需求背景 |
43+| 模型场景 | M1–M3 | §2 模型分析 |
44+| 竞品算子 | C1–C13 | §3 竞品分析 - TensorFlow / §4 竞品分析 - PyTorch(含各 §x 公式推导) |
45+| 存量算子 | S1–S8 | §5 CANN 方案分析 |
46+| 需求总结 | R1–R6 | §6 框架差异对比 + §7 客户需求 + §8 需求分析总结 |
47+ 
48+## 验收清单
49+ 
50+### 维度一:需求背景(B1–B3)
51+ 
52+| ID | 子项 | 验收要点 |
53+|---|---|---|
54+| B1 | 支持的通路 | 明确列出算子需支持的通路(单算子/图模型,具体框架) |
55+| B2 | 既有算子支持度 | 既有算子的支持情况(A2:存在/不存在/部分覆盖) |
56+| B3 | 新旧兼容性 | 新算子与既有的兼容性说明(A5 与 A2,含所有通路、kernel;全新算子写明"无既有实现,不涉及新旧兼容") |
57+ 
58+### 维度二:模型场景(M1–M3)
59+ 
60+| ID | 子项 | 验收要点 |
61+|---|---|---|
62+| M1 | 典型模型 | 使用此算子的典型模型(至少一个,或明确说明无典型模型) |
63+| M2 | 算子位置 | 算子所在模型的结构及对应位置 |
64+| M3 | 权威参考 | 信息来源(论文/官方文档/竞品仓,带链接或路径) |
65+ 
66+### 维度三:竞品算子(C1–C13)
67+ 
68+按**文档实际对标的竞品框架**分章取证(如仅对标 PyTorch,则 §3"无 TensorFlow 对标"
69+的声明即为该框架侧的不适用证据);对标多个框架时,每个子项对每个对标框架都要有证据。
70+ 
71+| ID | 子项 | 验收要点 |
72+|---|---|---|
73+| C1 | Python 接口定义 | 接口签名 + 调用示例 |
74+| C2 | 输入输出 dtype | 支持的数据类型列表 |
75+| C3 | 调用链路 | 从接口到 kernel 实现的调用链路(文档内链路概述:Python 接口 → 注册/dispatch → OP 定义 → Kernel 实现) |
76+| C4 | Shape 推导 | 推导逻辑(静态/动态/广播) |
77+| C5 | 输入输出约束 | 规格、范围、限制条件 |
78+| C6 | 空 Tensor 处理 | 是否支持、如何处理 |
79+| C7 | 计算确定性 | 是否确定性计算、多轮一致性 |
80+| C8 | 边界值处理 | 极值/NaN/Inf/零值的行为 |
81+| C9 | Workspace | 内存占用 |
82+| C10 | 模板分支 | 多模板/多路径实现说明 |
83+| C11 | 分核策略 | 单核/多核/切分策略 |
84+| C12 | 执行步骤 | 计算流程(有精度提升时体现) |
85+| C13 | 公式 | 输入输出含义、符号定义、公式、关联源码、数值稳定性、多 dtype 处理、python 小算子一致性 |
86+ 
87+### 维度四:存量算子(S1–S8,CANN 现状)
88+ 
89+| ID | 子项 | 验收要点 |
90+|---|---|---|
91+| S1 | 覆盖总览 | 交付件覆盖情况总览表 |
92+| S2 | GEIR | 定义、输入/输出/属性 |
93+| S3 | 信息库/OpDef | 类型、Format、芯片差异配置 |
94+| S4 | aclnn | 参数校验、dtype 列表、芯片版本支持 |
95+| S5 | Infershape | shape 推导、dtype 推导逻辑 |
96+| S6 | Tiling & Kernel | 模板划分、Buffer 分配、Tiling 策略、计算流图、精度分析、确定性 |
97+| S7 | 插件 | 注册声明、框架映射、参数映射 |
98+| S8 | 融合 pass | 关键逻辑及功能 |
99+ 
100+**全新算子无 CANN 存量**时,此维度整体标注"无存量算子(greenfield)"并 PASS,不判 FAIL。
101+ 
102+### 维度五:需求总结(R1–R6)
103+ 
104+| ID | 子项 | 验收要点 |
105+|---|---|---|
106+| R1 | 框架差异 | 参数差异、核心公式、精度策略、类型支持、workspace |
107+| R2 | 网络信息 | 用户提供(shape 规格、性能数据等)或明确说明无 |
108+| R3 | 运行环境 | 芯片平台 |
109+| R4 | 调用方式 | 单算子/图模型、PyTorch/TensorFlow/ONNX 等 |
110+| R5 | 交付件清单 | 按调用方式推导需交付的组件列表 |
111+| R6 | API 设计 | aclnn/geir 字段名、类型、范围、Format、兼容性 |
112+ 
113+## 判定规则
114+ 
115+- 任一维度整块缺失 → **FAILED**(该维度所有子项 FAIL)
116+- 子项内容未写出、不适用也未声明 → 该子项 FAIL,不得以"隐含""推测"通过
117+- **N/A 硬格式**:不适用子项的合格证据 = 文档中明确写出的"无/❌/不支持"声明 + 所在章节
118+ (与工作流口径一致:未找到记 ❌,不得静默省略);空白 ≠ 不适用,空白 = FAIL
119+- 全部子项 PASS 或 N/A → **PASS**
120+ 
121+## 与 ops-requirement-analysis skill 的关系
122+ 
123+本 skill 验收的对象就是 `ops-requirement-analysis` skill 产出的 REQUIREMENTS.md——
124+它的五块维度对应需求分析 skill 流水线的三阶段产出:
125+ 
126+| 验收维度 | 对应需求分析产出 |
127+|---|---|
128+| 需求背景 + 模型场景 | 阶段1 算子名解析 + 阶段2 模型研究 |
129+| 竞品算子 | 阶段2 竞品研究(TF / PyTorch) |
130+| 存量算子 | 阶段2 CANN 方案研究 |
131+| 需求总结 | 阶段3 需求汇总 |
132+ 
133+如果某维度 FAIL,说明需求分析 skill 对应阶段的产出不完整——**修复方式是拿着本 skill 的
134+FAIL 子项清单,回到 ops-requirement-analysis skill 重做对应阶段**(只做 FAIL 的维度,
135+已 PASS 的维度不动),完成后重新调用本 skill 验收,直到全部 PASS。不是在本 skill 里编造。
136+ 
137+## 输出
138+ 
139+写入 `$WORK_DIR/requirements/req-content-acceptance.RECORD.md`:
140+ 
141+```markdown
142+# REQUIREMENTS.md 内容验收报告
143+ 
144+**判定**: PASS / FAILED
145+ 
146+## 逐项结果
147+ 
148+| ID | 维度 | 子项 | 判定 | 证据(章节/原文片段) |
149+|---|---|---|---|---|
150+| B1 | 需求背景 | 支持的通路 | PASS | §1 "支持单算子 + PyTorch/GEIR 图模式" |
151+| C13 | 竞品算子 | 公式 | PASS | §4.1 公式推导 + 符号定义列表,含数值稳定性说明 |
152+| S8 | 存量算子 | 融合 pass | N/A | §5.6 "❌ 未发现融合 pass"(明确声明无) |
153+| ... | ... | ... | ... | ... |
154+```
155+ 
156+## 边界
157+ 
158+- 只验收 REQUIREMENTS.md 的内容覆盖度,不做文档结构检查(章节结构与格式由工作流节点的 verifier 按既有 acceptance 条目把关)
159+- 不验收精度/性能(由验证节点负责)
160+- 不修改任何文档,只读 + 写 RECORD