Merged
新增ops-registry-invoke 模块化工作流 #113
新增ops-registry-invoke 模块化工作流 #113
Merged
zhangzijieAdd on Oct 9
Total: 10 files changed+2201-0
@@ -0,0 +1,141 @@
1+# ACLNN migration module (prototype-first chain, second of two). Translates a
2+# green torch direct-invoke prototype (produced by the proto-impl module) into
3+# the ACLNN engineering form, regression-verifies the migrated package against
4+# the prototype's own blackbox case set, then code-reviews and documents it.
5+# Input: a complete proto-impl run's artifacts (the prototype/ tree with its
6+# recorded all-pass blackbox results, plus the frozen anchors golden.py,
7+# spec/spec.yaml, npu-arch.json, ttk.conf.yaml). Output: an ACLNN op/ package
8+# ported from the prototype, built and deployed, regression-green on the
9+# prototype's full case set through TTK aclnn mode and on a re-pointed torch
10+# e2e subset, with a recorded code review and the paired public docs. This is
11+# the prototype-first counterpart of the design-first chain (op-impl.yaml +
12+# blackbox.yaml); it runs standalone on a finished proto-impl work_dir. The
13+# orchestrator wires the Codex layout ($WORK_DIR/.agents/skills plus
14+# $WORK_DIR/.codex/agents) automatically via link_agent_config.py.
15+workflow: aclnn-migrate
16+max_parallel: 10
17+system_prompt: If needed, dispatch multi subagents to explore the direct-invoke prototype under $WORK_DIR/prototype/ and the migrated operator package under $WORK_DIR/op/ relevant to this task, as migration reference.
18+nodes:
19+ - id: verify-inputs
20+ task_type: normal
21+ executor: general-executor
22+ verifier: general-verifier
23+ title: Module boundary gate - verify the proto-impl artifacts contract and freeze the prototype baseline
24+ goal:
25+ - 'Prove the frozen proto-impl artifacts in $WORK_DIR satisfy the aclnn-migrate module''s input contract before any migration work starts: the direct-invoke prototype tree exists with its recorded all-pass blackbox results, and the frozen anchors (spec, golden, npu-arch, ttk config) exist — so the migration translates a proven prototype against known-good anchors.'
26+ - 'Completion gate: every input-contract check passes, the prototype''s recorded blackbox run is all-pass (the proto-impl runner gate $WORK_DIR/prototype/check_results.py exits 0), and the prototype baseline digest file is written so the downstream regression can prove the prototype was never silently edited.'
27+ approach:
28+ - 'This node verifies, never fixes: the inputs are final proto-impl products. A failing check is a module-boundary violation (a fixture defect), reported as FAILED with the failing check named — do not edit any input to make a check pass.'
29+ - 'Derive the operator''s name forms from spec.yaml: OP_SNAKE = op.name, OP_PASCAL = PascalCase.'
30+ - 'Frozen anchors: $WORK_DIR/golden.py (the independent TestSpec oracle), $WORK_DIR/spec/spec.yaml (the identifier-of-record for names, dtypes and the shape/attr contract), $WORK_DIR/npu-arch.json (the SoC the migrated package must build for), $WORK_DIR/ttk.conf.yaml (the third_party cross_check config).'
31+ - 'The prototype tree $WORK_DIR/prototype/ is the migration''s porting source and its regression oracle. Its contract (the proto-impl module''s output): op_kernel/ holds the direct-invoke kernel source(s) (*.asc); op_host/ holds the host+main driver source(s) (*.asc); op_extension/ holds the torch adapter (the *_torch.cpp TORCH_LIBRARY registration plus ops.h and register.cpp); the package root holds CMakeLists.txt, run.sh, and the generic python entry run_case.py (run_case(shapes, dtypes, attrs) -> output tensors).'
32+ - 'The prototype case set is $WORK_DIR/prototype/cases.csv (the proto-impl blackbox-torch set: one recorded row per spec boundary_conditions/extreme_inputs case, carrying its shape(s), dtype(s), attrs and expected behavior) and its recorded run is $WORK_DIR/prototype/results.csv (per-case status PASS/FAIL/REJECTED/EMPTY) with the evidence log $WORK_DIR/prototype/blackbox.RECORD.md; run_cases.py and check_results.py are that runner and its gate. These are exactly the artifacts the regression-aclnn node adapts into aclnn mode and re-runs through the migrated ACLNN package.'
33+ - 'Freeze the baseline: write $WORK_DIR/migration/PROTOTYPE_BASELINE.md naming each prototype input with its sha256 (the prototype case set cases.csv and its recorded results results.csv, the prototype kernel and adapter sources under op_kernel/, op_host/ and op_extension/, plus the anchors), and write the machine-checkable digest file $WORK_DIR/migration/PROTOTYPE_BASELINE.sha256 in sha256sum format covering those files, with ABSOLUTE paths so sha256sum -c is location-independent; downstream nodes run sha256sum -c --quiet against it.'
34+ acceptance:
35+ - 'Frozen anchors and toolkit present: test -s $WORK_DIR/golden.py && test -s $WORK_DIR/spec/spec.yaml && test -s $WORK_DIR/npu-arch.json && test -s $WORK_DIR/ttk.conf.yaml && test -d $WORK_DIR/ops-test-kit.'
36+ - 'Prototype tree present (proto-impl layout): test -d $WORK_DIR/prototype/op_kernel && test -d $WORK_DIR/prototype/op_host && test -d $WORK_DIR/prototype/op_extension && test -f $WORK_DIR/prototype/CMakeLists.txt && test -f $WORK_DIR/prototype/run.sh && test -s $WORK_DIR/prototype/run_case.py.'
37+ - 'Prototype kernel and torch adapter sources present: find $WORK_DIR/prototype -name ''*.asc'' | grep -q . && test -n "$(find $WORK_DIR/prototype/op_extension -name ''*_torch.cpp'')".'
38+ - 'Prototype case set and recorded run present: test -s $WORK_DIR/prototype/cases.csv && test -s $WORK_DIR/prototype/results.csv && test -s $WORK_DIR/prototype/run_cases.py && test -s $WORK_DIR/prototype/check_results.py && test -s $WORK_DIR/prototype/blackbox.RECORD.md.'
39+ - 'Prototype run is all-pass (proto-impl''s own gate): python3 $WORK_DIR/prototype/check_results.py exits 0 — results.csv covers exactly the in-fence set of cases.csv and holds 0 FAIL.'
40+ - 'Baseline frozen and well-formed: test -s $WORK_DIR/migration/PROTOTYPE_BASELINE.md && test -s $WORK_DIR/migration/PROTOTYPE_BASELINE.sha256 && sha256sum -c --quiet $WORK_DIR/migration/PROTOTYPE_BASELINE.sha256 exits 0.'
41+ out_of_scope:
42+ - 'Verify only: no file under $WORK_DIR/prototype/, $WORK_DIR/golden.py, $WORK_DIR/spec/, $WORK_DIR/ops-test-kit/, $WORK_DIR/npu-arch.json or $WORK_DIR/ttk.conf.yaml is modified; the only writes are $WORK_DIR/migration/PROTOTYPE_BASELINE.md and $WORK_DIR/migration/PROTOTYPE_BASELINE.sha256.'
43+ - 'Do not run any device test, package build or ttk batch in this node; do not fix a failing check — report it.'
44+ depends_on: []
45+ max_retries: 2
46+ on_exhaust: exit
47+ - id: migrate-package
48+ task_type: normal
49+ executor: general-executor
50+ verifier: general-verifier
51+ title: Translate the direct-invoke prototype into the ACLNN operator package and build it green
52+ goal:
53+ - 'Translate the proven direct-invoke prototype at $WORK_DIR/prototype/ into the ACLNN operator package at $WORK_DIR/op/: op_host/ (the OpDef *_def.cpp plus infershape and tiling), op_kernel/ (the prototype''s kernel compute adapted to the package''s TilingData/TilingFunc structure), op_api/ (aclnn_<op>.h/.cpp L2 plus <op>.h/.cpp L0), and the package-root CMakeLists.txt + build.sh — so the package builds green for the SoC recorded in $WORK_DIR/npu-arch.json, installs into $WORK_DIR/dev-package, and exports the aclnn L2 symbol pair.'
54+ - 'The kernel LOGIC is translated from the prototype, not reinvented: the prototype''s proven compute and data flow are the porting source; this task only changes the plumbing — the framework context replaces the prototype''s runtime platform queries, the package build replaces the standalone CMake, and TilingData fields replace the prototype''s plain struct.'
55+ - 'Completion gate: the package builds (exit 0) for the recorded SoC, installs into $WORK_DIR/dev-package, exports the aclnn<OpPascal>GetWorkspaceSize / aclnn<OpPascal> symbol pair, and the prototype-to-package provenance is recorded in $WORK_DIR/migration/MIGRATION.md.'
56+ approach:
57+ - 'Initialize the package skeleton from the ascendc-registry-invoke-template skill into $WORK_DIR/op/ and rename it to the target operator, exactly as op-impl.yaml''s setup-op-package does: resolve the template through the skill symlink (WORKFLOW_YAML=$(python3 -c "import json; print(json.load(open(''$WORK_DIR/.workflow/status.json''))[''workflow''])") ; TEMPLATE_DIR=$(dirname "$(dirname "$WORKFLOW_YAML")")/skills/ascendc-registry-invoke-template), copy references/add_example/. to $WORK_DIR/op/, drop the template tests/, and replace every sample name form (add_example->OP_SNAKE, AddExample->OP_PASCAL, ADD_EXAMPLE->OP_UPPER).'
58+ - 'Interface is the identifier-of-record: $WORK_DIR/spec/spec.yaml''s io table fixes the input/output names, declaration order, dtypes and attrs; the prototype''s torch adapter signature ($WORK_DIR/prototype/op_extension/*_torch.cpp with its $WORK_DIR/prototype/run_case.py entry, the interface the proto-impl stage proved) confirms arg order and optionality. Where spec.yaml and the prototype signature disagree, spec.yaml wins for names/dtypes and the disagreement is recorded in $WORK_DIR/migration/MIGRATION.md.'
59+ - 'op_host/: write $WORK_DIR/op/op_host/*_def.cpp so its OpDef body matches spec.yaml''s inputs/outputs/attrs in declaration order; fill *_infershape.cpp from spec.yaml''s shape/dtype rules; implement the TilingFunc and TilingData struct by porting the prototype host harness''s validated runtime split (core-count and UB-budget queries, tile shape and loop structure) into TilingContext/CompileInfo-based field computation.'
60+ - 'op_kernel/: port the prototype kernel''s compute and data flow into the package''s kernel entry, reading TilingData instead of the prototype''s plain struct; keep the compute semantics identical (same dtype/cast contract, broadcast and boundary behavior) — the prototype is the working reference, not throwaway.'
61+ - 'op_api/: rewrite the four files $WORK_DIR/op/op_api/aclnn_<op>.h/.cpp (L2) and <op>.h/.cpp (L0) so aclnn<OpPascal>GetWorkspaceSize''s parameter list is exactly spec.yaml''s inputs, then attrs, then outputs, following the op-impl.yaml update-op-api rewrite pattern; keep the template''s l0op-style structure (null/dtype checks, Contiguous handling, executor creation, launcher-list registration).'
62+ - 'CMakeLists.txt + build.sh: the SoC/arch argument comes from $WORK_DIR/npu-arch.json — never hardcoded; build with cd $WORK_DIR/op && ./build.sh with the SoC argument required for the architecture recorded in $WORK_DIR/npu-arch.json (exit 0; the CMake falls back to $ENV{ASCEND_HOME_PATH} when CANN_HOME is unset), then install the produced run package $WORK_DIR/op/build/custom_opp_ubuntu_x86_64.run into $WORK_DIR/dev-package the way setup-op-package does the template install (rm -rf $WORK_DIR/dev-package first).'
63+ - 'Record provenance in $WORK_DIR/migration/MIGRATION.md: for each ported prototype source (the kernel/driver sources under $WORK_DIR/prototype/op_kernel/ and $WORK_DIR/prototype/op_host/, and the torch adapter under $WORK_DIR/prototype/op_extension/) the $WORK_DIR/op/ file it produced, and every deliberate deviation from the prototype with its reason.'
64+ acceptance:
65+ - 'Package skeleton present: test -d $WORK_DIR/op/op_host && test -d $WORK_DIR/op/op_kernel && test -d $WORK_DIR/op/op_api && test -d $WORK_DIR/op/op_graph && test -f $WORK_DIR/op/build.sh && test -f $WORK_DIR/op/CMakeLists.txt.'
66+ - 'Four op_api files exist for the operator''s own name: OP_SNAKE=$(python3 -c "import yaml; print(yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml''))[''op''][''name''])") ; test -f $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.h && test -f $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.cpp && test -f $WORK_DIR/op/op_api/${OP_SNAKE}.h && test -f $WORK_DIR/op/op_api/${OP_SNAKE}.cpp.'
67+ - 'No sample-name residue: ! grep -RniE ''add_example|AddExample|ADD_EXAMPLE|addExample'' $WORK_DIR/op/.'
68+ - 'Build passes for the recorded SoC: cd $WORK_DIR/op && ./build.sh with the SoC argument required for the architecture recorded in $WORK_DIR/npu-arch.json exits 0.'
69+ - 'Deployment installed: test -s $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so.'
70+ - 'L2 symbol pair exported: nm -D $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so | grep -cE '' T aclnn<OP_PASCAL>(GetWorkspaceSize)?$'' equals 2 (with <OP_PASCAL> substituted from spec.yaml).'
71+ - 'Provenance recorded: test -s $WORK_DIR/migration/MIGRATION.md && grep -qF ''prototype'' $WORK_DIR/migration/MIGRATION.md.'
72+ out_of_scope:
73+ - 'Modify only $WORK_DIR/op/, the artifacts build.sh regenerates ($WORK_DIR/op/build/ and the fresh $WORK_DIR/dev-package/ install), and $WORK_DIR/migration/; every prototype file under $WORK_DIR/prototype/, $WORK_DIR/spec/, $WORK_DIR/golden.py, $WORK_DIR/npu-arch.json and $WORK_DIR/ttk.conf.yaml is read-only.'
74+ - 'Do not change the operator''s semantics — the kernel math, dtype/cast contract, broadcast and boundary behavior come from the prototype and spec.yaml unchanged; no performance optimization.'
75+ depends_on:
76+ - verify-inputs
77+ max_retries: 2
78+ on_exhaust: exit
79+ - id: regression-aclnn
80+ task_type: normal
81+ executor: general-executor
82+ verifier: general-verifier
83+ title: Regression - the prototype's full case set green through the migrated ACLNN package, plus a re-pointed torch e2e
84+ goal:
85+ - 'Prove the migrated ACLNN package reproduces the prototype''s results: run the prototype''s FULL blackbox case set through the migrated package via TTK aclnn mode — every positive case precision-PASS at spec tolerance and every negative case rejected — and re-run the prototype''s original torch harness, re-pointed to the aclnn path, green on a sampled subset covering every dtype combination.'
86+ - 'Completion gate: the positive ACLNN suite is all-green (parse_result.py --expect-total N exits 0), the negative suite is all-rejected (parse_result.py --negative exits 0), the torch e2e subset is green, and the prototype baseline digests are unchanged.'
87+ approach:
88+ - 'Locate the regression suite source: the prototype''s own blackbox case set $WORK_DIR/prototype/cases.csv (one recorded row per boundary_conditions/extreme_inputs case, carrying its shape(s), dtype(s), attrs and expected behavior), restricted to the in-fence set the proto-impl runner actually executed — exactly the case rows $WORK_DIR/prototype/results.csv records (cases.csv holds the full set; the 2**22 case-size fence subset is what ran). Adapt that in-fence set into aclnn mode under $WORK_DIR/op/tests/aclnn/testcases/ with a recorded python pre-pass that maps each case row into a TTK aclnn case row — api_name = aclnn<OP_PASCAL>, the tensor descriptors (shapes/dtypes) mapped to the operator''s spec.yaml inputs/outputs by name, the attributes from the case''s attrs — splitting positive rows (recorded expected behavior is not the rejection classification) into aclnn_<OP_SNAKE>_l0_functional.csv and negative rows (recorded expected behavior is the rejection classification, e.g. raises_error) into aclnn_<OP_SNAKE>_l2_exception.csv. The prototype and the migrated package share spec.yaml''s interface, so the case semantics are identical; record the row mapping and the positive/negative split counts in regression.RECORD.md.'
89+ - 'Merge into the executable TTK suites with the blackbox-tester skill''s merge_cases.py (column-union, offset normalization; its exact-suffix matching keeps any *_oversized.csv side table out by construction): python3 the blackbox-tester skill''s merge_cases.py $WORK_DIR/op/tests/aclnn/testcases --positive-out $WORK_DIR/op/tests/aclnn/regression_all.csv --negative-out $WORK_DIR/op/tests/aclnn/regression_l2_neg.csv; record each suite''s data-row count — the --expect-total value for the gates.'
90+ - 'Run TTK aclnn mode from $WORK_DIR/ops-test-kit (the blackbox-tester skill is the invocation authority for environment, vendor visibility, bin-path proof and result parsing). Positive suite, full: rm -f $WORK_DIR/op/tests/aclnn/result.csv; python3 -m ttk aclnn -i $WORK_DIR/op/tests/aclnn/regression_all.csv --pc=1 --task-prof false --run 1 --device-whitelist 0 --input-dist uniform --compare stat_rel_err --plugin $WORK_DIR/golden.py -o $WORK_DIR/op/tests/aclnn/result.csv; negative suite likewise to result_l2.csv. Resumes and reruns always via -t by name; the suite stays whole, never staged or sampled.'
91+ - 'Phase 2 - adjudicate failed positive rows: rerun each row whose precision_status is not PASS with -t by name adding --compare cross_check --config $WORK_DIR/ttk.conf.yaml (third_party torch via the local xpu-server), writing $WORK_DIR/op/tests/aclnn/result-crosscheck.csv; a case that passes under cross_check is adjudicated green, a case still failing enters precision localization and fix. Skip this phase when phase 1 is all-green.'
92+ - 'Gate with the blackbox-tester skill''s parse_result.py: python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/aclnn/result.csv --expect-total <regression_all data-row count> exits 0 (pass==total, fail==skip==0); the negative suite python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/aclnn/result_l2.csv --negative --expect-total <regression_l2_neg data-row count> exits 0 (pass==0, every row rejected).'
93+ - 'Operator-source proof before trusting any result: run the blackbox-tester skill''s check_op_binpath.py on the debug log with --optype $OP_PASCAL --expect-dir $WORK_DIR/dev-package/vendors/$OP_PASCAL --require (exit 0) — the tested kernel must come from this migration''s own deployment, never a built-in or stale vendor.'
94+ - 'Torch e2e regression: re-point the prototype''s original torch harness ($WORK_DIR/prototype/op_extension/ with its $WORK_DIR/prototype/run_case.py entry) to the migrated ACLNN path — bind it to the aclnn op (a torch_npu custom-op registration or a direct op_api call) and run it on a sampled subset of the prototype case set of at least 5 cases that together cover every dtype combination in spec.yaml''s supported_combinations; every sampled case must stay green. Keep the re-pointed harness under $WORK_DIR/op/tests/torch/ (run.sh + run.log; a copy, never the frozen prototype) and record the sampling (case names plus dtype coverage).'
95+ - 'Fix discipline: migration bugs are fixed inside $WORK_DIR/op/ (op_host/, op_kernel/, op_api/, op_graph/, CMakeLists.txt); after any code change rebuild and redeploy (cd $WORK_DIR/op && ./build.sh for the recorded SoC) before rerunning. Never edit the prototype, spec.yaml, golden.py, the tolerances or the case set to force green.'
96+ - 'Prototype-frozen check: sha256sum -c --quiet $WORK_DIR/migration/PROTOTYPE_BASELINE.sha256 exits 0 — the prototype case set and recorded results are byte-identical to the verify-inputs baseline; a mismatch means the prototype was silently edited to make migration pass, which is a FAIL, not a pass.'
97+ - 'Failure triage per the blackbox-tester skill''s guide (build failure -> ascendc-compile-debug; AIC error, crash, error codes, hang, timeout -> ascendc-runtime-debug; wrong precision -> ascendc-precision-debug with the tolerance from $WORK_DIR/spec/spec.yaml; TTK-framework-level failure -> ttk-how-diagnose). Evidence: $WORK_DIR/op/tests/aclnn/regression.RECORD.md records suite row counts, per-case results, the fix history, the commands run and the prototype-frozen check.'
98+ acceptance:
99+ - 'Suites built: test -s $WORK_DIR/op/tests/aclnn/regression_all.csv && test -s $WORK_DIR/op/tests/aclnn/regression_l2_neg.csv; the two --expect-total counts equal their suites'' data-row counts.'
100+ - 'Suite derives from the prototype case set: the positive and negative adapter suites together cover every executed prototype case — their data-row counts sum to the $WORK_DIR/prototype/results.csv data-row count (the in-fence set the proto-impl runner ran), so no executed prototype case is silently dropped (recorded in regression.RECORD.md).'
101+ - 'Positive gate all-green: after adjudication every case in the suite is green — all-green phase 1 is exactly python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/aclnn/result.csv --expect-total <regression_all data-row count> exits 0; otherwise parse_result.py $WORK_DIR/op/tests/aclnn/result-crosscheck.csv --expect-total <phase-1 non-PASS count> also exits 0 and the union covers the suite.'
102+ - 'Negative gate all-rejected: python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/aclnn/result_l2.csv --negative --expect-total <regression_l2_neg data-row count> exits 0.'
103+ - 'Operator source proven: check_op_binpath.py with --optype $OP_PASCAL --expect-dir $WORK_DIR/dev-package/vendors/$OP_PASCAL --require exits 0.'
104+ - 'Torch e2e subset green: bash $WORK_DIR/op/tests/torch/run.sh exits 0 with no FAILED row, and the sampled subset is at least 5 cases covering every supported dtype combination (recorded in regression.RECORD.md).'
105+ - 'Prototype frozen: sha256sum -c --quiet $WORK_DIR/migration/PROTOTYPE_BASELINE.sha256 exits 0.'
106+ - 'Evidence recorded: test -s $WORK_DIR/op/tests/aclnn/regression.RECORD.md.'
107+ out_of_scope:
108+ - 'Modification whitelist: $WORK_DIR/op/op_host/, op_kernel/, op_api/, op_graph/, CMakeLists.txt and the build/test artifacts regenerated under $WORK_DIR/op/tests/aclnn/ and $WORK_DIR/op/tests/torch/; everything else is read-only — the prototype tree ($WORK_DIR/prototype/, never modify), $WORK_DIR/spec/, $WORK_DIR/golden.py, the tolerances, $WORK_DIR/npu-arch.json and $WORK_DIR/ttk.conf.yaml.'
109+ - 'The case set, golden, tolerances and the prototype baseline stay as-is; a case that cannot pass without deviating from the prototype or spec stays red with its attribution (oracle/prototype defect).'
110+ depends_on:
111+ - migrate-package
112+ max_retries: 2
113+ on_exhaust: exit
114+ - id: review-docs
115+ task_type: normal
116+ executor: general-executor
117+ verifier: general-verifier
118+ title: Code-review the migrated package (fix within op/) and generate the paired operator docs
119+ goal:
120+ - 'Code-review the migrated package and generate its operator docs: run the ascendc-code-review skill over $WORK_DIR/op/ (op_host/, op_graph/, op_kernel/, op_api/) to produce the aggregated report $WORK_DIR/code-review/CODE_REVIEW.md, close every blocking (FAIL) finding inside $WORK_DIR/op/ and re-run the migration regression gates green, then run the ascendc-docs-gen skill to produce the paired public docs.'
121+ - 'Completion gate: the review report exists with its verdict line, no FAIL finding is left unresolved (each closed in $WORK_DIR/code-review/CODE_REVIEW_FIX.md, or a zero-findings no-op recorded), the paired docs exist non-empty, and — when a fix touched $WORK_DIR/op/ — the regression gates hold on regenerated results.'
122+ approach:
123+ - 'Load the ascendc-code-review skill first (mandatory) and run its file-review workflow end to end (rule routing, per-clause review, line verification) as agents/code-reviewer.md with this workflow''s path overlay: the review inputs are $WORK_DIR/op/op_host/, $WORK_DIR/op/op_graph/, $WORK_DIR/op/op_kernel/ and $WORK_DIR/op/op_api/; the report lands at $WORK_DIR/code-review/CODE_REVIEW.md. Every FAIL / SUSPICIOUS finding keeps a unique F / S id, a full path and a line-verified line number.'
124+ - 'The report''s first line is a single status — **状态**: ✅通过 when no FAIL finding is listed, **状态**: ❌失败 otherwise. Also run the ops-impl-review skill''s deterministic scripts over the migrated package — scalar_mainchain_check, vf_reachability_check and non3510_scaffold_check against $WORK_DIR/op, and workspace_consistency_check only when a design root exists (a proto-first work_dir has no $WORK_DIR/design/, so record it not-applicable rather than running it against a missing design) — saving each full output under $WORK_DIR/code-review/checks/; a script verdict of FAIL folds in as a FAIL finding, INCONCLUSIVE as SUSPICIOUS.'
125+ - 'Fix loop (this node owns it): when the review reports blocking (FAIL) findings, confirm each at its cited location, fix only inside $WORK_DIR/op/ (op_host/, op_kernel/, op_api/, op_graph/, CMakeLists.txt), rebuild and redeploy (cd $WORK_DIR/op && ./build.sh for the recorded SoC), and re-run the migration regression gates (regression-aclnn''s TTK aclnn suites and the re-pointed torch e2e) until they hold again; record every closure in $WORK_DIR/code-review/CODE_REVIEW_FIX.md. Zero FAIL findings -> record the no-op and change no code. A finding that cannot be fixed without deviating from spec or design stays open with its attribution.'
126+ - 'Then load the ascendc-docs-gen skill (mandatory — the single execution authority for doc structure, evidence sourcing and the paired delivery order) and generate the paired public docs from verifiable facts: the aclnn API interface doc $WORK_DIR/op/docs/aclnn<OpPascal>.md first, then $WORK_DIR/op/README.md linking it; expose both under the workflow path with ln -sfn op/docs $WORK_DIR/docs. <OpPascal> is confirmed against the hand-written public header $WORK_DIR/op/op_api/aclnn_<op_snake>.h, never guessed from directory names.'
127+ - 'Do not append to any LOG file and do not reply DONE — logging is the workflow runner''s job.'
128+ acceptance:
129+ - 'Review report present with a verdict: test -s $WORK_DIR/code-review/CODE_REVIEW.md exits 0 and its first line matches head -1 $WORK_DIR/code-review/CODE_REVIEW.md | grep -qE ''^\*\*状态\*\*:[[:space:]]*(✅通过|❌失败)[[:space:]]*$''.'
130+ - 'Blocking findings closed: test -s $WORK_DIR/code-review/CODE_REVIEW_FIX.md exits 0 and every FAIL finding id listed in CODE_REVIEW.md appears in CODE_REVIEW_FIX.md (verifier cross-checks the ids one by one), or the zero-findings no-op is explicitly recorded with no code modified.'
131+ - 'Paired docs present: OP_PASCAL=$(python3 -c "import yaml; n=yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml''))[''op''][''name'']; print(''''.join(w.capitalize() for w in n.split(''_'')))") ; test -s $WORK_DIR/op/docs/aclnn${OP_PASCAL}.md && test -s $WORK_DIR/op/README.md && test -s $WORK_DIR/docs/aclnn${OP_PASCAL}.md.'
132+ - 'README links the doc it ships with: grep -qF "docs/aclnn${OP_PASCAL}.md" $WORK_DIR/op/README.md.'
133+ - 'Regression holds when code changed: when this task modified any file under $WORK_DIR/op/, the migration regression was re-run green — python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/aclnn/result.csv --expect-total <regression_all data-row count> exits 0, the negative gate likewise, and bash $WORK_DIR/op/tests/torch/run.sh exits 0.'
134+ - 'Frozen assets unchanged: $WORK_DIR/prototype/, $WORK_DIR/spec/spec.yaml, $WORK_DIR/golden.py, the tolerances and $WORK_DIR/npu-arch.json are unmodified (verifier checks against the pre-task state).'
135+ out_of_scope:
136+ - 'Modify only $WORK_DIR/code-review/, $WORK_DIR/op/docs/, $WORK_DIR/op/README.md, the $WORK_DIR/docs symlink, and (for fixes) $WORK_DIR/op/op_host/, op_kernel/, op_api/, op_graph/, CMakeLists.txt plus the build/dev-package artifacts they regenerate; everything else is read-only.'
137+ - 'Never modify the prototype tree, $WORK_DIR/spec/, $WORK_DIR/golden.py, the tolerances, the ACLNN regression case set, or $WORK_DIR/npu-arch.json to make a gate green; a suspected code defect is attributed in the report, never patched in the doc''s place.'
138+ depends_on:
139+ - regression-aclnn
140+ max_retries: 3
141+ on_exhaust: exit
@@ -0,0 +1,180 @@
1+# Blackbox verification module, extracted from the retired op-develop monolith
2+# (blackbox-gen / blackbox-smoke / blackbox-run-l0-100pct / blackbox-run-l1-100pct /
3+# blackbox-run-l2-100pct) plus the new verify-inputs module boundary gate. Input:
4+# a complete op-impl run's artifacts (op/ package with its tiling UT and whitebox
5+# suites, golden.py, spec/, design/, requirements/, npu-arch.json, ttk.conf.yaml).
6+# Output: the operator verified to zero precision problems — L0/L1 positive suites
7+# 100% green, L2 negative suite fully rejected, closing regression holding.
8+# The orchestrator wires the Codex layout ($WORK_DIR/.agents/skills plus
9+# $WORK_DIR/.codex/agents) automatically via link_agent_config.py.
10+workflow: blackbox
11+max_parallel: 10
12+system_prompt: If needed, dispatch multi subagents to explore the operator package under $WORK_DIR/op/ and the requirements under $WORK_DIR/requirements/ relevant to this task, as verification reference.
13+nodes:
14+ - id: verify-inputs
15+ task_type: normal
16+ title: Module boundary gate - verify the op-impl artifacts contract and rebuild the deployment
17+ executor: general-executor
18+ verifier: general-verifier
19+ depends_on: []
20+ goal:
21+ - "Prove the frozen op-impl artifacts in $WORK_DIR satisfy the blackbox module's input contract before any verification work starts: every required input exists, the op package rebuilds for the target SoC, and its aclnn API installs into $WORK_DIR/dev-package with the exported L2 symbol pair — so every later node tests a known-good deployment of this work_dir's own package."
22+ - "Completion gate: the build exits 0, the installed libcust_opapi.so exports the aclnn<OpPascal>GetWorkspaceSize / aclnn<OpPascal> symbol pair, and every input-contract file check passes."
23+ approach:
24+ - "This node verifies, never fixes: the inputs are final op-impl products. A failing check is a module-boundary violation (a fixture defect), reported as FAILED with the failing check named — do not edit any source to make a check pass."
25+ - "Derive the operator's name forms from spec.yaml: OP_SNAKE = op.name, OP_PASCAL = PascalCase."
26+ - "Input-contract files: $WORK_DIR/golden.py, $WORK_DIR/spec/spec.yaml, $WORK_DIR/requirements/REQUIREMENTS.md, $WORK_DIR/design/ (with Validation.md), $WORK_DIR/npu-arch.json, $WORK_DIR/ttk.conf.yaml; the package skeleton $WORK_DIR/op/op_host/, $WORK_DIR/op/op_kernel/, $WORK_DIR/op/op_api/, $WORK_DIR/op/op_graph/, $WORK_DIR/op/build.sh, $WORK_DIR/op/CMakeLists.txt; the op_api four files $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.h, aclnn_${OP_SNAKE}.cpp, ${OP_SNAKE}.h, ${OP_SNAKE}.cpp; the closing-regression assets $WORK_DIR/op/tests/tiling/run.sh + test_tiling_gtest.cpp and at least one $WORK_DIR/op/tests/whitebox/branch-*/ttk_design_doc_cases.csv."
27+ - "Rebuild the package from its own sources: cd $WORK_DIR/op && ./build.sh with the SoC argument required for the architecture recorded in $WORK_DIR/npu-arch.json exits 0 (the build's CMake falls back to $ENV{ASCEND_HOME_PATH} when CANN_HOME is unset; only if both are unset, source the toolkit's set_env.sh first)."
28+ - "Reinstall into this work_dir's own deployment: rm -rf $WORK_DIR/dev-package, then install the produced run package $WORK_DIR/op/build/custom_opp_ubuntu_x86_64.run with bash <run package> --quiet --nox11 --force --install-path=$WORK_DIR/dev-package (the --force skips the installer's bundled-python pre-validation, which cannot load in this container)."
29+ acceptance:
30+ - "Input-contract files present: test -s $WORK_DIR/golden.py && test -s $WORK_DIR/spec/spec.yaml && test -s $WORK_DIR/requirements/REQUIREMENTS.md && test -s $WORK_DIR/design/Validation.md && test -s $WORK_DIR/npu-arch.json && test -s $WORK_DIR/ttk.conf.yaml && test -d $WORK_DIR/op/op_host && test -d $WORK_DIR/op/op_kernel && test -d $WORK_DIR/op/op_api && test -d $WORK_DIR/op/op_graph && test -f $WORK_DIR/op/build.sh && test -f $WORK_DIR/op/CMakeLists.txt."
31+ - "op_api four files present: test -f $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.h && test -f $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.cpp && test -f $WORK_DIR/op/op_api/${OP_SNAKE}.h && test -f $WORK_DIR/op/op_api/${OP_SNAKE}.cpp."
32+ - "Build passes: cd $WORK_DIR/op && ./build.sh with the SoC argument required for the architecture recorded in $WORK_DIR/npu-arch.json exits 0."
33+ - "Deployment installed: test -s $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so."
34+ - "L2 symbol pair exported: nm -D $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so | grep -cE ' T aclnn<OP_PASCAL>(GetWorkspaceSize)?$' equals 2 (with <OP_PASCAL> substituted from spec.yaml)."
35+ - "Closing-regression assets present: test -f $WORK_DIR/op/tests/tiling/run.sh && test -s $WORK_DIR/op/tests/tiling/test_tiling_gtest.cpp && find $WORK_DIR/op/tests/whitebox -name ttk_design_doc_cases.csv | grep -q ."
36+ out_of_scope:
37+ - "Verify only: no file under $WORK_DIR/op/, golden.py, spec/, design/, requirements/, npu-arch.json or ttk.conf.yaml is modified; the only writes are the build artifacts under $WORK_DIR/op/build/ and the fresh $WORK_DIR/dev-package/ install."
38+ - "Do not run any device test, ttk batch, tiling UT or whitebox batch in this node; do not fix a failing check — report it."
39+ max_retries: 2
40+ on_exhaust: exit
41+ - id: blackbox-gen
42+ task_type: normal
43+ title: Generate the blackbox ACLNN ST case set (L0/L1/L2 plus oversized side tables)
44+ executor: general-executor
45+ verifier: general-verifier
46+ depends_on:
47+ - verify-inputs
48+ goal:
49+ - "Produce the full blackbox ACLNN ST case set under $WORK_DIR/op/tests/blackbox/ (design/ intermediates + testcases/ standard *_l0_functional.csv, *_l1_functional.csv, *_l2_exception.csv) for the operator in $WORK_DIR/spec/spec.yaml, designed one-shot from facts independent of the design line: $WORK_DIR/requirements/REQUIREMENTS.md plus the actual interface facts — the proto sources under $WORK_DIR/op/op_graph/ and the actual OpDef in $WORK_DIR/op/op_host/*_def.cpp; reading $WORK_DIR/design/*.md or any existing case set is forbidden, so the blackbox suite stays independent of the whitebox/design line."
50+ - "Completion gate: the ascendc-st-design skill's generation, QA and review stages all pass; the case parameter interface (names, order, types, optionality, defaults, output positions; api_name = aclnn<OpPascal>) matches the actual OpDef; resource-oversized cases are isolated into same-stem *_oversized.csv side tables that stay out of the executable suites."
51+ approach:
52+ - "Load the ascendc-st-design skill first (mandatory — it is the single execution authority for blackbox modeling, generation, QA and standard artifacts; do not restate or bypass its stage procedure); adapt its output layout to this workflow: design/ and testcases/ under $WORK_DIR/op/tests/blackbox/."
53+ - "Fact mapping (this workflow's equivalent of the agent doc's REQUIREMENTS + proto.md inputs): $WORK_DIR/requirements/REQUIREMENTS.md -> supported scope, value domains, error semantics; $WORK_DIR/op/op_graph/ proto sources + the actual OpDef in $WORK_DIR/op/op_host/*_def.cpp -> parameter ABI and tensor-to-tensor shape bindings. An explicit conflict between the two fact inputs that would flip a positive/negative classification is reported as FAILED with both locations — never guessed away."
54+ - "Run ascendc-st-design once, for the ACLNN suite under tests/blackbox/. Targets are predetermined; no interface-selection prompt. Cover applicable rank-0 inputs. Every tensor's support_non_contiguous is declared explicitly from the facts (false unless explicitly supported); ValueDepend(OPTIONAL) is modeled per the ACLNN ABI; negative scenarios lock original inputs, never derived quantities."
55+ - "After the standard CSVs fully pass the skill's generation/QA/review, isolate oversized cases: python3 $WORK_DIR/.agents/the ops-registry-invoke skill's scripts/isolate_oversized_cases.py <the three standard CSVs under $WORK_DIR/op/tests/blackbox/testcases/> — over-threshold rows move to same-stem *_oversized.csv side tables that never enter the executable suites; thresholds may only be set via the script's documented env overrides and must be recorded; do not shrink factor domains, hand-edit CSVs, or delete side tables to dodge the isolation."
56+ - "Record $WORK_DIR/op/tests/blackbox/WORKFLOW_PROVENANCE.json: both fact inputs, the skill's real path and repo revision, conflict conclusions, standard artifacts, per-layer main/side-table counts and effective thresholds, the public QA conclusions, and any requirement scenario that could not be landed."
57+ acceptance:
58+ - "The ACLNN suite contains the independently generated standard L0/L1/L2 CSVs and the full public design/QA reports."
59+ - "Standard CSVs exist non-empty (each glob resolves at least one file): test -s $WORK_DIR/op/tests/blackbox/testcases/*_l0_functional.csv && test -s $WORK_DIR/op/tests/blackbox/testcases/*_l1_functional.csv && test -s $WORK_DIR/op/tests/blackbox/testcases/*_l2_exception.csv."
60+ - "Design intermediates exist non-empty: $WORK_DIR/op/tests/blackbox/design/ contains the skill's standard artifacts 01_parameter_description.md, 02_test_factors.yaml, 03_scenario_enumeration.md, 04_constraints.py, 05_topology.md, 06_review_report.md, each non-empty."
61+ - "api_name consistency: OP_PASCAL=$(python3 -c \"import yaml; n=yaml.safe_load(open('$WORK_DIR/spec/spec.yaml'))['op']['name']; print(''.join(w.capitalize() for w in n.split('_')))\") ; a python3 csv.DictReader pass over the three standard CSVs asserts every data row's api_name is exactly aclnn$OP_PASCAL."
62+ - "Interface consistency with the actual OpDef: parameter names, order, optionality, defaults and output positions in the case set match $WORK_DIR/op/op_host/*_def.cpp, and the tensor-to-tensor shape bindings match the proto contract (st-verifier cross-checks item by item)."
63+ - "Oversized isolation is effective and stable: rerunning isolate_oversized_cases.py over the three main CSVs exits 0 and moves zero further rows; *_oversized.csv rows are excluded from the executable suites and the side-table counts are recorded in WORKFLOW_PROVENANCE.json."
64+ - "$WORK_DIR/op/tests/blackbox/WORKFLOW_PROVENANCE.json exists, parses as JSON, and records both fact inputs, skill path + revision, conflict conclusions, main/side-table counts and effective thresholds."
65+ - "st-verifier reviews per its 用例生成 dimensions (standard artifacts present, structure coverage, interface/shape-binding consistency, no hand-written or sampled CSV) and passes."
66+ out_of_scope:
67+ - "Write only under $WORK_DIR/op/tests/blackbox/; do not modify kernel/host/api sources, $WORK_DIR/golden.py, design docs, whitebox case sets, or anything else."
68+ - "Do not execute device tests or run any ttk batch; do not hand-write, sample, or post-edit CSV rows; do not delete or shrink side tables to bypass isolation."
69+ max_retries: 2
70+ on_exhaust: exit
71+ - id: blackbox-smoke
72+ task_type: normal
73+ title: Blackbox smoke - freeze the three suite CSVs, run the first L0 case to green
74+ executor: general-executor
75+ verifier: general-verifier
76+ depends_on:
77+ - blackbox-gen
78+ goal:
79+ - "Run the first case of the L0 test suite with the TTK framework, fixing precision issues until it passes."
80+ approach:
81+ - "Locate the cases: the blackbox-tester skill's merge_cases.py adapts the standard layer CSVs into executable TTK suites (column-union merge, offset normalization; its exact-suffix matching keeps *_oversized.csv side tables out by construction). Freeze the suites under $WORK_DIR/op/tests/blackbox/ttk/ with three invocations: (1) over a staging dir holding only the *_l0_functional.csv, --positive-out blackbox_l0.csv; (2) over a staging dir holding only the *_l1_functional.csv, --positive-out blackbox_l1.csv; (3) over the full testcases/ dir, --positive-out blackbox_all.csv --negative-out blackbox_l2_neg.csv (this invocation's duplicate-testcase_name check across L0/L1 must pass). Record each suite's data-row count — the --expect-total value for every later task. Done when: the four CSVs exist and each per-layer suite's data-row count equals its standard layer CSV's data-row count."
82+ - "Locate the TTK framework root: $WORK_DIR/ops-test-kit; every ttk command runs from that directory. The blackbox-tester skill is the invocation authority for ttk aclnn mode (environment, vendor visibility, bin-path proof, result parsing) — consult it and its references/ttk-aclnn-guide.md for the invocation contract."
83+ - "Phase 1 - run the first case without cross_check: read the first row's testcase_name from blackbox_l0.csv and run python3 -m ttk aclnn -i $WORK_DIR/op/tests/blackbox/ttk/blackbox_l0.csv -t <case-name> --pc=1 --task-prof false --run 1 --device-whitelist 0 --input-dist uniform --compare stat_rel_err --plugin $WORK_DIR/golden.py -o $WORK_DIR/op/tests/blackbox/ttk/result_smoke.csv (local golden comparison only, no third_party), with CANN debug logging tee'd to smoke_debug.log in the same directory. --input-dist uniform is fixed workflow-wide; the golden is $WORK_DIR/golden.py used as-is — if it is missing, the task fails. Done when: result_smoke.csv holds exactly one row."
84+ - "Phase 2 - adjudicate failed cases: rerun each row whose precision_status is not PASS with -t by name adding --compare cross_check --config $WORK_DIR/ttk.conf.yaml (third_party torch via the local xpu-server), writing to $WORK_DIR/op/tests/blackbox/ttk/result_smoke-crosscheck.csv; a case that passes under cross_check is adjudicated green; a case still failing enters precision localization and fix (wrong-precision class of the triage line + fix discipline) and is rerun until green. Skip this phase when phase 1 is all-green."
85+ - "Gate script: run the parse_result.py script under the blackbox-tester skill on <result.csv> with --expect-total <N>; it exits 0 if and only if pass==total and fail==skip==0; for the negative suite add --negative — exit 0 if and only if pass==0 (every row rejected)."
86+ - "Failure triage: reproduce each failure first with -t by case name, then load the skill for its class and record conclusions and fixes in the evidence file — build failure (build.sh error / no artifacts) -> ascendc-compile-debug; AIC Error, runtime crash, error codes (161xxx/361xxx/507xxx/561xxx), hang, timeout -> ascendc-runtime-debug; wrong precision -> ascendc-precision-debug (criteria: $WORK_DIR/design/Validation.md per-dtype rtol/atol); TTK-framework-level failure (malformed results / GOLDEN_FAILURE / OOM / killed) -> ttk-how-diagnose."
87+ - "Fix discipline: reproduce before attributing; code fixes stay inside the out_of_scope whitelist; after any code change run cd $WORK_DIR/op && ./build.sh to rebuild and deploy into dev-package before rerunning; suite CSVs, golden.py, tolerances and isolation thresholds stay as-is; a failure that cannot be fixed without deviating from design stays red with its attribution (oracle/design defect)."
88+ - "Operator-source proof: run the check_op_binpath.py script under the blackbox-tester skill on $WORK_DIR/op/tests/blackbox/ttk/smoke_debug.log with --optype <OpPascal> --expect-dir $WORK_DIR/dev-package/vendors/<OpPascal> --require. Done when: exit 0 — the tested kernel comes from this workflow's own deployment."
89+ acceptance:
90+ - "Gate: the first L0 case ends green in phase 1 (parse_result.py $WORK_DIR/op/tests/blackbox/ttk/result_smoke.csv --expect-total 1 exits 0) or is adjudicated green in phase 2 (parse_result.py $WORK_DIR/op/tests/blackbox/ttk/result_smoke-crosscheck.csv --expect-total 1 exits 0); a case still failing after cross_check goes through precision fix until green."
91+ - "Suites ready: the three suite CSVs' data-row counts equal their standard layer CSVs'; blackbox_all.csv's data-row count equals l0+l1; counts and oversized side-table counts recorded."
92+ - "Operator source: check_op_binpath.py --require exits 0."
93+ out_of_scope:
94+ - "Modification whitelist: $WORK_DIR/op/op_host/ (host/tiling code), $WORK_DIR/op/op_kernel/ (kernel code) and $WORK_DIR/op/op_api/ (aclnn L2/L0 API code — this module verifies and fixes the aclnn path end to end); everything else stays as-is — the TTK framework ($WORK_DIR/ops-test-kit), all case CSVs, $WORK_DIR/golden.py (never modify), tolerances and isolation thresholds, $WORK_DIR/design/ docs, whitebox case sets."
95+ - "Run only the first L0 case; new files land only under $WORK_DIR/op/tests/blackbox/."
96+ max_retries: 2
97+ on_exhaust: exit
98+ - id: blackbox-run-l0-100pct
99+ task_type: normal
100+ title: Full L0 blackbox suite - every case precision-PASS (hard gate)
101+ executor: general-executor
102+ verifier: general-verifier
103+ depends_on:
104+ - blackbox-smoke
105+ goal:
106+ - "Run the full L0 test suite with the TTK framework, fixing issues until every case passes."
107+ approach:
108+ - "Locate the case CSV: $WORK_DIR/op/tests/blackbox/ttk/blackbox_l0.csv (the L0 suite frozen by blackbox-smoke; its data-row count is the --expect-total value)."
109+ - "Locate the TTK framework root: $WORK_DIR/ops-test-kit; every ttk command runs from that directory."
110+ - "Phase 1 - run the full suite without cross_check: python3 -m ttk aclnn -i $WORK_DIR/op/tests/blackbox/ttk/blackbox_l0.csv --pc=1 --task-prof false --run 1 --device-whitelist 0 --input-dist uniform --compare stat_rel_err --plugin $WORK_DIR/golden.py -o $WORK_DIR/op/tests/blackbox/ttk/result_l0.csv (local golden comparison only, no third_party). rm -f the result file before running; resumes and single-case reruns always via -t by name; the suite stays whole. Done when: result_l0.csv's case set equals the suite's full row set."
111+ - "Phase 2 - adjudicate failed cases: rerun each row whose precision_status is not PASS with -t by name adding --compare cross_check --config $WORK_DIR/ttk.conf.yaml (third_party torch via the local xpu-server), writing to $WORK_DIR/op/tests/blackbox/ttk/result_l0-crosscheck.csv; a case that passes under cross_check is adjudicated green; a case still failing enters precision localization and fix (wrong-precision class of the triage line + fix discipline) and is rerun until green. Skip this phase when phase 1 is all-green."
112+ - "Gate script: run the parse_result.py script under the blackbox-tester skill on <result.csv> with --expect-total <N>; it exits 0 if and only if pass==total and fail==skip==0; for the negative suite add --negative — exit 0 if and only if pass==0 (every row rejected)."
113+ - "Failure triage: reproduce each failure first with -t by case name, then load the skill for its class and record conclusions and fixes in the evidence file — build failure (build.sh error / no artifacts) -> ascendc-compile-debug; AIC Error, runtime crash, error codes (161xxx/361xxx/507xxx/561xxx), hang, timeout -> ascendc-runtime-debug; wrong precision -> ascendc-precision-debug (criteria: $WORK_DIR/design/Validation.md per-dtype rtol/atol); TTK-framework-level failure (malformed results / GOLDEN_FAILURE / OOM / killed) -> ttk-how-diagnose."
114+ - "Fix discipline: reproduce before attributing; code fixes stay inside the out_of_scope whitelist; after any code change run cd $WORK_DIR/op && ./build.sh to rebuild and deploy into dev-package before rerunning; suite CSVs, golden.py, tolerances and isolation thresholds stay as-is; a failure that cannot be fixed without deviating from design stays red with its attribution (oracle/design defect)."
115+ - "Evidence: $WORK_DIR/op/tests/blackbox/ttk/run-l0-100pct.RECORD.md records the full row set, per-row results, fix history, and the commands run; gate numbers come from one clean full rerun after the last code change."
116+ acceptance:
117+ - "Gate: after adjudication every case in the suite is green — phase-1 PASS rows plus crosscheck-adjudicated rows together cover the full row set (all-green phase 1 is exactly parse_result.py $WORK_DIR/op/tests/blackbox/ttk/result_l0.csv --expect-total <L0 data-row count> exits 0; otherwise parse_result.py result_l0-crosscheck.csv --expect-total <phase-1 FAIL count> also exits 0 and the union covers the suite)."
118+ - "Coverage: result_l0.csv's case set equals the suite's full row set, generated after the last build."
119+ - "Build and evidence: cd $WORK_DIR/op && ./build.sh exits 0; run-l0-100pct.RECORD.md non-empty."
120+ out_of_scope:
121+ - "Modification whitelist: $WORK_DIR/op/op_host/ (host/tiling code), $WORK_DIR/op/op_kernel/ (kernel code) and $WORK_DIR/op/op_api/ (aclnn L2/L0 API code); everything else stays as-is — the TTK framework ($WORK_DIR/ops-test-kit), all case CSVs, $WORK_DIR/golden.py (never modify), tolerances and isolation thresholds, $WORK_DIR/design/ docs, whitebox case sets."
122+ - "L1/L2 cases and performance stages belong to other tasks."
123+ max_retries: 2
124+ on_exhaust: exit
125+ - id: blackbox-run-l1-100pct
126+ task_type: normal
127+ title: Full L1 blackbox suite in one run - every case precision-PASS (hard gate)
128+ executor: general-executor
129+ verifier: general-verifier
130+ depends_on:
131+ - blackbox-run-l0-100pct
132+ goal:
133+ - "Run the full L1 test suite with the TTK framework, fixing issues until every case passes."
134+ approach:
135+ - "Locate the case CSV: $WORK_DIR/op/tests/blackbox/ttk/blackbox_l1.csv (the L1 suite frozen by blackbox-smoke; its data-row count is the --expect-total value)."
136+ - "Locate the TTK framework root: $WORK_DIR/ops-test-kit; every ttk command runs from that directory."
137+ - "Phase 1 - run the full suite in one go without cross_check: python3 -m ttk aclnn -i $WORK_DIR/op/tests/blackbox/ttk/blackbox_l1.csv --pc=1 --task-prof false --run 1 --device-whitelist 0 --input-dist uniform --compare stat_rel_err --plugin $WORK_DIR/golden.py -o $WORK_DIR/op/tests/blackbox/ttk/result_l1.csv (local golden comparison only, no third_party). rm -f the result file before running; resumes and single-case reruns always via -t by name; the suite stays whole, never staged or sampled. Done when: result_l1.csv's case set equals the suite's full row set."
138+ - "Phase 2 - adjudicate failed cases: rerun each row whose precision_status is not PASS with -t by name adding --compare cross_check --config $WORK_DIR/ttk.conf.yaml (third_party torch via the local xpu-server), writing to $WORK_DIR/op/tests/blackbox/ttk/result_l1-crosscheck.csv; a case that passes under cross_check is adjudicated green; a case still failing enters precision localization and fix (wrong-precision class of the triage line + fix discipline) and is rerun until green. Skip this phase when phase 1 is all-green."
139+ - "Gate script: run the parse_result.py script under the blackbox-tester skill on <result.csv> with --expect-total <N>; it exits 0 if and only if pass==total and fail==skip==0; for the negative suite add --negative — exit 0 if and only if pass==0 (every row rejected)."
140+ - "Failure triage: reproduce each failure first with -t by case name, then load the skill for its class and record conclusions and fixes in the evidence file — build failure (build.sh error / no artifacts) -> ascendc-compile-debug; AIC Error, runtime crash, error codes (161xxx/361xxx/507xxx/561xxx), hang, timeout -> ascendc-runtime-debug; wrong precision -> ascendc-precision-debug (criteria: $WORK_DIR/design/Validation.md per-dtype rtol/atol); TTK-framework-level failure (malformed results / GOLDEN_FAILURE / OOM / killed) -> ttk-how-diagnose."
141+ - "Fix discipline: reproduce before attributing; code fixes stay inside the out_of_scope whitelist; after any code change run cd $WORK_DIR/op && ./build.sh to rebuild and deploy into dev-package before rerunning; suite CSVs, golden.py, tolerances and isolation thresholds stay as-is; a failure that cannot be fixed without deviating from design stays red with its attribution (oracle/design defect)."
142+ - "Evidence: $WORK_DIR/op/tests/blackbox/ttk/run-l1-100pct.RECORD.md records the full row set, per-row results, fix history, and the commands run; gate numbers come from one clean full rerun after the last code change; when this task changed code, result_l0.csv is rerun in full and still meets the L0 gate."
143+ acceptance:
144+ - "Gate: after adjudication every case in the suite is green — phase-1 PASS rows plus crosscheck-adjudicated rows together cover the full row set (all-green phase 1 is exactly parse_result.py $WORK_DIR/op/tests/blackbox/ttk/result_l1.csv --expect-total <L1 data-row count> exits 0; otherwise parse_result.py result_l1-crosscheck.csv --expect-total <phase-1 FAIL count> also exits 0 and the union covers the suite)."
145+ - "Coverage: result_l1.csv's case set equals the suite's full row set, generated after the last build."
146+ - "Build and evidence: cd $WORK_DIR/op && ./build.sh exits 0; run-l1-100pct.RECORD.md non-empty; if this task changed code, result_l0.csv was regenerated and still meets the L0 gate."
147+ out_of_scope:
148+ - "Modification whitelist: $WORK_DIR/op/op_host/ (host/tiling code), $WORK_DIR/op/op_kernel/ (kernel code) and $WORK_DIR/op/op_api/ (aclnn L2/L0 API code); everything else stays as-is — the TTK framework ($WORK_DIR/ops-test-kit), all case CSVs, $WORK_DIR/golden.py (never modify), tolerances and isolation thresholds, $WORK_DIR/design/ docs, whitebox case sets."
149+ - "L2 cases and performance stages belong to other tasks; the L1 suite runs whole, never staged or sampled."
150+ max_retries: 2
151+ on_exhaust: exit
152+ - id: blackbox-run-l2-100pct
153+ task_type: normal
154+ title: Full L2 negative blackbox suite in one run - every case rejected (closing gate)
155+ executor: general-executor
156+ verifier: general-verifier
157+ depends_on:
158+ - blackbox-run-l1-100pct
159+ goal:
160+ - "Run the full L2 negative test suite with the TTK framework, fixing issues until every case is rejected by the operator."
161+ approach:
162+ - "Locate the case CSV: $WORK_DIR/op/tests/blackbox/ttk/blackbox_l2_neg.csv (the L2 negative suite frozen by blackbox-smoke; its data-row count is the --expect-total value)."
163+ - "Locate the TTK framework root: $WORK_DIR/ops-test-kit; every ttk command runs from that directory."
164+ - "Phase 1 - run the full suite in one go without cross_check: python3 -m ttk aclnn -i $WORK_DIR/op/tests/blackbox/ttk/blackbox_l2_neg.csv --pc=1 --task-prof false --run 1 --device-whitelist 0 --input-dist uniform --compare stat_rel_err --plugin $WORK_DIR/golden.py -o $WORK_DIR/op/tests/blackbox/ttk/result_l2.csv (local golden comparison only, no third_party). rm -f the result file before running; resumes and single-case reruns always via -t by name; the suite stays whole, never staged or sampled. Done when: result_l2.csv's case set equals the suite's full row set."
165+ - "Phase 2 - adjudicate anomalous rows: rerun each row that is not cleanly REJECTED with -t by name adding --compare cross_check --config $WORK_DIR/ttk.conf.yaml (third_party torch via the local xpu-server), writing to $WORK_DIR/op/tests/blackbox/ttk/result_l2-crosscheck.csv; a row confirmed executing under cross_check means the operator lacks a validation (negative-semantics fix flow); a row still ambiguous is escalated per the triage line. Skip this phase when phase 1 rejects every row cleanly."
166+ - "Negative semantics: rejected means passing. A row that precision-PASSes means the operator lacks a validation — add it in the whitelisted directories per the design docs and rerun; a row that is itself an illegal case stays red with its attribution."
167+ - "Gate script: run the parse_result.py script under the blackbox-tester skill on <result.csv> with --expect-total <N>; it exits 0 if and only if pass==total and fail==skip==0; for the negative suite add --negative — exit 0 if and only if pass==0 (every row rejected)."
168+ - "Failure triage: reproduce each failure first with -t by case name, then load the skill for its class and record conclusions and fixes in the evidence file — build failure (build.sh error / no artifacts) -> ascendc-compile-debug; AIC Error, runtime crash, error codes (161xxx/361xxx/507xxx/561xxx), hang, timeout -> ascendc-runtime-debug; wrong precision -> ascendc-precision-debug (criteria: $WORK_DIR/design/Validation.md per-dtype rtol/atol); TTK-framework-level failure (malformed results / GOLDEN_FAILURE / OOM / killed) -> ttk-how-diagnose."
169+ - "Fix discipline: reproduce before attributing; code fixes stay inside the out_of_scope whitelist; after any code change run cd $WORK_DIR/op && ./build.sh to rebuild and deploy into dev-package before rerunning; suite CSVs, golden.py, tolerances and isolation thresholds stay as-is; a failure that cannot be fixed without deviating from design stays red with its attribution (oracle/design defect)."
170+ - "Closing regression: when this task changed code, result_l0.csv and result_l1.csv are rerun in full and still meet their gates; the tiling UT (cd $WORK_DIR/op/tests/tiling && ./run.sh, 0 failed) and every whitebox branch full batch (ttk kernel mode over the branch CSVs under $WORK_DIR/op/tests/whitebox/branch-*/) stay green under the same two-phase method (phase 1 --compare stat_rel_err without --config; failed rows adjudicated with --compare cross_check --config); record the evidence in $WORK_DIR/op/tests/blackbox/ttk/regression.RECORD.md."
171+ - "Evidence: $WORK_DIR/op/tests/blackbox/ttk/run-l2-100pct.RECORD.md records the full row set, per-row rejection status, fixes and attributions, and the commands run."
172+ acceptance:
173+ - "Gate: parse_result.py $WORK_DIR/op/tests/blackbox/ttk/result_l2.csv --negative --expect-total <L2 data-row count> exits 0 (pass==0, every row rejected), with phase-2 adjudication evidence for any row that phase 1 did not reject cleanly."
174+ - "Coverage: result_l2.csv's case set equals the suite's full row set, generated after the last build."
175+ - "Closing regression: tiling UT and whitebox branch full batches stay green, regression.RECORD.md non-empty; if this task changed code, result_l0.csv and result_l1.csv were regenerated and still meet their gates."
176+ out_of_scope:
177+ - "Modification whitelist: $WORK_DIR/op/op_host/ (host/tiling code), $WORK_DIR/op/op_kernel/ (kernel code) and $WORK_DIR/op/op_api/ (aclnn L2/L0 API code); everything else stays as-is — the TTK framework ($WORK_DIR/ops-test-kit), all case CSVs, $WORK_DIR/golden.py (never modify), tolerances and isolation thresholds, $WORK_DIR/design/ docs, whitebox case sets."
178+ - "Performance stages belong to other tasks; the L2 suite runs whole, never staged or sampled."
179+ max_retries: 2
180+ on_exhaust: exit
@@ -0,0 +1,207 @@
1+# Code-review module, extracted from the op-develop monolith (code-review +
2+# fix-findings) with a verify-inputs module boundary gate ahead of them. Input:
3+# a complete op-impl run's artifacts (op/ package, golden.py, spec/, design/,
4+# requirements/, npu-arch.json, ttk.conf.yaml) and the finished test suites they
5+# feed (tiling UT under op/tests/tiling/, whitebox batches under op/tests/whitebox/,
6+# blackbox suites under op/tests/blackbox/ when present). Output: a recorded,
7+# re-checkable review of the operator sources with every FAIL finding closed and
8+# every affected test gate re-run green. Complements op-impl.yaml / blackbox.yaml;
9+# runs standalone on a finished work_dir. The orchestrator wires the Codex layout
10+# ($WORK_DIR/.agents/skills plus $WORK_DIR/.codex/agents) automatically via
11+# link_agent_config.py.
12+workflow: code-review
13+max_parallel: 10
14+system_prompt: If needed, dispatch multi subagents to explore the operator package under $WORK_DIR/op/ and the requirements under $WORK_DIR/requirements/ relevant to this task, as development reference.
15+nodes:
16+- id: verify-inputs
17+ task_type: normal
18+ executor: general-executor
19+ verifier: general-verifier
20+ title: Module boundary gate - verify the reviewable artifacts contract and rebuild the deployment
21+ goal:
22+ - 'Prove the frozen op-impl artifacts in $WORK_DIR satisfy the code-review module''s input
23+ contract before any review work starts: the package skeleton and op_api four files exist,
24+ the package rebuilds for the target SoC, its aclnn API installs into $WORK_DIR/dev-package
25+ with the exported L2 symbol pair, and the regression-gate assets the fix-findings node may
26+ re-run exist — so the review inspects a known-good build of this work_dir''s own package.'
27+ - 'Completion gate: the build exits 0, the installed libcust_opapi.so exports the
28+ aclnn<OpPascal>GetWorkspaceSize / aclnn<OpPascal> symbol pair, and every input-contract
29+ file check passes.'
30+ approach:
31+ - 'This node verifies, never fixes: the inputs are final op-impl products. A failing check
32+ is a module-boundary violation (a fixture defect), reported as FAILED with the failing
33+ check named — do not edit any source to make a check pass.'
34+ - 'Derive the operator''s name forms from spec.yaml: OP_SNAKE = op.name, OP_PASCAL = PascalCase.'
35+ - 'Input-contract files: $WORK_DIR/golden.py, $WORK_DIR/spec/spec.yaml, $WORK_DIR/requirements/REQUIREMENTS.md,
36+ $WORK_DIR/design/ (with Validation.md and branches/), $WORK_DIR/npu-arch.json, $WORK_DIR/ttk.conf.yaml;
37+ the package skeleton $WORK_DIR/op/op_host/, $WORK_DIR/op/op_kernel/, $WORK_DIR/op/op_api/,
38+ $WORK_DIR/op/op_graph/, $WORK_DIR/op/build.sh, $WORK_DIR/op/CMakeLists.txt; the op_api four
39+ files $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.h, aclnn_${OP_SNAKE}.cpp, ${OP_SNAKE}.h, ${OP_SNAKE}.cpp.'
40+ - 'Regression-gate assets (the gates fix-findings may re-run after a fix; a missing gate asset
41+ is recorded as an absent gate, not a failure): the tiling UT $WORK_DIR/op/tests/tiling/run.sh
42+ + test_tiling_gtest.cpp; the whitebox branch CSVs (find $WORK_DIR/op/tests/whitebox -name
43+ ttk_design_doc_cases.csv); the blackbox frozen suites $WORK_DIR/op/tests/blackbox/ttk/blackbox_l0.csv,
44+ blackbox_l1.csv, blackbox_l2_neg.csv; the aclnn harness $WORK_DIR/op/tests/aclnn/run.sh; the
45+ torch e2e $WORK_DIR/op/tests/torch/run.sh.'
46+ - 'Rebuild the package from its own sources: cd $WORK_DIR/op && ./build.sh with the SoC argument
47+ required for the architecture recorded in $WORK_DIR/npu-arch.json exits 0 (the build''s CMake
48+ falls back to $ENV{ASCEND_HOME_PATH} when CANN_HOME is unset; only if both are unset, source
49+ the toolkit''s set_env.sh first).'
50+ - 'Reinstall into this work_dir''s own deployment: rm -rf $WORK_DIR/dev-package, then install
51+ the produced run package $WORK_DIR/op/build/custom_opp_ubuntu_x86_64.run with bash <run package>
52+ --quiet --nox11 --force --install-path=$WORK_DIR/dev-package (the --force skips the installer''s
53+ bundled-python pre-validation, which cannot load in this container).'
54+ acceptance:
55+ - 'Input-contract files present: test -s $WORK_DIR/golden.py && test -s $WORK_DIR/spec/spec.yaml
56+ && test -s $WORK_DIR/requirements/REQUIREMENTS.md && test -s $WORK_DIR/design/Validation.md
57+ && test -s $WORK_DIR/npu-arch.json && test -s $WORK_DIR/ttk.conf.yaml && test -d $WORK_DIR/op/op_host
58+ && test -d $WORK_DIR/op/op_kernel && test -d $WORK_DIR/op/op_api && test -d $WORK_DIR/op/op_graph
59+ && test -f $WORK_DIR/op/build.sh && test -f $WORK_DIR/op/CMakeLists.txt.'
60+ - 'op_api four files present: test -f $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.h && test -f $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.cpp
61+ && test -f $WORK_DIR/op/op_api/${OP_SNAKE}.h && test -f $WORK_DIR/op/op_api/${OP_SNAKE}.cpp.'
62+ - 'Build passes: cd $WORK_DIR/op && ./build.sh with the SoC argument required for the architecture
63+ recorded in $WORK_DIR/npu-arch.json exits 0.'
64+ - 'Deployment installed: test -s $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so.'
65+ - 'L2 symbol pair exported: nm -D $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so
66+ | grep -cE '' T aclnn<OP_PASCAL>(GetWorkspaceSize)?$'' equals 2 (with <OP_PASCAL> substituted
67+ from spec.yaml).'
68+ - 'Regression-gate assets inventoried: $WORK_DIR/code-review/INPUT_CONTRACT.md exists, is non-empty,
69+ and lists each regression-gate asset from the approach with its present/absent verdict — absent
70+ gates are recorded there once and reused by fix-findings, never re-derived.'
71+ out_of_scope:
72+ - 'Verify only: no file under $WORK_DIR/op/, golden.py, spec/, design/, requirements/, npu-arch.json
73+ or ttk.conf.yaml is modified; the only writes are the build artifacts under $WORK_DIR/op/build/,
74+ the fresh $WORK_DIR/dev-package/ install, and $WORK_DIR/code-review/INPUT_CONTRACT.md.'
75+ - 'Do not run any device test, ttk batch, tiling UT or whitebox batch in this node; do not fix
76+ a failing check — report it.'
77+ depends_on: []
78+ max_retries: 2
79+ on_exhaust: exit
80+- id: code-review
81+ task_type: normal
82+ executor: general-executor
83+ verifier: general-verifier
84+ title: Review the operator sources and record the findings under $WORK_DIR/code-review/
85+ goal:
86+ - 'Review the operator sources under $WORK_DIR/op/ (op_host/ and op_graph/ as the Host side,
87+ op_kernel/ as the Kernel side, op_api/ as the aclnn layer) exactly per the scope defined in
88+ agents/code-reviewer.md — every applicable TOPK, security-redline (plus SIMT kernel redlines
89+ when SIMT code is present), and performance clause of the ascendc-code-review skill — and
90+ write the aggregated report to $WORK_DIR/code-review/CODE_REVIEW.md.'
91+ - 'Completion gate: the report exists and is internally consistent — the first-line status
92+ matches the FAIL finding count, every finding carries a unique ID with file:line evidence
93+ that resolves under $WORK_DIR/op/, and the four deterministic ops-impl-review script logs are
94+ saved under $WORK_DIR/code-review/checks/. This task is explicitly NOT gated on zero findings:
95+ findings are recorded for the downstream fix-findings task, never fixed here.'
96+ approach:
97+ - 'Run as agents/code-reviewer.md with this workflow''s path overlay (the overlay wins over the
98+ agent doc''s defaults): the review inputs are $WORK_DIR/op/op_host/, $WORK_DIR/op/op_graph/,
99+ $WORK_DIR/op/op_kernel/, and $WORK_DIR/op/op_api/ instead of operators/{OP}_package/*; the
100+ report lands at $WORK_DIR/code-review/CODE_REVIEW.md instead of the agent doc''s default location.'
101+ - 'Load the ascendc-code-review skill first (mandatory) and run its file-review workflow end
102+ to end (rule routing, per-clause review, line verification); every FAIL / SUSPICIOUS finding
103+ keeps its unique F / S ID, full file path, and line-verified line number.'
104+ - 'Load the ops-impl-review skill and run its four deterministic scripts over the package,
105+ saving each full output to $WORK_DIR/code-review/checks/<script_name>.log: scalar_mainchain_check,
106+ vf_reachability_check, and non3510_scaffold_check against $WORK_DIR/op, and
107+ workspace_consistency_check with the design root $WORK_DIR (branch designs at
108+ $WORK_DIR/design/branches/) and the package root $WORK_DIR/op.'
109+ - 'Fold the deterministic results into the report: a script verdict of FAIL (exit 2) becomes
110+ at least one FAIL finding citing the offending location from its log; INCONCLUSIVE (exit 1)
111+ is recorded as a SUSPICIOUS finding; PASS contributes no finding.'
112+ - 'Design consistency (oracle-versus-implementation conflicts): where a review clause and the
113+ design docs disagree about intended behavior, the design doc is the arbiter — record the
114+ conflict as a finding citing both locations; never resolve it by assuming either side is right.'
115+ acceptance:
116+ - 'test -s $WORK_DIR/code-review/CODE_REVIEW.md exits 0, and the four deterministic logs exist
117+ non-empty: for s in scalar_mainchain_check vf_reachability_check workspace_consistency_check
118+ non3510_scaffold_check; do test -s $WORK_DIR/code-review/checks/$s.log || exit 1; done.'
119+ - 'The report''s first line is a single status that matches its body: head -1 $WORK_DIR/code-review/CODE_REVIEW.md
120+ | grep -qE ''^\*\*状态\*\*:[[:space:]]*(✅通过|❌失败)[[:space:]]*$'' exits 0, and it is ❌失败
121+ exactly when at least one FAIL finding is listed (verifier cross-checks the finding list).'
122+ - 'Every finding is re-checkable: each finding entry carries a unique ID, a severity, and a
123+ file path with line number that resolves under $WORK_DIR/op/ (verifier spot-checks); no finding
124+ lacks evidence.'
125+ out_of_scope:
126+ - 'Read-only over the code under review: do not modify anything under $WORK_DIR/op/, $WORK_DIR/design/,
127+ $WORK_DIR/spec/, the test suites, $WORK_DIR/golden.py, or tolerances.'
128+ - 'Do not fix any finding — remediation belongs to the downstream fix-findings task; write only
129+ under $WORK_DIR/code-review/ and run no builds or TTK batches.'
130+ depends_on:
131+ - verify-inputs
132+ max_retries: 2
133+ on_exhaust: exit
134+- id: fix-findings
135+ task_type: normal
136+ executor: general-executor
137+ verifier: general-verifier
138+ title: Fix every FAIL finding and re-run the affected test gates green
139+ goal:
140+ - 'Close every FAIL finding recorded in $WORK_DIR/code-review/CODE_REVIEW.md by fixing the
141+ operator sources, then re-run every test gate the touched code feeds and leave it green;
142+ record each closure in $WORK_DIR/code-review/CODE_REVIEW_FIX.md.'
143+ - 'When the review recorded zero FAIL findings, change no code and only write the no-op record
144+ to $WORK_DIR/code-review/CODE_REVIEW_FIX.md.'
145+ - 'Completion gate: every FAIL finding ID from CODE_REVIEW.md is quoted and closed in
146+ CODE_REVIEW_FIX.md, and the regression gates below hold — or the zero-findings no-op is
147+ recorded.'
148+ approach:
149+ - 'Inventory: read $WORK_DIR/code-review/CODE_REVIEW.md and its checks/ logs; list every FAIL
150+ finding (ID, location, required fix). Zero FAIL findings -> write the no-op record and stop.'
151+ - 'Fix discipline: confirm each finding at its cited location before editing (a finding whose
152+ cited file:line does not reproduce is recorded as not-reproducible with the evidence, not
153+ silently dropped); fixes land only in $WORK_DIR/op/op_host/, $WORK_DIR/op/op_kernel/,
154+ $WORK_DIR/op/op_api/, $WORK_DIR/op/op_graph/, and $WORK_DIR/op/CMakeLists.txt; after any code
155+ change run cd $WORK_DIR/op && ./build.sh (exit 0, deploys into $WORK_DIR/dev-package/) before
156+ any test re-run, and rebuild after every subsequent fix.'
157+ - 'Relevant tests = every gate fed by the whitelisted sources, restricted to the gates whose
158+ assets verify-inputs inventoried as present in $WORK_DIR/code-review/INPUT_CONTRACT.md (an
159+ absent gate is skipped with its absence cited from the inventory, never re-derived or
160+ guessed). Re-run each with the exact command form its gate node already recorded in its own
161+ evidence files (the run-*.RECORD.md / regression.RECORD.md under $WORK_DIR/op/tests/):'
162+ - 'Package build: cd $WORK_DIR/op && ./build.sh exits 0.'
163+ - 'Tiling UT (when present): cd $WORK_DIR/op/tests/tiling && ./run.sh exits 0 with 0 failed;
164+ the pinned oracle files (test_tiling_gtest.cpp, CMakeLists.txt, run.sh) stay untouched.'
165+ - 'Whitebox branch full batches (when present): for every $WORK_DIR/op/tests/whitebox/branch-*/,
166+ re-run the full batch under the two-phase method (phase 1 --compare stat_rel_err without
167+ --config; failed rows adjudicated with -t by name adding --compare cross_check --config
168+ $WORK_DIR/ttk.conf.yaml); every row green.'
169+ - 'Blackbox suites (when present): blackbox_l0.csv / blackbox_l1.csv / blackbox_l2_neg.csv
170+ re-run in full from $WORK_DIR/ops-test-kit per the commands recorded in their
171+ run-l{0,1,2}-100pct.RECORD.md files; failed positive rows adjudicated via cross_check exactly
172+ as those nodes define.'
173+ - 'ACLNN harness and torch e2e (when present): cd $WORK_DIR/op/tests/aclnn && ./run.sh and
174+ bash $WORK_DIR/op/tests/torch/run.sh both exit 0 with no FAILED row.'
175+ - 'Evidence: write $WORK_DIR/code-review/CODE_REVIEW_FIX.md quoting each FAIL finding verbatim
176+ with its fix and the per-gate rerun results (commands + outcome); append regression evidence
177+ to $WORK_DIR/op/tests/blackbox/ttk/regression.RECORD.md without overwriting it.'
178+ acceptance:
179+ - 'test -s $WORK_DIR/code-review/CODE_REVIEW_FIX.md exits 0; every FAIL finding ID listed in
180+ $WORK_DIR/code-review/CODE_REVIEW.md appears in CODE_REVIEW_FIX.md (verifier cross-checks the
181+ IDs one by one); the zero-findings case is explicitly recorded as a no-op with no code modified.'
182+ - 'cd $WORK_DIR/op && ./build.sh exits 0.'
183+ - 'Tiling UT green when its assets were inventoried present: cd $WORK_DIR/op/tests/tiling && ./run.sh
184+ exits 0 and its log shows [ PASSED ] with no [ FAILED ] line; the pinned oracle files are
185+ unmodified.'
186+ - 'Blackbox gates hold on regenerated results when the suites were inventoried present: the
187+ blackbox-tester skill''s parse_result.py on $WORK_DIR/op/tests/blackbox/ttk/result_l0.csv
188+ --expect-total <L0 data-row count> exits 0, likewise for result_l1.csv, and for result_l2.csv
189+ with --negative.'
190+ - 'Whitebox branch batches green when their CSVs were inventoried present: every
191+ $WORK_DIR/op/tests/whitebox/branch-*/ batch re-runs green under the two-phase method.'
192+ - 'Harness gates hold when their runners were inventoried present: cd $WORK_DIR/op/tests/aclnn
193+ && ./run.sh exits 0, and bash $WORK_DIR/op/tests/torch/run.sh exits 0.'
194+ - 'Frozen assets unchanged: every case CSV, $WORK_DIR/golden.py, tolerances, isolation
195+ thresholds, the tiling UT oracle files, and $WORK_DIR/design/ docs are unmodified (verifier
196+ checks against the pre-task state); a finding that cannot be fixed without deviating from
197+ design stays open in CODE_REVIEW_FIX.md with its attribution instead.'
198+ out_of_scope:
199+ - 'Modification whitelist: $WORK_DIR/op/op_host/, op_kernel/, op_api/, op_graph/, CMakeLists.txt,
200+ plus the build/test artifacts the gates regenerate and CODE_REVIEW_FIX.md; everything else
201+ stays as-is.'
202+ - 'Never modify test cases, suite CSVs, golden.py, tolerances, or thresholds to force a gate green.'
203+ - 'Do not modify anything else under $WORK_DIR/code-review/; the review itself is not re-run here.'
204+ depends_on:
205+ - code-review
206+ max_retries: 2
207+ on_exhaust: exit
@@ -0,0 +1,211 @@
1+# Documentation module, extracted from the op-develop monolith (doc-gen +
2+# docs-consistency-check) with a verify-inputs module boundary gate ahead of
3+# them. Input: a complete op-impl run's artifacts (op/ package with its op_api
4+# sources, golden.py, spec/, design/, requirements/, npu-arch.json) and the
5+# deployed vendor package under dev-package/. Output: the paired public docs —
6+# aclnn API interface doc plus README linking it — generated from verifiable
7+# facts, validated by the deterministic paired-docs validator, and empirically
8+# consistency-checked against the final package through TTK probes. Complements
9+# op-impl.yaml / blackbox.yaml; runs standalone on a finished work_dir. The
10+# orchestrator wires the Codex layout ($WORK_DIR/.agents/skills plus
11+# $WORK_DIR/.codex/agents) automatically via link_agent_config.py.
12+workflow: doc-gen
13+max_parallel: 10
14+system_prompt: If needed, dispatch multi subagents to explore the operator package under $WORK_DIR/op/ and the requirements under $WORK_DIR/requirements/ relevant to this task, as documentation reference.
15+nodes:
16+- id: verify-inputs
17+ task_type: normal
18+ executor: general-executor
19+ verifier: general-verifier
20+ title: Module boundary gate - verify the doc-input artifacts contract and rebuild the deployment
21+ goal:
22+ - 'Prove the frozen op-impl artifacts in $WORK_DIR satisfy the doc-gen module''s input
23+ contract before any documentation work starts: the doc fact inputs exist (spec, design,
24+ requirements, package sources), the hand-written op_api public header is present, the
25+ package rebuilds for the target SoC, and its aclnn API installs into $WORK_DIR/dev-package
26+ with the exported L2 symbol pair — so the docs describe a known-good deployment of this
27+ work_dir''s own package.'
28+ - 'Completion gate: the build exits 0, the installed libcust_opapi.so exports the
29+ aclnn<OpPascal>GetWorkspaceSize / aclnn<OpPascal> symbol pair, and every input-contract
30+ file check passes.'
31+ approach:
32+ - 'This node verifies, never fixes: the inputs are final op-impl products. A failing check
33+ is a module-boundary violation (a fixture defect), reported as FAILED with the failing
34+ check named — do not edit any source to make a check pass.'
35+ - 'Derive the operator''s name forms from spec.yaml: OP_SNAKE = op.name, OP_PASCAL = PascalCase.'
36+ - 'Input-contract files (the docs'' fact inputs): $WORK_DIR/golden.py, $WORK_DIR/spec/spec.yaml,
37+ $WORK_DIR/requirements/REQUIREMENTS.md, $WORK_DIR/design/ (with Interface.md and Validation.md),
38+ $WORK_DIR/npu-arch.json; the package skeleton $WORK_DIR/op/op_host/, $WORK_DIR/op/op_kernel/,
39+ $WORK_DIR/op/op_api/, $WORK_DIR/op/op_graph/, $WORK_DIR/op/build.sh, $WORK_DIR/op/CMakeLists.txt;
40+ the hand-written public header $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.h (the interface-family
41+ fact anchor — the doc''s function prototype must be confirmed against it, never guessed from
42+ directory names); the installed header under $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/include/
43+ when present.'
44+ - 'Rebuild the package from its own sources: cd $WORK_DIR/op && ./build.sh with the SoC argument
45+ required for the architecture recorded in $WORK_DIR/npu-arch.json exits 0 (the build''s CMake
46+ falls back to $ENV{ASCEND_HOME_PATH} when CANN_HOME is unset; only if both are unset, source
47+ the toolkit''s set_env.sh first).'
48+ - 'Reinstall into this work_dir''s own deployment: rm -rf $WORK_DIR/dev-package, then install
49+ the produced run package $WORK_DIR/op/build/custom_opp_ubuntu_x86_64.run with bash <run package>
50+ --quiet --nox11 --force --install-path=$WORK_DIR/dev-package (the --force skips the installer''s
51+ bundled-python pre-validation, which cannot load in this container).'
52+ acceptance:
53+ - 'Input-contract files present: test -s $WORK_DIR/golden.py && test -s $WORK_DIR/spec/spec.yaml
54+ && test -s $WORK_DIR/requirements/REQUIREMENTS.md && test -s $WORK_DIR/design/Interface.md
55+ && test -s $WORK_DIR/design/Validation.md && test -s $WORK_DIR/npu-arch.json && test -d $WORK_DIR/op/op_host
56+ && test -d $WORK_DIR/op/op_kernel && test -d $WORK_DIR/op/op_api && test -d $WORK_DIR/op/op_graph
57+ && test -f $WORK_DIR/op/build.sh && test -f $WORK_DIR/op/CMakeLists.txt.'
58+ - 'Hand-written public header present: test -s $WORK_DIR/op/op_api/aclnn_${OP_SNAKE}.h.'
59+ - 'Build passes: cd $WORK_DIR/op && ./build.sh with the SoC argument required for the architecture
60+ recorded in $WORK_DIR/npu-arch.json exits 0.'
61+ - 'Deployment installed: test -s $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so.'
62+ - 'L2 symbol pair exported: nm -D $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so
63+ | grep -cE '' T aclnn<OP_PASCAL>(GetWorkspaceSize)?$'' equals 2 (with <OP_PASCAL> substituted
64+ from spec.yaml).'
65+ - 'Installed public header present: test -s $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/include/aclnn_${OP_SNAKE}.h.'
66+ out_of_scope:
67+ - 'Verify only: no file under $WORK_DIR/op/, golden.py, spec/, design/, requirements/, npu-arch.json
68+ or ttk.conf.yaml is modified; the only writes are the build artifacts under $WORK_DIR/op/build/
69+ and the fresh $WORK_DIR/dev-package/ install.'
70+ - 'Do not generate any documentation or run any device test in this node; do not fix a failing
71+ check — report it.'
72+ depends_on: []
73+ max_retries: 2
74+ on_exhaust: exit
75+- id: doc-gen
76+ task_type: normal
77+ executor: general-executor
78+ verifier: general-verifier
79+ title: Generate the paired public docs (aclnn API doc + linked README) and pass the validator
80+ goal:
81+ - 'Execute the ascendc-docs-gen skill for the finished operator package at $WORK_DIR/op:
82+ generate the paired public docs — the aclnn API interface doc $WORK_DIR/op/docs/aclnn{OperatorName}.md
83+ first, then $WORK_DIR/op/README.md linking it (README delivery mode fixed to full; the package
84+ ships real kernel source) — and expose both under $WORK_DIR/docs/.'
85+ - '{OperatorName} is the actual public interface family name aclnn<OpPascal> (<OpPascal>
86+ derived from $WORK_DIR/spec/spec.yaml op.name), confirmed against the hand-written public
87+ header $WORK_DIR/op/op_api/aclnn_<op_name>.h — never guessed from directory names.'
88+ - 'Completion gate: the deterministic paired-docs validator passes — python3
89+ the ascendc-docs-gen skill''s scripts/validate_operator_docs.py --operator-dir
90+ $WORK_DIR/op exits 0 with STATUS: PASSED as its last output line.'
91+ approach:
92+ - 'Load the ascendc-docs-gen skill first (mandatory — it is the single execution authority
93+ for doc structure, evidence sourcing, community-template fetching, and the paired delivery
94+ order); run as agents/docs-writer.md.'
95+ - 'Workflow overlays on the agent/skill docs (where an overlay differs, the overlay wins):
96+ the operator root is $WORK_DIR/op (not operators/{OP}_package); the fact inputs are
97+ $WORK_DIR/spec/spec.yaml, $WORK_DIR/requirements/REQUIREMENTS.md, $WORK_DIR/design/*.md,
98+ the package sources under $WORK_DIR/op/ (op_host/, op_kernel/, op_graph/, op_api/,
99+ CMakeLists.txt, build.sh), the installed public header under
100+ $WORK_DIR/dev-package/vendors/<OpPascal>/op_api/include/, and the reproducible verification
101+ results under $WORK_DIR/op/tests/ (not the docs/{OP}/... layout the agent doc shows).'
102+ - 'The validator requires the docs inside the operator root: write
103+ $WORK_DIR/op/docs/aclnn{OperatorName}.md and overwrite the sample-derived $WORK_DIR/op/README.md.
104+ Once they validate, expose them at the workflow-level path: ln -sfn op/docs $WORK_DIR/docs
105+ ($WORK_DIR/docs exists only as this symlink).'
106+ - 'Iterate until green: on non-zero exit or a last line other than STATUS: PASSED, fix per
107+ the validator''s ERROR list from verifiable facts and rerun.'
108+ - 'Do not append to any LOG file and do not reply DONE — logging is the workflow runner''s
109+ job; follow this task prompt''s reply protocol.'
110+ acceptance:
111+ - 'OP_PASCAL=$(python3 -c "import yaml; n=yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml''))[''op''][''name''];
112+ print(''''.join(w.capitalize() for w in n.split(''_'')))") ; test -s $WORK_DIR/op/docs/aclnn${OP_PASCAL}.md
113+ && test -s $WORK_DIR/op/README.md && test -s $WORK_DIR/docs/aclnn${OP_PASCAL}.md.'
114+ - 'Paired validation passes: python3 the ascendc-docs-gen skill''s scripts/validate_operator_docs.py
115+ --operator-dir $WORK_DIR/op > /tmp/doc-gen-validate.log 2>&1 exits 0 and tail -1 /tmp/doc-gen-validate.log
116+ is exactly STATUS: PASSED.'
117+ - 'README links the doc it ships with: grep -qF "docs/aclnn${OP_PASCAL}.md" $WORK_DIR/op/README.md.'
118+ out_of_scope:
119+ - 'Write only $WORK_DIR/op/docs/, $WORK_DIR/op/README.md, and the $WORK_DIR/docs symlink;
120+ do not modify package sources, tests, CMake, $WORK_DIR/spec/, $WORK_DIR/design/,
121+ $WORK_DIR/requirements/, or $WORK_DIR/dev-package/.'
122+ - 'Do not change the public aclnn signature or any package source to make documentation
123+ easier; the docs document the existing interface.'
124+ depends_on:
125+ - verify-inputs
126+ max_retries: 2
127+ on_exhaust: exit
128+- id: docs-consistency-check
129+ task_type: normal
130+ executor: general-executor
131+ verifier: general-verifier
132+ title: Docs consistency check - verify every checkable doc claim empirically; fix doc deltas only
133+ goal:
134+ - 'Empirically verify the public docs of the finished operator ($WORK_DIR/op/docs/aclnn{OperatorName}.md
135+ and $WORK_DIR/op/README.md, exposed via the $WORK_DIR/docs symlink) against the final package:
136+ extract every machine-checkable claim — supported dtypes, formats, shape/rank ranges, attribute
137+ defaults, empty-tensor stances, constraints, and error semantics — and drive each through the
138+ real aclnn interface via TTK.'
139+ - 'Two case families, both derived FROM the docs: positive cases for every documented capability
140+ (expect success), and negative cases for abnormal inputs plus scenarios OUTSIDE the documented
141+ support range (undocumented dtype/format, out-of-range shape/rank, empty tensor where the doc
142+ says unsupported — expect a clean ACLNN rejection, not a crash and not silent execution).'
143+ - 'Mismatch rule (hard): any behavior deviating from the doc, in EITHER direction — a documented
144+ feature that fails, or an out-of-scope input that executes/crashes — is fixed by editing the
145+ DOC to match the observed code behavior; the code is never touched in this task.'
146+ - 'Completion gate: every extracted claim is settled in $WORK_DIR/docs-consistency/REPORT.md
147+ (match / mismatch-fixed naming the doc edit / N/A with reason), and the paired-docs validator
148+ exits 0 with STATUS: PASSED on the final doc tree.'
149+ approach:
150+ - 'Load the ascendc-docs-gen skill first (mandatory — it is the authority for doc structure,
151+ evidence rules, and the closing validator gate); do not restate or bypass its procedure.'
152+ - 'Inventory the claims: read both doc files end to end and list every checkable claim with
153+ its file:line, cross-checked against $WORK_DIR/spec/spec.yaml and the installed header
154+ $WORK_DIR/dev-package/vendors/<OpPascal>/op_api/include/aclnn_<op_name>.h; this list becomes
155+ REPORT.md''s claim table (unique ID per claim).'
156+ - 'Build the probe cases under $WORK_DIR/docs-consistency/cases/ — a positive CSV and a negative
157+ CSV, header per the blackbox ttk CSV contract with api_name = aclnn<OpPascal>; project rows
158+ from known-green $WORK_DIR/op/tests/blackbox/ttk/blackbox_l0.csv rows where possible (record
159+ the claim-to-case mapping); keep every dtype/format token a valid TTK token so a rejection
160+ happens at the operator, not at case parse.'
161+ - 'Execute both CSVs from $WORK_DIR/ops-test-kit: rm -f the -o target, then python3 -m ttk
162+ aclnn -i <cases.csv> --pc=1 --task-prof false --run 1 --device-whitelist 0 --input-dist
163+ uniform --compare stat_rel_err --plugin $WORK_DIR/golden.py -o $WORK_DIR/docs-consistency/results/result_<positive|negative>.csv
164+ — golden as-is, never modified.'
165+ - 'Judge every row against its doc-derived expectation: a documented-capability case must
166+ PASS; an out-of-scope case must be cleanly rejected — FAIL with NO_OUTPUT and a
167+ GetWorkspaceSize/ACLNN param error in the log. An executed case with output, a
168+ percentage/GOLDEN_FAILURE cell, a crash, or an infra token (TENSOR_DTYPES_INVALID /
169+ PARAM_COUNT_MISMATCH / OP_API_NOT_FOUND) is NOT a clean rejection: an infra token means the
170+ probe case is buggy (fix the case and rerun); an executed out-of-scope case is a mismatch
171+ (the doc is too narrow — widen it).'
172+ - 'Fix discipline: settle every mismatch by editing only the two doc files from the observed
173+ evidence — widen or narrow the support cells, flip the empty-tensor stance, adjust constraint
174+ wording, add error rows citing a concrete aclnnStatus only when that return was actually
175+ observed; respect the validator''s anchored regions (prototype text and order, parameter-table
176+ row order, the exact empty-tensor stance phrasing the validator requires, compile-checked
177+ example). Zero mismatches -> edit no doc, write the zero-mismatch record, and stop.'
178+ - 'Re-validate after every doc edit and once on the final tree: python3
179+ the ascendc-docs-gen skill''s scripts/validate_operator_docs.py --operator-dir
180+ $WORK_DIR/op — exit 0, last line STATUS: PASSED; iterate per its ERROR list until green.'
181+ - 'Evidence: $WORK_DIR/docs-consistency/REPORT.md holds the claim table (ID | doc claim with
182+ file:line | case name | observed result cell | verdict), the commands run, and the fix
183+ history (mismatch ID -> doc edit); a code-side defect suspected behind a mismatch is
184+ attributed there, never patched in the doc''s place.'
185+ acceptance:
186+ - 'test -s $WORK_DIR/docs-consistency/REPORT.md exits 0 and it holds the settled claim table:
187+ every checkable claim from both doc files appears exactly once with a verdict of match,
188+ mismatch-fixed (naming the doc location edited), or N/A with reason; the zero-mismatch case
189+ is explicitly recorded as a no-op with no doc modified.'
190+ - 'Cases cover the claims: the positive and negative CSVs under $WORK_DIR/docs-consistency/cases/
191+ are non-empty, and every executable claim maps to at least one case row recorded in REPORT.md.'
192+ - 'Full execution: each result CSV under $WORK_DIR/docs-consistency/results/ exists, is non-empty,
193+ and covers its cases CSV''s full row set (no unexecuted rows, no unexplained skips).'
194+ - 'Validator green on the final tree: python3 the ascendc-docs-gen skill''s scripts/validate_operator_docs.py
195+ --operator-dir $WORK_DIR/op > /tmp/docs-consistency-validate.log 2>&1 exits 0 and tail -1
196+ /tmp/docs-consistency-validate.log is exactly STATUS: PASSED.'
197+ - 'Frozen assets unchanged: $WORK_DIR/op package sources (op_host/, op_kernel/, op_graph/,
198+ op_api/, CMakeLists.txt), $WORK_DIR/golden.py, $WORK_DIR/spec/spec.yaml, and every test
199+ suite under $WORK_DIR/op/tests/ are unmodified (verifier checks against the pre-task state).'
200+ out_of_scope:
201+ - 'Write only under $WORK_DIR/docs-consistency/ and, for mismatch fixes, the two doc files
202+ $WORK_DIR/op/docs/aclnn{OperatorName}.md and $WORK_DIR/op/README.md; the $WORK_DIR/docs
203+ symlink stays as doc-gen created it.'
204+ - 'Never modify package sources, the public aclnn signature, golden.py, tolerances, test
205+ suites, TTK, or design docs to make a doc claim true — doc follows code, never the reverse;
206+ a suspected code defect is attributed in REPORT.md and left to the kernel tasks.'
207+ - 'Do not regenerate the docs wholesale; this task patches deltas found by empirical checks only.'
208+ depends_on:
209+ - doc-gen
210+ max_retries: 2
211+ on_exhaust: exit
@@ -0,0 +1,166 @@
1+# Minimal op-develop workflow driving the shared workflow-orchestrator skill.
2+# The orchestrator wires the Codex layout ($WORK_DIR/.agents/skills plus
3+# $WORK_DIR/.codex/agents) automatically via link_agent_config.py.
4+workflow: env-setup
5+max_parallel: 10
6+system_prompt: If needed, dispatch multi subagents to explore code under $WORK_DIR/requirements/references(if exists) relevant to this task, as development reference.
7+nodes:
8+ - id: knowledge-preflight
9+ task_type: normal
10+ title: Set up and query the cannbot-knowledge knowledge base
11+ executor: general-executor
12+ verifier: general-verifier
13+ depends_on: []
14+ goal:
15+ - "Set up the cannbot-knowledge knowledge base at $WORK_DIR/cannbot-knowledge and query it for knowledge relevant to the operator in the task prompt; write the distilled findings to $WORK_DIR/cannbot-knowledge/artifacts/preflight.md."
16+ approach:
17+ - "The knowledge root is $WORK_DIR/cannbot-knowledge. If it has no .git subdirectory, run `git clone --depth 1 https://gitcode.com/cann/cannbot-knowledge.git $WORK_DIR/cannbot-knowledge`; otherwise skip the clone."
18+ - "If $WORK_DIR/cannbot-knowledge/artifacts/indexes/knowledge.sqlite3 is missing, run `python3 -m pip install -r $WORK_DIR/cannbot-knowledge/requirements.txt`, `bash $WORK_DIR/cannbot-knowledge/get_resources.sh`, and `python3 $WORK_DIR/cannbot-knowledge/.agents/skills/knowledge-query/scripts/knowledge_index.py --knowledge-root $WORK_DIR/cannbot-knowledge build`; if the index already exists, skip all three."
19+ - "Run `python3 $WORK_DIR/cannbot-knowledge/.agents/skills/knowledge-query/scripts/knowledge_query.py --knowledge-root $WORK_DIR/cannbot-knowledge discover` once, then query for the operator name, its math semantics, and the key CANN/Ascend C APIs mentioned in the task prompt."
20+ - "For each promising hit, read the full card at the returned path; follow card resource/sources links only when the card is insufficient."
21+ - "Write $WORK_DIR/cannbot-knowledge/artifacts/preflight.md: per topic, the distilled facts (API contracts, platform limits, tiling/UB constraints, known pitfalls), each citing its source card path. Record zero-hit queries explicitly as 'no coverage' — do not treat them as errors."
22+ acceptance:
23+ - "$WORK_DIR/cannbot-knowledge/artifacts/preflight.md exists and is non-empty."
24+ - "Every fact in it cites a card path under $WORK_DIR/cannbot-knowledge; queries with no hits are listed explicitly."
25+ out_of_scope:
26+ - "The knowledge repository is read-only except for its own setup artifacts (indexes, downloaded resources); do not modify any knowledge card."
27+ - "Do not create or modify any file outside $WORK_DIR/cannbot-knowledge/."
28+ max_retries: 1
29+ on_exhaust: continue
30+ - id: detect-npu-arch
31+ task_type: normal
32+ title: Detect the current platform's NPU arch
33+ executor: general-executor
34+ verifier: general-verifier
35+ depends_on: []
36+ goal:
37+ - Run `asys info -r hardware` to query the current platform's hardware information, extract the NPU architecture, and write it to $WORK_DIR/npu-arch.json.
38+ approach:
39+ - Run `asys info -r hardware` and capture its full output.
40+ - Identify the NPU architecture in that output.
41+ - Create $WORK_DIR/ if it does not already exist, then write the architecture as JSON to $WORK_DIR/npu-arch.json.
42+ acceptance:
43+ - $WORK_DIR/npu-arch.json exists and parses as valid JSON.
44+ - The file records the NPU architecture, and the recorded value matches what `asys info -r hardware` reports for this platform.
45+ out_of_scope:
46+ - Do not create or modify any file other than $WORK_DIR/npu-arch.json.
47+ - Do not install, upgrade, or reconfigure anything; only read the environment.
48+ max_retries: 2
49+ on_exhaust: exit
50+ - id: create-requirements-dir
51+ task_type: normal
52+ title: Create the requirements analysis directory
53+ executor: general-executor
54+ verifier: general-verifier
55+ depends_on: []
56+ goal:
57+ - Create the requirements analysis directory at $WORK_DIR/requirements/.
58+ approach:
59+ - Create $WORK_DIR/ if it does not already exist.
60+ - Create $WORK_DIR/requirements/ under it.
61+ acceptance:
62+ - $WORK_DIR/requirements/ exists and is a directory.
63+ out_of_scope:
64+ - Do not create or modify any file other than the $WORK_DIR/requirements/ directory.
65+ max_retries: 2
66+ on_exhaust: exit
67+ - id: setup-reference-repos
68+ task_type: normal
69+ executor: general-executor
70+ verifier: general-verifier
71+ title: Shallow-clone the reference source repos
72+ goal:
73+ - "Create $WORK_DIR/requirements/references/ and shallow-clone (--depth 1) the reference source repos required by the requirement analysis into cann/, ascend/, competitor/ subdirectories."
74+ approach:
75+ - "Create $WORK_DIR/requirements/references/ if it does not already exist, then create cann/, ascend/, competitor/ subdirectories under it."
76+ - "For each clone command below, skip it if the target directory already contains a .git subdirectory; otherwise run it as-is."
77+ - "git clone --depth 1 https://gitcode.com/cann/ops-nn.git $WORK_DIR/requirements/references/cann/ops-nn"
78+ - "git clone --depth 1 https://gitcode.com/cann/ops-math.git $WORK_DIR/requirements/references/cann/ops-math"
79+ - "git clone --depth 1 https://gitcode.com/cann/ops-transformer.git $WORK_DIR/requirements/references/cann/ops-transformer"
80+ - "git clone --depth 1 https://gitcode.com/cann/ops-cv.git $WORK_DIR/requirements/references/cann/ops-cv"
81+ - "git clone --depth 1 https://gitcode.com/cann/ops-rand.git $WORK_DIR/requirements/references/cann/ops-rand"
82+ - "git clone --depth 1 https://gitcode.com/cann/canndev.git $WORK_DIR/requirements/references/cann/canndev"
83+ - "git clone --depth 1 https://gitcode.com/Ascend/op-plugin.git $WORK_DIR/requirements/references/ascend/op-plugin"
84+ - "git clone --depth 1 https://gitcode.com/Ascend/torchair.git $WORK_DIR/requirements/references/ascend/torchair"
85+ - "git clone --depth 1 https://github.com/pytorch/pytorch.git $WORK_DIR/requirements/references/competitor/pytorch"
86+ - "git clone --depth 1 https://github.com/tensorflow/tensorflow.git $WORK_DIR/requirements/references/competitor/tensorflow"
87+ - "Report which repos were cloned, skipped (already present), or failed to clone."
88+ acceptance:
89+ - "$WORK_DIR/requirements/references/ exists and contains cann/, ascend/, competitor/ subdirectories."
90+ - "Each of these ten target directories contains a .git subdirectory: cann/ops-nn, cann/ops-math, cann/ops-transformer, cann/ops-cv, cann/ops-rand, cann/canndev, ascend/op-plugin, ascend/torchair, competitor/pytorch, competitor/tensorflow."
91+ out_of_scope:
92+ - "Do not modify any repo's contents, checkout a different branch, or run any build inside the repos."
93+ - "Do not create or modify any file outside $WORK_DIR/requirements/references/."
94+ depends_on:
95+ - create-requirements-dir
96+ max_retries: 2
97+ on_exhaust: exit
98+ - id: setup-ops-test-kit
99+ task_type: normal
100+ executor: general-executor
101+ verifier: general-verifier
102+ title: Clone the ops-test-kit repo
103+ goal:
104+ - "Clone the ops-test-kit repository into $WORK_DIR/ops-test-kit."
105+ approach:
106+ - "Create $WORK_DIR/ if it does not already exist."
107+ - "Skip the clone if $WORK_DIR/ops-test-kit already contains a .git subdirectory; otherwise run `git clone --depth 1 https://gitcode.com/cann/ops-test-kit $WORK_DIR/ops-test-kit`."
108+ acceptance:
109+ - "$WORK_DIR/ops-test-kit exists and contains a .git subdirectory."
110+ out_of_scope:
111+ - "Do not modify the repo's contents, checkout a different branch, or run any build inside the repo."
112+ - "Do not create or modify any file outside $WORK_DIR/ops-test-kit/."
113+ depends_on: []
114+ max_retries: 2
115+ on_exhaust: exit
116+ - id: verify-ops-test-kit
117+ task_type: normal
118+ executor: general-executor
119+ verifier: general-verifier
120+ title: Verify TTK works in the current environment
121+ goal:
122+ - "Determine whether TTK works in the current environment, for later operator functional and performance verification."
123+ - "Faithfully run the environment check and the three shipped sample test commands (kernel, geir, aclnn; the e2e path is excluded), save each command's output to disk, and report the results exactly as produced (PASS or FAIL, as-is)."
124+ approach:
125+ - "Change into the cloned repo: `cd $WORK_DIR/ops-test-kit` (TTK commands must run from the ops-test-kit directory)."
126+ - "Run every command below in a login-environment shell (e.g. `bash -lc '<cmd>'`, or source /etc/profile in the current shell first). Agent shells are often non-login and can miss environment entries (PATH, LD_LIBRARY_PATH) that the python3 interpreter and native libraries need to load; an interpreter-level ImportError from a bare `python3 -m ttk` in such a shell is an environment issue, not a TTK result."
127+ - "Create the output directory: `mkdir -p ttk-verify`."
128+ - "Run the environment check and save its output: `python3 -m ttk info > ttk-verify/env-info.txt 2>&1`."
129+ - "Pick the input files at runtime instead of hardcoding them: for kernel and geir pick any one file from `examples/case_store/kernel/*.csv`, for aclnn pick any one from `examples/case_store/aclnn/*.csv` (e.g. the first match of `ls <dir>/*.csv | head -1`). Record which file each command used."
130+ - "Run the three runnable sample test paths in order with the picked files, each saving its full output to a log file under ttk-verify/ (skip the e2e path entirely — it is out of scope for this verification). For each path, append `--ti=0` to run only the first case in the picked CSV; do not run the full CSV:"
131+ - "`python3 -m ttk kernel -i <picked-kernel.csv> --ti=0 > ttk-verify/kernel.log 2>&1`"
132+ - "`python3 -m ttk geir -i <picked-kernel.csv> --ti=0 > ttk-verify/geir.log 2>&1`"
133+ - "`python3 -m ttk aclnn -i <picked-aclnn.csv> --ti=0 > ttk-verify/aclnn.log 2>&1`"
134+ acceptance:
135+ - "Every command was actually executed and its output saved: $WORK_DIR/ops-test-kit/ttk-verify/ contains env-info.txt (non-empty, with a `Found N device(s)` block) and the three logs kernel.log, geir.log, aclnn.log (each non-empty, containing a `TTK Test Summary` block). e2e.log is not required."
136+ - "The environment is verified OK: each of the three logs' `TTK Test Summary` block shows `FAIL : 0` and `PassRate : 100.00%`. Any FAIL means the environment is not usable, so the task fails and the workflow exits."
137+ out_of_scope:
138+ - "Do not fix or work around any failure: do not edit example CSVs, docs, or source, do not modify or reinstall anything, and do not retry or patch commands to force a pass; report results exactly as produced."
139+ - "Write outputs only under $WORK_DIR/ops-test-kit/ttk-verify/ (build/cache artifacts the repo generates under itself are expected)."
140+ depends_on:
141+ - setup-ops-test-kit
142+ max_retries: 0
143+ on_exhaust: continue
144+ - id: setup-xpu-server
145+ task_type: normal
146+ executor: general-executor
147+ verifier: general-verifier
148+ title: Bring up the local xpu-server for cross_check third_party execution
149+ goal:
150+ - "Start a local xpu-server that executes the golden plugin's third_party reference (competitor torch) for cross_check comparison, and write $WORK_DIR/ttk.conf.yaml pointing TTK at it; every later ttk invocation (kernel and aclnn flows) carries --config $WORK_DIR/ttk.conf.yaml."
151+ approach:
152+ - "The server ships inside the ops-test-kit clone. Make its package importable and start it detached: mkdir -p $WORK_DIR/xpu-run && ln -sfn $WORK_DIR/ops-test-kit/ttk/remote/server $WORK_DIR/xpu-run/xpu_server."
153+ - "Start with --devices cpu always: (cd $WORK_DIR/xpu-run && PYTHONPATH=$WORK_DIR/xpu-run setsid python3 -m xpu_server.xpu_server --port 9090 --devices cpu </dev/null > $WORK_DIR/xpu-run/xpu-server.log 2>&1 &). A bare start (without --devices cpu) auto-detects no hardware, falls back to cpu, yet keeps use_device=true with device_ids=[cpu] — the dispatcher then computes max_attempts=0 and every /v1/run silently returns 500 'internal error' leaving no log."
154+ - "Reuse an already-listening server on 127.0.0.1:9090 (TCP connect succeeds AND GET http://127.0.0.1:9090/v1/heartbeat returns HTTP 200 with JSON containing \"status\":\"ok\" and \"providers\" including \"torch\") instead of starting a second one — this allows multiple operators to share one xpu-server on the same machine. If the existing server is not a healthy xpu_server with the torch provider, kill it and start a fresh one with the command above."
155+ - "If you started a new server, wait up to 60s for the port to accept connections."
156+ - "Write $WORK_DIR/ttk.conf.yaml with remote: endpoints: [{host: 127.0.0.1, port: 9090}]."
157+ acceptance:
158+ - "127.0.0.1:9090 accepts a TCP connection (python3 -c \"import socket; s=socket.create_connection(('127.0.0.1',9090),5); s.close()\" exits 0)."
159+ - "GET http://127.0.0.1:9090/v1/heartbeat returns HTTP 200 with JSON body containing \"status\":\"ok\" and \"providers\" including \"torch\" (python3 -c \"import urllib.request,json; r=urllib.request.urlopen('http://127.0.0.1:9090/v1/heartbeat',timeout=5); d=json.loads(r.read()); assert r.status==200 and d.get('status')=='ok' and 'torch' in d.get('providers',[]), d\" exits 0)."
160+ - "$WORK_DIR/ttk.conf.yaml exists, parses as YAML, and its remote.endpoints[0] is host 127.0.0.1 port 9090."
161+ out_of_scope:
162+ - "Create only $WORK_DIR/ttk.conf.yaml and the $WORK_DIR/xpu-run/ directory; modify nothing under $WORK_DIR/ops-test-kit."
163+ depends_on:
164+ - setup-ops-test-kit
165+ max_retries: 2
166+ on_exhaust: exit
@@ -0,0 +1,291 @@
1+# Minimal op-design workflow driving the shared workflow-orchestrator skill.
2+# The orchestrator wires the Codex layout ($WORK_DIR/.agents/skills plus
3+# $WORK_DIR/.codex/agents) automatically via link_agent_config.py.
4+workflow: op-design
5+max_parallel: 10
6+system_prompt: If needed, dispatch multi subagents to explore code under $WORK_DIR/requirements/references(if exists) relevant to this task, as development reference.
7+nodes:
8+ - id: init-design-dir
9+ task_type: normal
10+ executor: general-executor
11+ verifier: general-verifier
12+ title: Initialize the design document directory structure
13+ goal:
14+ - "Create $WORK_DIR/design/branches/ as a directory and $WORK_DIR/design/INDEX.md whose content equals the design-template skill's templates/design/INDEX.md.templ with every {OP} replaced by the operator name from spec.yaml."
15+ approach:
16+ - "OP_NAME=$(python3 -c \"import yaml; print(yaml.safe_load(open('$WORK_DIR/spec/spec.yaml'))['op']['name'])\")"
17+ - "mkdir -p $WORK_DIR/design/branches"
18+ - "sed \"s/{OP}/${OP_NAME}/g\" the design-template skill's templates/design/INDEX.md.templ > $WORK_DIR/design/INDEX.md"
19+ acceptance:
20+ - "$WORK_DIR/design/ and $WORK_DIR/design/branches/ exist and are directories."
21+ - "$WORK_DIR/design/INDEX.md exists and is non-empty."
22+ - "No placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/INDEX.md."
23+ out_of_scope:
24+ - "Do not create any design document other than INDEX.md; the remaining design files are produced by later tasks."
25+ - "Do not create or modify any file outside $WORK_DIR/design/."
26+ depends_on: []
27+ max_retries: 2
28+ on_exhaust: exit
29+ - id: write-design-overview
30+ task_type: normal
31+ executor: general-executor
32+ verifier: general-verifier
33+ title: Write the design document Overview.md
34+ goal:
35+ - "Produce $WORK_DIR/design/Overview.md for the operator in $WORK_DIR/spec/spec.yaml: operator function, natural-language definition, LaTeX math formula, and special-value / numerical-stability semantics, all traceable to $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml."
36+ approach:
37+ - "Load the ops-design-paradigms skill first (mandatory)."
38+ - "Copy the design-template skill's templates/design/Overview.md.templ to $WORK_DIR/design/Overview.md (this template carries no {OP} placeholder; do not introduce one)."
39+ - "Read $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml, then fill the four sections from them: ## 算子功能 (one sentence), ## 算子定义(自然语言) (exact computation semantics: input relationships and attr effect), ## 数学公式(LaTeX) (a strict LaTeX formula — the single semantic source for every branch kernel and golden), ## 特殊值与数值稳定性 (NaN/+Inf/-Inf/0/negative behaviour aligned with golden; overflow/underflow/divide-by-zero and saturation/clamp; the precision-sensitive step and whether high-precision accumulation is required)."
40+ - "Replace every `>` lead-in line with actual design content; keep the four section headings; do not touch any other design file."
41+ acceptance:
42+ - "$WORK_DIR/design/Overview.md exists and is non-empty: test -s $WORK_DIR/design/Overview.md."
43+ - "No placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/Overview.md."
44+ - "All four section headings remain: grep -qF '## 算子功能' $WORK_DIR/design/Overview.md && grep -qF '## 算子定义(自然语言)' $WORK_DIR/design/Overview.md && grep -qF '## 数学公式(LaTeX)' $WORK_DIR/design/Overview.md && grep -qF '## 特殊值与数值稳定性' $WORK_DIR/design/Overview.md."
45+ - "Every `>` lead-in has been replaced with real content: ! grep -qE '^>' $WORK_DIR/design/Overview.md; the ## 数学公式(LaTeX) section contains a LaTeX formula, and the content is traceable to $WORK_DIR/requirements/REQUIREMENTS.md / $WORK_DIR/spec/spec.yaml."
46+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
47+ out_of_scope:
48+ - "Write only $WORK_DIR/design/Overview.md; do not create or modify any other file."
49+ - "Do not write kernel code, modify the engineering project, or run builds."
50+ depends_on:
51+ - init-design-dir
52+ max_retries: 2
53+ on_exhaust: exit
54+ - id: write-design-interface
55+ task_type: normal
56+ executor: general-executor
57+ verifier: general-verifier
58+ title: Write the design document Interface.md
59+ goal:
60+ - "Produce $WORK_DIR/design/Interface.md for the operator in $WORK_DIR/spec/spec.yaml: the operator prototype (ATen IR + Inputs/Outputs/Attrs), the supported dtype combination table, data format support, and constraints/limitations, all traceable to $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml."
61+ approach:
62+ - "Load the ops-design-paradigms skill first (mandatory)."
63+ - "Copy the design-template skill's templates/design/Interface.md.templ to $WORK_DIR/design/Interface.md (this template carries no {OP} placeholder; do not introduce one)."
64+ - "Read $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml, then fill the sections from them: ## 算子原型 (ATen IR plus Inputs/Outputs/Attrs with name, semantics, shape contract, optionality and defaults), ## 算子规格(受支持 dtype 组合) (a table laid out by Inputs/Outputs, one row per supported combination), ## 数据 Format 支持, ## 约束与限制 (shape range / rank cap / per-axis length cap, dtype / format / attr-value constraints, alignment, broadcast rules, explicitly unsupported scenarios), and ## OpDef 代码片段 (a complete OpDef class body generated from the prototype + spec, DataType({...}) arrays expanded per combination, all Input/Output lists equal length)."
65+ - "Fill the ## 算子规格(受支持 dtype 组合) table row by row from spec.yaml: its rows/content must match spec.yaml exactly (no placeholder rows, no `<...>` residue in that table)."
66+ - "Replace every `>` lead-in line with actual design content; keep the section headings; do not touch any other design file."
67+ acceptance:
68+ - "$WORK_DIR/design/Interface.md exists and is non-empty: test -s $WORK_DIR/design/Interface.md."
69+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/Interface.md."
70+ - "No `<...>` placeholder residue in the OpDef / dtype table: ! grep -qE '<(Op|op|in[0-9]*|out[0-9]*|optional_in|attr|req_attr|bool_attr|default|soc)>' $WORK_DIR/design/Interface.md."
71+ - "Every `>` lead-in has been replaced with real content: ! grep -qE '^>' $WORK_DIR/design/Interface.md."
72+ - "The ## 算子规格(受支持 dtype 组合) table has no placeholder rows and its rows/content match $WORK_DIR/spec/spec.yaml's supported combinations exactly."
73+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
74+ out_of_scope:
75+ - "Write only $WORK_DIR/design/Interface.md; do not create or modify any other file."
76+ - "Do not write kernel code, modify the engineering project, or run builds."
77+ depends_on:
78+ - init-design-dir
79+ max_retries: 2
80+ on_exhaust: exit
81+ - id: write-design-infershape-dtype
82+ task_type: normal
83+ executor: general-executor
84+ verifier: general-verifier
85+ title: Write the design document InferShapeDtype.md
86+ goal:
87+ - "Produce $WORK_DIR/design/InferShapeDtype.md for the operator in $WORK_DIR/spec/spec.yaml: the InferShape and InferDataType derivation rules (how outputs are derived from inputs), traceable to $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml."
88+ approach:
89+ - "Load the ops-design-paradigms skill first (mandatory)."
90+ - "Copy the design-template skill's templates/design/InferShapeDtype.md.templ to $WORK_DIR/design/InferShapeDtype.md (this template carries no {OP} placeholder; do not introduce one)."
91+ - "Read $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml, then fill the two sections: ## InferShape (per-output shape derivation; broadcast alignment rule and per-dim output size; DynamicShape value/attr-driven derivation logic when applicable; empty/scalar/rank-mismatch edge cases) and ## InferDataType (per-output dtype source and any dtype promotion; the consistency check point against Interface.md's 算子规格 table)."
92+ - "Replace every `>` lead-in line with actual derivation rules consistent with $WORK_DIR/spec/spec.yaml's supported_combinations; keep the section headings; do not touch any other design file."
93+ acceptance:
94+ - "$WORK_DIR/design/InferShapeDtype.md exists and is non-empty: test -s $WORK_DIR/design/InferShapeDtype.md."
95+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/InferShapeDtype.md."
96+ - "Every `>` lead-in has been replaced with actual derivation rules: ! grep -qE '^>' $WORK_DIR/design/InferShapeDtype.md; the rules are consistent with $WORK_DIR/spec/spec.yaml's supported_combinations."
97+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
98+ out_of_scope:
99+ - "Write only $WORK_DIR/design/InferShapeDtype.md; do not create or modify any other file."
100+ - "Do not write kernel code, modify the engineering project, or run builds."
101+ depends_on:
102+ - init-design-dir
103+ max_retries: 2
104+ on_exhaust: exit
105+ - id: write-design-validation
106+ task_type: normal
107+ executor: general-executor
108+ verifier: general-verifier
109+ title: Write the design document Validation.md
110+ goal:
111+ - "Produce $WORK_DIR/design/Validation.md: the operator-wide end-to-end verification criteria (Golden reference, test-case matrix, per-dtype precision tolerances, performance targets), traceable to $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml."
112+ approach:
113+ - "Load the ops-design-paradigms skill first (mandatory)."
114+ - "Copy the design-template skill's templates/design/Validation.md.templ to $WORK_DIR/design/Validation.md (this template carries no {OP} placeholder; do not introduce one)."
115+ - "Read $WORK_DIR/requirements/REQUIREMENTS.md and $WORK_DIR/spec/spec.yaml, then fill: ## 参考实现 (Golden) (a PyTorch / CPU reference or formula anchored to Overview.md's math formula, independent of the kernel under test — no self-verification), ## 端到端测试用例矩阵 (shape × dtype × format matrix covering every supported dtype combination, every branch, special values, max shape, non-aligned, broadcast if supported), and ## 精度验收标准 (per-dtype rtol/atol plus pointwise special-value alignment)."
116+ - "Fill ## 性能目标: carry over §7.4 of $WORK_DIR/requirements/REQUIREMENTS.md — list at least 4 key shapes aligned with real points that exist in this document's 端到端测试用例矩阵 (leave the `tilingKey` column empty for now, to be completed by the later calibration task from BranchCatalog.md), select the source route (A competitor profiling / B theoretical evaluation / both not applicable), and fill in the target-metric definition and achievement-rate algorithm per row."
117+ - "Leave the target-value column empty in this task (it is back-filled by a later calibration task using measured/estimated values); do not invent any number here."
118+ - "Replace every `>` lead-in line with actual content; keep the section headings; do not touch any other design file."
119+ acceptance:
120+ - "$WORK_DIR/design/Validation.md exists and is non-empty: test -s $WORK_DIR/design/Validation.md."
121+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/Validation.md."
122+ - "Every `>` lead-in has been replaced with real content: ! grep -qE '^>' $WORK_DIR/design/Validation.md; the 参考实现 (Golden) is explicitly independent of the kernel under test, and 精度验收标准 gives per-dtype rtol/atol."
123+ - "grep -qF '性能目标' $WORK_DIR/design/Validation.md; its key-shape count is ≥ 4 and its shape/dtype values and source route match §7.4 of $WORK_DIR/requirements/REQUIREMENTS.md item by item; the target-value column is empty or marked 待标定, with no invented numbers."
124+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
125+ out_of_scope:
126+ - "Write only $WORK_DIR/design/Validation.md; do not create or modify any other file."
127+ - "Do not write kernel code, modify the engineering project, or run builds."
128+ depends_on:
129+ - init-design-dir
130+ max_retries: 2
131+ on_exhaust: exit
132+ - id: write-design-devview-tilingkey-tilingdata-branchroute
133+ task_type: normal
134+ executor: general-executor
135+ verifier: general-verifier
136+ title: Write the design documents DevView.md / TilingKey.md / TilingData.md / BranchRoute.md
137+ goal:
138+ - "Produce $WORK_DIR/design/DevView.md, $WORK_DIR/design/TilingKey.md, $WORK_DIR/design/TilingData.md, and $WORK_DIR/design/BranchRoute.md for the operator in $WORK_DIR/spec/spec.yaml, following the operator's paradigm patterns.md."
139+ approach:
140+ - "Load the ops-design-paradigms skill first (mandatory), and load the paradigm patterns.md corresponding to $WORK_DIR/spec/spec.yaml's op.paradigms."
141+ - "Before writing TilingKey.md / BranchRoute.md, load the ascendc-build-system skill and read references/tiling-key-encoding.md; encode every tilingKey with the paradigm's GET_TPL_TILING_KEY actual bit encoding (never self-invented logical sequence numbers)."
142+ - "Copy the four templates the design-template skill's templates/design/{DevView,TilingKey,TilingData,BranchRoute}.md.templ to $WORK_DIR/design/, replacing every {OP} with the operator name (sed \"s/{OP}/${OP_NAME}/g\" with OP_NAME from spec.yaml; BranchRoute.md.templ carries no {OP} and is copied as-is)."
143+ - "Write DevView.md (开发视图) from its template: describe the file organization strictly per the paradigm patterns.md — the {op}_package/ project tree (op_host/ {op}_def.cpp OpDef registration with dtype/format combos and .ValueDepend(OPTIONAL) on value-dependent inputs, {op}_infershape.cpp InferShape/InferDataType registration matching InferShapeDtype.md, arch35/ tiling entry + split functions and the {OP}CompileInfo header; op_kernel/ arch35/ kernel templates, empty-tensor template, tiling_data.h TilingData struct, struct.h TilingKey template params, and the kernel-entry source declaring the __global__ __aicore__ entry that instantiates all TilingKey combinations). Replace every `>` lead-in."
144+ - "Write TilingKey.md (TilingKey 模板划分) from its template, following its 须包含 checklist item by item: (1) the TilingKey C++ struct definition as ASCENDC_TPL_* code, with no TilingKeyIS numeric branches unless the paradigm requires them; (2) the TPL_SEL combination table listing every TilingKey value combination with its trigger condition and covered dtype/shape; (3) the template partition table and binary instance count, where every boundary-case routing row is an actually reachable branch. Keep the branch-split discipline: only real structural/path differences become separate tilingKeys, pure parameter differences are parameterized. The tilingKey set produced here is the single source for BranchRoute.md and BranchCatalog.md. Replace every `>` lead-in."
145+ - "Write TilingData.md (TilingData 汇总结构体) from its template, following its 须包含 checklist item by item: (1) the complete TilingData C++ struct definition; (2) the field table (name / type / meaning / source from HostTiling.md / kernel consumption point from Kernel.md); (3) paradigm-specific constraints (e.g. Reduction valid/padded separation, cacheBufUbSize) where applicable. Replace every `>` lead-in."
146+ - "Write BranchRoute.md (分支判定与场景覆盖) from its template, following its 须包含 checklist item by item: (1) the tilingKey routing table (tilingKey / branch name / entry condition / covered scenario / corresponding Interface.md 算子规格 row); (2) branch priority and mutual-exclusion with a routing decision flowchart, where no two branches cover the same case; (3) the scenario coverage matrix, where every supported dtype combination falls into at least one branch. Its tilingKey set must match TilingKey.md exactly. Replace every `>` lead-in."
147+ - "Keep each template's section headings; do not touch any other design file."
148+ acceptance:
149+ - "All four files exist and are non-empty: test -s $WORK_DIR/design/DevView.md && test -s $WORK_DIR/design/TilingKey.md && test -s $WORK_DIR/design/TilingData.md && test -s $WORK_DIR/design/BranchRoute.md."
150+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/DevView.md $WORK_DIR/design/TilingKey.md $WORK_DIR/design/TilingData.md $WORK_DIR/design/BranchRoute.md."
151+ - "No `<...>` placeholder residue in the TilingKey / BranchRoute tables: ! grep -qE '<(name|case|dtype|shape|值|条件)>' $WORK_DIR/design/TilingKey.md $WORK_DIR/design/BranchRoute.md."
152+ - "Every `>` lead-in in each of the four files has been replaced with actual content: ! grep -qE '^>' $WORK_DIR/design/DevView.md $WORK_DIR/design/TilingKey.md $WORK_DIR/design/TilingData.md $WORK_DIR/design/BranchRoute.md."
153+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
154+ out_of_scope:
155+ - "Write only $WORK_DIR/design/DevView.md, TilingKey.md, TilingData.md, BranchRoute.md; do not create or modify any other file."
156+ - "Do not write kernel code, modify the engineering project, or run builds."
157+ depends_on:
158+ - init-design-dir
159+ max_retries: 2
160+ on_exhaust: exit
161+ - id: write-design-host-tiling
162+ task_type: normal
163+ executor: general-executor
164+ verifier: general-verifier
165+ title: Write the design document HostTiling.md
166+ goal:
167+ - "Produce $WORK_DIR/design/HostTiling.md for the operator in $WORK_DIR/spec/spec.yaml, following the operator's paradigm patterns.md Host-side Tiling chapter."
168+ approach:
169+ - "Load the ops-design-paradigms skill first (mandatory); read the Host-side Tiling chapter of the paradigm patterns.md (or other tiling content if absent) to determine the subsection structure."
170+ - "Read $WORK_DIR/spec/spec.yaml's determinism block (accumulation_order + bitwise_reproducible) and consult skills/ops-spec-gen/references/accumulation_order.md §0/§1/§3; make the split/tiling decisions consistent with it (stable_in_axis → partials merged in fixed order; bitwise_reproducible: true → document how the kernel path is fixed) and record this in the determinism guarantees subsection."
171+ - "Copy the design-template skill's templates/design/HostTiling.md.templ to $WORK_DIR/design/HostTiling.md, replacing every {OP} with the operator name (sed \"s/{OP}/${OP_NAME}/g\" with OP_NAME from spec.yaml)."
172+ - "Fill each subsection per the template's 须包含 checklist (liveness-node analysis, framework prerequisites, input preprocessing/axis fusion, UB split, multi-core split, group/2D split, fill TilingData + set TilingKey, host registration, overall Tiling structure, determinism guarantees); replace every `>` lead-in line with actual content; do not touch any other design file."
173+ acceptance:
174+ - "$WORK_DIR/design/HostTiling.md exists and is non-empty: test -s $WORK_DIR/design/HostTiling.md."
175+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/HostTiling.md."
176+ - "Every `>` lead-in has been replaced with actual content: ! grep -qE '^>' $WORK_DIR/design/HostTiling.md."
177+ - "Determinism is explicit and grounded: grep -qF 'accumulation_order' $WORK_DIR/design/HostTiling.md && grep -qF 'bitwise_reproducible' $WORK_DIR/design/HostTiling.md."
178+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
179+ out_of_scope:
180+ - "Write only $WORK_DIR/design/HostTiling.md; do not create or modify any other file."
181+ - "Do not write kernel code, modify the engineering project, or run builds."
182+ depends_on:
183+ - write-design-devview-tilingkey-tilingdata-branchroute
184+ max_retries: 2
185+ on_exhaust: exit
186+ - id: write-design-kernel
187+ task_type: normal
188+ executor: general-executor
189+ verifier: general-verifier
190+ title: Write the design document Kernel.md
191+ goal:
192+ - "Produce $WORK_DIR/design/Kernel.md for the operator in $WORK_DIR/spec/spec.yaml, following the operator's paradigm patterns.md Kernel-side chapter."
193+ approach:
194+ - "Load the ops-design-paradigms skill first (mandatory); read the Kernel-side chapter of the paradigm patterns.md and confirm the paradigm-specific requirements (the template's item 9 H4 breakdown)."
195+ - "Copy the design-template skill's templates/design/Kernel.md.templ to $WORK_DIR/design/Kernel.md, replacing every {OP} with the operator name (sed \"s/{OP}/${OP_NAME}/g\" with OP_NAME from spec.yaml)."
196+ - "Fill each item per the template's 须包含 checklist (Kernel entry, Kernel class declaration, scheduling framework, Init, Process per dtype, Sync, CopyIn/CopyInBrc, CopyOut, paradigm-specific Kernel subsections); replace every `>` lead-in line with actual content; do not touch any other design file."
197+ acceptance:
198+ - "$WORK_DIR/design/Kernel.md exists and is non-empty: test -s $WORK_DIR/design/Kernel.md."
199+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/Kernel.md."
200+ - "Every `>` lead-in has been replaced with actual content: ! grep -qE '^>' $WORK_DIR/design/Kernel.md."
201+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
202+ out_of_scope:
203+ - "Write only $WORK_DIR/design/Kernel.md; do not create or modify any other file."
204+ - "Do not write kernel code, modify the engineering project, or run builds."
205+ depends_on:
206+ - write-design-host-tiling
207+ - write-design-interface
208+ max_retries: 2
209+ on_exhaust: exit
210+ - id: write-design-api
211+ task_type: normal
212+ executor: general-executor
213+ verifier: general-verifier
214+ title: Write the design document API.md
215+ goal:
216+ - "Produce $WORK_DIR/design/API.md for the operator in $WORK_DIR/spec/spec.yaml: API mapping, API verification record, data-flow design, memory management, and UB capacity verification — the closing acceptance of the implementation-plan docs (DevView.md–API.md)."
217+ approach:
218+ - "Load the ops-design-paradigms skill first (mandatory); read the paradigm patterns.md sections on API mapping / API verification record / memory management / data-flow design / UB capacity verification to determine the subsection structure."
219+ - "Copy the design-template skill's templates/design/API.md.templ to $WORK_DIR/design/API.md (this template carries no {OP} placeholder; do not introduce one)."
220+ - "Fill each item per the template's 须包含 checklist (VF function signatures, API mapping table, API verification record, data-flow design, memory management, UB capacity verification); replace every `>` lead-in line with actual content."
221+ - "Per the template, if any API verification fails, roll back to $WORK_DIR/design/HostTiling.md to re-derive with a different API — this task may revise HostTiling.md / Kernel.md at the corresponding places until all API verifications pass."
222+ acceptance:
223+ - "$WORK_DIR/design/API.md exists and is non-empty: test -s $WORK_DIR/design/API.md."
224+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/API.md."
225+ - "Every `>` lead-in has been replaced with actual content: ! grep -qE '^>' $WORK_DIR/design/API.md."
226+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
227+ out_of_scope:
228+ - "Write only $WORK_DIR/design/API.md (and, only if an API verification fails, revise HostTiling.md / Kernel.md at the corresponding places); do not create or modify any other file."
229+ - "Do not write kernel code, modify the engineering project, or run builds."
230+ depends_on:
231+ - write-design-kernel
232+ max_retries: 2
233+ on_exhaust: exit
234+ - id: write-design-branch-catalog
235+ task_type: normal
236+ executor: general-executor
237+ verifier: general-verifier
238+ title: Write the design document BranchCatalog.md
239+ goal:
240+ - "Produce $WORK_DIR/design/BranchCatalog.md: the branch design catalog table registering, for every tilingKey, the branch name / entry condition / covered scenario / design file path, derived from $WORK_DIR/design/BranchRoute.md's branch determination."
241+ approach:
242+ - "Copy the design-template skill's templates/design/BranchCatalog.md.templ to $WORK_DIR/design/BranchCatalog.md, replacing every {OP} with the operator name (sed \"s/{OP}/${OP_NAME}/g\" with OP_NAME from spec.yaml)."
243+ - "Based on $WORK_DIR/design/BranchRoute.md's branch determination, write the catalog table: one row per tilingKey, registering branch name / entry condition / covered scenario / design file path $WORK_DIR/design/branches/DESIGN-BRANCH-<key>.md."
244+ - "The tilingKey set in BranchCatalog.md must match $WORK_DIR/design/BranchRoute.md exactly."
245+ - "Only register the catalog here; do not write any branch's detailed design, and do not touch any other design file."
246+ acceptance:
247+ - "$WORK_DIR/design/BranchCatalog.md exists and is non-empty: test -s $WORK_DIR/design/BranchCatalog.md."
248+ - "No operator-name placeholder residue: ! grep -qF '{OP}' $WORK_DIR/design/BranchCatalog.md."
249+ - "No `<...>` placeholder residue in the catalog table: ! grep -qE '<(name|条件|case)>' $WORK_DIR/design/BranchCatalog.md."
250+ - "Every `>` lead-in has been replaced with real content: ! grep -qE '^>' $WORK_DIR/design/BranchCatalog.md."
251+ - "The catalog table has one row per tilingKey, matching $WORK_DIR/design/BranchRoute.md's key set exactly (no missing, no extra), and each row references $WORK_DIR/design/branches/DESIGN-BRANCH-<key>.md."
252+ - "No unexpected file under $WORK_DIR/design/: ! find $WORK_DIR/design -maxdepth 1 -type f | grep -vE '/(INDEX|Overview|Interface|InferShapeDtype|Validation|DevView|TilingKey|TilingData|BranchRoute|HostTiling|Kernel|API|BranchCatalog|IterationPlan)[.]md$' | grep -q ."
253+ out_of_scope:
254+ - "Write only $WORK_DIR/design/BranchCatalog.md; do not create or modify any other file (including the branch design files, which are produced by a later task)."
255+ - "Do not write kernel code, modify the engineering project, or run builds."
256+ depends_on:
257+ - write-design-devview-tilingkey-tilingdata-branchroute
258+ max_retries: 2
259+ on_exhaust: exit
260+ - id: generate-design-subgraph
261+ task_type: normal
262+ executor: general-executor
263+ verifier: general-verifier
264+ title: Generate the branch design subgraph design-sub-graph.yaml
265+ goal:
266+ - "Read $WORK_DIR/design/BranchCatalog.md and produce $WORK_DIR/.workflow/design-sub-graph.yaml: one designer task per tilingKey writing $WORK_DIR/design/branches/DESIGN-BRANCH-<key>.md, each node satisfying the subgraph contract and carrying depends_on: [] (branches are independent)."
267+ - "Every generated node must carry an acceptance item requiring the branch design doc's code blocks to satisfy the DESIGN-BRANCH template's completeness contract: no '...'/'……'/省略 omission inside any code block, and every identifier the code uses (members, buffers, events, tiling-data fields) is declared in the doc. The design-verifier enforces this contract and rejects incomplete code blocks, so the requirement must be explicit in the node's acceptance."
268+ approach:
269+ - "Read $ORCH_SKILL/templates/basic_workflow.yaml first (ORCH_SKILL=the workflow-orchestrator skill directory) — the annotated schema template; the node keys and their list/str/int requirements are documented inline there, so take the node shape from it."
270+ - "Write the subgraph form: a mapping whose sole top-level key is nodes holding normal nodes only. Enumerate every tilingKey in BranchCatalog.md in registration order, one node per key, executor=designer / verifier=design-verifier, each writing $WORK_DIR/design/branches/DESIGN-BRANCH-<key>.md."
271+ - "Branch design nodes are independent — each writes its own file and shares no state — so every node's depends_on is []."
272+ acceptance:
273+ - 'Contract-valid: ORCH_SKILL=the workflow-orchestrator skill directory ; python3 -c "import sys; sys.path.insert(0,\"$ORCH_SKILL/scripts\"); import get_task; nodes,err=get_task.load_subgraph(\"$WORK_DIR/.workflow/design-sub-graph.yaml\"); assert not err, err" exits 0.'
274+ - 'Dep-free: python3 -c "import yaml; nodes=yaml.safe_load(open(\"$WORK_DIR/.workflow/design-sub-graph.yaml\")[\"nodes\"]; bad=[n[\"id\"] for n in nodes if n[\"depends_on\"]]; assert not bad, \"every node carries no dependency (depends_on: []); offenders: %s\" % bad" exits 0.'
275+ - "Node count equals the tilingKey count in BranchCatalog.md (no missing, no extra); node ids/titles/acceptance are traceable to BranchCatalog.md / BranchRoute.md; every node has executor=designer and verifier=design-verifier."
276+ - "Every node's acceptance includes the code-completeness item above (verbatim or faithfully rephrased; never dropped)."
277+ out_of_scope:
278+ - "Do not create or modify any file other than $WORK_DIR/.workflow/design-sub-graph.yaml."
279+ - "Do not execute the branch design tasks; do not write any branch design file."
280+ depends_on:
281+ - write-design-branch-catalog
282+ - write-design-api
283+ - write-design-overview
284+ - write-design-validation
285+ max_retries: 2
286+ on_exhaust: exit
287+ - id: design-branches
288+ task_type: subgraph
289+ file: .workflow/design-sub-graph.yaml
290+ depends_on:
291+ - generate-design-subgraph
@@ -0,0 +1,593 @@
1+workflow: op-impl
2+max_parallel: 10
3+system_prompt: If needed, dispatch multi subagents to explore code under $WORK_DIR/requirements/references(if exists) relevant
4+ to this task, as development reference.
5+nodes:
6+- id: generate-prototype-subgraph
7+ task_type: normal
8+ executor: general-executor
9+ verifier: general-verifier
10+ title: Generate the per-branch direct-invoke prototype subgraph
11+ goal:
12+ - 'Read $WORK_DIR/design/BranchCatalog.md and produce $WORK_DIR/.workflow/prototype-sub-graph.yaml: a dict with exactly
13+ one top-level key nodes holding M normal nodes, where M = the number of tilingKeys registered in BranchCatalog.md, discovered
14+ at runtime and never assumed — one standalone direct-invoke prototype task per tilingKey, all mutually independent so
15+ the orchestrator runs them concurrently (gen-golden completes before prototype-impl starts, so every prototype may cross-check
16+ against $WORK_DIR/golden.py). Nothing in this task may hardcode an operator name, a tilingKey set, or a branch count.'
17+ approach:
18+ - 'Node schema = op-develop.yaml normal task (id, task_type: normal, title, goal, approach, acceptance, out_of_scope, depends_on,
19+ executor, verifier, max_retries: 2, on_exhaust: exit). Write the file as a YAML mapping whose sole top-level key is nodes
20+ (a bare list is invalid). goal / approach / acceptance / out_of_scope must each be a non-empty LIST of non-empty strings
21+ (a plain string is rejected by the schema check); depends_on lists only ids that exist in the same file, and a node with
22+ no dependencies uses an empty list.'
23+ - 'Enumerate the tilingKeys in BranchCatalog.md registration order, m = 1..M; per key (with its DESIGN-BRANCH-<key>.md),
24+ generate one node:'
25+ - 'prototype-branch-<key> — executor kernel-developer, verifier kernel-verifier: prove this branch''s compute functionality
26+ as a standalone Ascend C direct-invoke prototype before any package integration, following the toolkit''s direct-invoke
27+ sample recipe: one self-contained .asc under $WORK_DIR/op/tests/prototype/branch-<key>/ (main.asc) holding BOTH the device
28+ kernel (taking a plain tiling struct by value) and a host test harness that queries the core count and UB size at runtime
29+ and launches the kernel directly — no op-package machinery. A standalone CMakeLists.txt beside the .asc builds it with
30+ the cann toolkit environment for the target NPU architecture recorded in $WORK_DIR/npu-arch.json.'
31+ - 'Derive the kernel logic ONLY from $WORK_DIR/design/ Overview + Interface + Validation and DESIGN-BRANCH-<key>.md compute
32+ semantics (data flow, dtype/cast contract, broadcast, boundary and special-value behavior) — do not copy the design''s
33+ Tiling/Kernel implementation: a simple self-made runtime split (runtime core/UB query) is enough, correctness over performance.'
34+ - 'Functional gate for prototype-branch-<key>: the harness embeds an independent CPU golden built from the same design semantics
35+ (dtype/cast contract, broadcast, boundary and special-value behavior); it drives the branch''s cases from DESIGN-BRANCH-<key>.md
36+ verification points and the Validation.md matrix rows routed to this branch; it prints a per-case PASS/FAIL summary and
37+ exits 0 only when every case passes; evidence in $WORK_DIR/op/tests/prototype/branch-<key>/prototype.log.'
38+ - 'Dependencies inside the subgraph: none — every prototype-branch-<key> has depends_on: [] (disjoint directories under
39+ $WORK_DIR/op/tests/prototype/, no shared build tree), so different branches'' prototypes run concurrently.'
40+ - Every node's goal must state its completion gate explicitly and reference its authoritative design docs by absolute path.
41+ acceptance:
42+ - 'Contract-valid: ORCH_SKILL=the workflow-orchestrator skill directory ; python3 -c "import sys; sys.path.insert(0,\"$ORCH_SKILL/scripts\");
43+ import get_task; nodes,err=get_task.load_subgraph(\"$WORK_DIR/.workflow/prototype-sub-graph.yaml\"); assert not err, err"
44+ exits 0.'
45+ - $WORK_DIR/.workflow/prototype-sub-graph.yaml exists; M equals the tilingKey count in $WORK_DIR/design/BranchCatalog.md;
46+ python3 -c "import yaml; d=yaml.safe_load(open('$WORK_DIR/.workflow/prototype-sub-graph.yaml')); assert isinstance(d,dict)
47+ and set(d)=={'nodes'} and len(d['nodes'])==M" exits 0.
48+ - Node ids are exactly prototype-branch-<key> for the tilingKeys registered in BranchCatalog.md, in BranchCatalog.md registration
49+ order; each node's DESIGN-BRANCH-<key>.md reference matches its tilingKey.
50+ - 'Every node satisfies the normal-task schema with executor kernel-developer, verifier kernel-verifier, and depends_on:
51+ [] (full branch concurrency); every node''s acceptance is checkable (exit codes / file paths / log contents).'
52+ - 'Golden independence: every generated prototype node''s goal/approach requires its harness expected values to be cross-checked
53+ against $WORK_DIR/golden.py, and the harness cites the golden derivation (verifier traces one case per branch).'
54+ out_of_scope:
55+ - Do not create or modify any file other than $WORK_DIR/.workflow/prototype-sub-graph.yaml; do not write kernel code; do
56+ not execute any prototype task.
57+ depends_on: []
58+ max_retries: 2
59+ on_exhaust: exit
60+- id: prototype-impl
61+ task_type: subgraph
62+ file: .workflow/prototype-sub-graph.yaml
63+ depends_on:
64+ - generate-prototype-subgraph
65+ - gen-golden
66+ - setup-op-package
67+- id: setup-op-package
68+ task_type: normal
69+ executor: general-executor
70+ verifier: general-verifier
71+ title: Initialize and verify the operator package from the registry-invoke template
72+ goal:
73+ - Initialize the complete operator package from the ascendc-registry-invoke-template skill into $WORK_DIR/op/, rename it
74+ to the target operator, and verify the template's example test.
75+ approach:
76+ - 'Derive the operator''s three name forms from spec.yaml: OP_SNAKE = op.name, OP_PASCAL = PascalCase, OP_UPPER = UPPER_SNAKE.'
77+ - 'Resolve the template through the relative skill symlink: WORKFLOW_YAML=$(python3 -c "import json; print(json.load(open(''$WORK_DIR/.workflow/status.json''))[''workflow''])")
78+ ; TEMPLATE_DIR=$(dirname "$(dirname "$WORKFLOW_YAML")")/skills/ascendc-registry-invoke-template ; test -f $TEMPLATE_DIR/SKILL.md
79+ && test -d $TEMPLATE_DIR/references/add_example.'
80+ - 'Create a fresh package from the template: rm -rf $WORK_DIR/op && mkdir -p $WORK_DIR/op && cp -a $TEMPLATE_DIR/references/add_example/.
81+ $WORK_DIR/op/ && rm -rf $WORK_DIR/op/tests. Keep the template''s ACLNN example as the baseline.'
82+ - 'Rename every file under $WORK_DIR/op/ whose name contains add_example to OP_SNAKE, then replace all sample name forms
83+ in file contents: add_example->OP_SNAKE, AddExample->OP_PASCAL, ADD_EXAMPLE->OP_UPPER; set the root CMake package_name
84+ to OP_PASCAL and update any ACLNN symbol references to aclnn<OP_PASCAL>.'
85+ - Build the initialized package with its template build.sh for the lab NPU generation, install the generated .run into $WORK_DIR/dev-package,
86+ then run the template's eager example from $WORK_DIR/op/examples/. Point the example at $WORK_DIR/dev-package/vendors/<OP_PASCAL>
87+ by exporting ASCEND_CUSTOM_OPP_PATH and placing that vendor's op_api/lib first in LD_LIBRARY_PATH; do not fall back to
88+ the system opp vendors directory. Write the example output and environment evidence to $WORK_DIR/op/examples/verify.log.
89+ acceptance:
90+ - '$WORK_DIR/op/ contains the package skeleton: test -d $WORK_DIR/op/op_host && test -d $WORK_DIR/op/op_kernel && test -d
91+ $WORK_DIR/op/op_graph && test -f $WORK_DIR/op/build.sh && test -f $WORK_DIR/op/CMakeLists.txt && test -f $WORK_DIR/op/README.md
92+ && test ! -e $WORK_DIR/op/tests.'
93+ - 'No sample-name residue: ! grep -RniE ''add_example|AddExample|ADD_EXAMPLE|addExample'' $WORK_DIR/op/.'
94+ - 'Run package installed into dev-package: OP_PASCAL=$(python3 -c "import yaml; n=yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml''))[''op''][''name''];
95+ print(''''.join(w.capitalize() for w in n.split(''_'')))") ; test -s $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so.'
96+ - 'Template example passes: cd $WORK_DIR/op/examples && ./run.sh --eager > verify.log 2>&1 && ! grep -qF ''FAILED'' verify.log
97+ && grep -qF ''PASS'' verify.log.'
98+ - 'The example library resolves from dev-package: OP_PASCAL=$(python3 -c "import yaml; n=yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml''))[''op''][''name''];
99+ print(''''.join(w.capitalize() for w in n.split(''_'')))") ; ldd $WORK_DIR/op/examples/build-eager/bin/test_aclnn_$OP_PASCAL
100+ | grep -F ''libcust_opapi.so'' | grep -qF $WORK_DIR/dev-package/vendors/$OP_PASCAL.'
@@ -0,0 +1,204 @@
1+# Incremental-development module (op-update). Applies a bounded capability delta to
2+# an EXISTING operator package without re-designing it: the delta requirement is
3+# caller-supplied ($WORK_DIR/需求分析.md — goal / acceptance / scope / out-of-scope,
4+# written by the new-features skill or by the caller) and the package under
5+# $WORK_DIR/op/ is the artifact under change; the pre-change state is frozen as a
6+# boundary-gate baseline so no pass can come from silently editing the oracle.
7+# Input: the delta requirement, the existing operator package (one op or several
8+# variants) with its existing suites, and the frozen anchors golden.py, spec/ or
9+# design/ when present, npu-arch.json, ttk.conf.yaml, ops-test-kit/. Output: the
10+# package extended for the delta (op_host/op_kernel/op_api of the target op only),
11+# its suites extended with delta UT/ST cases, regression-green on the frozen full
12+# suite plus the new delta cases through TTK aclnn mode, with a recorded code review
13+# and the paired interface docs. This is ONE concrete composition the new-features
14+# skill can emit for the common delta shape; it runs standalone on any work_dir that
15+# holds the frozen inputs. The orchestrator wires the Codex layout
16+# ($WORK_DIR/.agents/skills plus $WORK_DIR/.codex/agents) automatically via
17+# link_agent_config.py.
18+workflow: op-update
19+max_parallel: 10
20+system_prompt: If needed, dispatch multi subagents to explore the existing operator package under $WORK_DIR/op/ and the delta requirement under $WORK_DIR/需求分析.md relevant to this task, as development reference.
21+nodes:
22+ - id: verify-baseline
23+ task_type: normal
24+ executor: general-executor
25+ verifier: general-verifier
26+ title: Module boundary gate - verify the existing-package contract and freeze the pre-change baseline
27+ goal:
28+ - 'Prove the frozen inputs in $WORK_DIR satisfy the op-update module input contract before any change starts: the delta requirement $WORK_DIR/需求分析.md parses with its goal / acceptance / scope / out-of-scope parts, the existing operator package under $WORK_DIR/op/ is present and rebuilds green for the recorded SoC, installs into this work_dir own dev-package, and exports the aclnn L2 symbol pair — so the delta is applied to a known-good, proven package.'
29+ - 'Completion gate: the package shape and build entry are resolved and recorded in $WORK_DIR/update/target-op.json (never assumed from a fixed template layout), the rebuild through that resolved entry exits 0, the delta requirement four parts are present, a baseline oracle exists at $WORK_DIR/golden.py (the package own oracle, or one this node establishes from the package own reference assets when the staging authority recorded it absent), the aclnn symbol pair is exported whenever the package carries an aclnn op_api layer, and the pre-change baseline digest file is written with absolute paths so no downstream pass can come from silently editing the oracle.'
30+ approach:
31+ - 'This node verifies, never fixes: the inputs are final caller products. A failing check is a module-boundary violation (a fixture defect), reported as FAILED with the failing check named — do not edit any input to make a check pass.'
32+ - 'Derive and record the target operator name forms: read the target operator(s) named by $WORK_DIR/需求分析.md; when $WORK_DIR/spec/spec.yaml is present the spec is the identifier-of-record for the name. Write $WORK_DIR/update/target-op.json as {"snake": OP_SNAKE, "pascal": OP_PASCAL, "variants": [each variant/operator subtree under $WORK_DIR/op/ the delta names]} — this is the name contract every later node reads.'
33+ - 'Input contract: the delta requirement $WORK_DIR/需求分析.md (goal / acceptance / scope / out-of-scope); the EXISTING package $WORK_DIR/op/ copied from a read-only repo clone, always carrying op_host/ (def/infershape/tiling), op_kernel/, CMakeLists.txt and its existing tests/, and carrying op_graph/, a package-local build.sh and an aclnn op_api layer (at the package root op_api/ or nested under op_host/op_api/) only when that operator package really has them — the package shape is discovered at runtime, never asserted; the frozen anchors $WORK_DIR/npu-arch.json, $WORK_DIR/ttk.conf.yaml, $WORK_DIR/ops-test-kit/ (and $WORK_DIR/golden.py when the package carries an oracle, else established below); $WORK_DIR/spec/ and $WORK_DIR/design/ when present (optional for a delta on an existing op).'
34+ - 'Rebuild the EXISTING package from its own sources for the recorded SoC: cd $WORK_DIR/op && ./build.sh with the SoC argument required for the architecture recorded in $WORK_DIR/npu-arch.json exits 0 (the CMake falls back to $ENV{ASCEND_HOME_PATH} when CANN_HOME is unset; only if both are unset, source the toolkit set_env.sh first). Then rm -rf $WORK_DIR/dev-package and install the produced run package $WORK_DIR/op/build/custom_opp_ubuntu_x86_64.run with bash <run package> --quiet --nox11 --force --install-path=$WORK_DIR/dev-package.'
35+ - 'Freeze the pre-change baseline by copy + digest (the aclnn-migrate PROTOTYPE_BASELINE pattern): copy the EXISTING operator sources under $WORK_DIR/op/ — op_host/, op_kernel/, op_graph/ and the resolved op_api_dir, each only when the package actually carries it — to $WORK_DIR/update/baseline/sources/, and the EXISTING case sets under $WORK_DIR/op/tests/ to $WORK_DIR/update/baseline/cases/ (excluding any build/ and dev-package/ artifacts). These frozen copies are the delta provenance anchor and the frozen full suite node 6 re-runs; the live copies are the ones the delta edits.'
36+ - 'Resolve and record the package contract at runtime (the corpus is real repo operator packages, not template-built ones): into $WORK_DIR/update/target-op.json record the shape this node observed — build.entry (the build entry the package actually carries: a package-local ./build.sh when it exists, else the enclosing operator repository build entry reachable from the package and invoked for this operator with the recorded SoC), op_api_dir (the ABSOLUTE path of the directory actually carrying the aclnn L2/L0 quadruple, or null only when the package genuinely carries no aclnn op_api layer), and an op_api present flag. Every later acceptance reads this record instead of re-deriving or assuming a layout, and the recorded op_api_dir is cross-checked against the package (a null record over a package that does have an op_api directory is a defect).'
37+ - 'Establish the frozen oracle when the package carries none: the staging authority records golden.py absent and leaves establishing it to this node. Derive the baseline oracle from the package own reference assets (a *golden*.py under the package tests, the package reference implementation, or the reference formula the delta requirement declares), write it to $WORK_DIR/golden.py, and record the derivation source and method in BASELINE.md (absence is recorded, never fabricated silently; an existing package oracle is used as-is and never overwritten). If no oracle can be established, this node FAILs with that attribution — the module never proceeds without a baseline oracle.'
38+ - 'Write $WORK_DIR/update/BASELINE.sha256 in sha256sum format covering the frozen baseline copies under $WORK_DIR/update/baseline/ AND the live oracle $WORK_DIR/golden.py, with ABSOLUTE paths so sha256sum -c is location-independent; downstream nodes run sha256sum -c --quiet against it (nothing in that set is edited by any later node — a mismatch means the frozen baseline or the golden oracle was silently edited to force a pass).'
39+ - 'Write $WORK_DIR/update/BASELINE.md recording the resolved target-op.json, the before-state digests of the existing sources and existing case sets (what each frozen copy preserves), the existing suite data-row counts as the pre-change full-suite baseline, and the pre-change closing-regression green state (the tiling / op_api UT 0-failed result) — so the delta can be attributed file-by-file after the fact.'
40+ acceptance:
41+ - 'Target op resolved: test -s $WORK_DIR/update/target-op.json && python3 -c "import json;d=json.load(open(''$WORK_DIR/update/target-op.json''));assert d.get(''snake'') and d.get(''pascal'')" exits 0.'
42+ - 'Delta requirement present: test -s $WORK_DIR/需求分析.md.'
43+ - 'Package core present: test -d $WORK_DIR/op/op_host && test -d $WORK_DIR/op/op_kernel && test -f $WORK_DIR/op/CMakeLists.txt && test -d $WORK_DIR/op/tests; the rest of the shape (op_api/ at the package root or nested under op_host/op_api/, op_graph/, a package-local build.sh) is resolved at runtime into $WORK_DIR/update/target-op.json, never asserted from a template layout.'
44+ - 'Target op_api quadruple present wherever the package carries an aclnn op_api layer (fail-closed: a recorded-absent op_api layer is rejected if an op_api directory actually exists, so the gate can never be dodged by recording null): OP_SNAKE=$(python3 -c "import json;print(json.load(open(''$WORK_DIR/update/target-op.json''))[''snake''])") ; OA=$(python3 -c "import json;print(json.load(open(''$WORK_DIR/update/target-op.json'')).get(''op_api_dir'') or '''')") ; if [ -z "$OA" ]; then ! find $WORK_DIR/op -maxdepth 2 -type d -name op_api | grep -q . ; else test -f "$OA/aclnn_${OP_SNAKE}.h" && test -f "$OA/aclnn_${OP_SNAKE}.cpp" && test -f "$OA/${OP_SNAKE}.h" && test -f "$OA/${OP_SNAKE}.cpp" ; fi.'
45+ - 'Frozen anchors present (the oracle is established just below when the package carried none): test -s $WORK_DIR/golden.py && test -s $WORK_DIR/npu-arch.json && test -s $WORK_DIR/ttk.conf.yaml && test -d $WORK_DIR/ops-test-kit.'
46+ - 'Build passes for the recorded SoC through the resolved build entry: the build.entry recorded in $WORK_DIR/update/target-op.json (a package-local ./build.sh when the package is self-contained, else the enclosing operator repository build entry invoked for this operator with the SoC recorded in $WORK_DIR/npu-arch.json) exits 0; if no build entry is resolvable from the staged package the node FAILs with that fixture attribution rather than assuming ./build.sh exists.'
47+ - 'Deployment installed: OP_PASCAL=$(python3 -c "import json;print(json.load(open(''$WORK_DIR/update/target-op.json''))[''pascal''])") ; OA=$(python3 -c "import json;print(json.load(open(''$WORK_DIR/update/target-op.json'')).get(''op_api_dir'') or '''')") ; test -d $WORK_DIR/dev-package && { [ -z "$OA" ] || test -s $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so ; }.'
48+ - 'L2 symbol pair exported whenever the package carries an aclnn op_api layer: when op_api_dir in $WORK_DIR/update/target-op.json is non-null, nm -D $WORK_DIR/dev-package/vendors/$OP_PASCAL/op_api/lib/libcust_opapi.so | grep -cE " T aclnn<OP_PASCAL>(GetWorkspaceSize)?$" equals 2 (with <OP_PASCAL> read from target-op.json); when it is null this check is recorded not-applicable, never silently dropped.'
49+ - 'Baseline frozen and well-formed: test -s $WORK_DIR/update/BASELINE.md && test -s $WORK_DIR/update/BASELINE.sha256 && test -d $WORK_DIR/update/baseline && sha256sum -c --quiet $WORK_DIR/update/BASELINE.sha256 exits 0.'
50+ out_of_scope:
51+ - 'Verify only: no file under $WORK_DIR/op/, $WORK_DIR/spec/, $WORK_DIR/design/, $WORK_DIR/npu-arch.json, $WORK_DIR/ttk.conf.yaml or $WORK_DIR/需求分析.md is modified, and an existing $WORK_DIR/golden.py is never overwritten; the only writes are $WORK_DIR/update/target-op.json, $WORK_DIR/update/BASELINE.md, $WORK_DIR/update/BASELINE.sha256, the frozen copies under $WORK_DIR/update/baseline/, $WORK_DIR/golden.py when the package carried no oracle and this node establishes one, and the fresh $WORK_DIR/dev-package/ install plus the build artifacts the resolved build entry regenerates under $WORK_DIR/op/build/.'
52+ - 'Do not run any device test, ttk batch, tiling UT or whitebox batch in this node; do not fix a failing check — report it.'
53+ depends_on: []
54+ max_retries: 2
55+ on_exhaust: exit
56+ - id: analyze-delta
57+ task_type: normal
58+ executor: general-executor
59+ verifier: general-verifier
60+ title: Analyze the delta - impact surface and scenario decomposition
61+ goal:
62+ - 'Read the delta requirement $WORK_DIR/需求分析.md and walk the EXISTING package under $WORK_DIR/op/, then produce $WORK_DIR/delta/ANALYSIS.md: the bounded capability delta restated (it adds support for a case; it does not re-design the operator), the impact-surface table mapping each design intent to a file:line in op_host/op_kernel/op_api with a reuse/extend/new-branch/new-validation verdict, and the scenario decomposition the fan-out subgraph is built from.'
63+ - 'Completion gate: ANALYSIS.md exists non-empty with its delta restatement, its impact-surface table and its scenario table (## 影响面 and ## 场景分解 sections); every impact row names a real file:line under op_host/, op_kernel/ or op_api/ and a verdict; every scenario cell names its owning operator/variant subtree, its impact rows and a machine-checkable acceptance; and the scenario table is mirrored as the machine-readable $WORK_DIR/delta/scenarios.json that generate-update-subgraph reads.'
64+ approach:
65+ - 'Restate the delta as a bounded capability delta against the EXISTING implementation and keep the existing contract fixed: the change adds a case / branch / validation, it does not re-design the operator. Name the repo shape, operator, snake/Pascal/UPPER name forms, variant/tilingKey set and SoC from $WORK_DIR/update/target-op.json and $WORK_DIR/npu-arch.json — a combination outside this surface stops and is reported, it never borrows a neighbour diff.'
66+ - 'Build the impact surface by walking the existing host/kernel/api call chain (the operator own source under $WORK_DIR/op/op_host/, op_kernel/, op_api/) and diffing the intended delta against the code: for each design intent of $WORK_DIR/需求分析.md record one impact row — design intent -> file:line in op_host/op_kernel/op_api -> verdict in {reuse, extend, new-branch, new-validation}. reuse means the branch already implements the intent; new-validation means a rejected case the requirement demands (a violating case that PASSes means a missing validation, not a missing feature). Every row must cite a real file:line.'
67+ - 'Decompose the delta into scenario cells for fan-out: the cells are the (operator/variant x scenario) pairs of the delta — generic, driven by the requirement, never hardcoded (e.g. an empty-tensor delta yields per-variant x {legal-empty accepted, non-empty-output rejected, dtype/alias compatibility} cells; the cell set is whatever the delta acceptance admits). Each cell lists the impact rows it realizes, its owning operator/variant subtree under $WORK_DIR/op/, and its acceptance restated as a machine-checkable check.'
68+ - 'Write $WORK_DIR/delta/scenarios.json as the machine contract: a list of {"id", "op", "subtree", "scenario", "impact_rows", "acceptance"} in the ANALYSIS.md table order — generate-update-subgraph reads it to emit one child node per cell. The markdown table in ANALYSIS.md and scenarios.json carry the same cells in the same order (one source of truth, two views).'
69+ - 'Classify each cell failure vocabulary with the workflow triage line so the later fix loop routes correctly: build failure -> ascendc-compile-debug; AIC error, crash, error codes, hang, timeout -> ascendc-runtime-debug; wrong precision -> ascendc-precision-debug; TTK-framework-level failure -> ttk-how-diagnose.'
70+ acceptance:
71+ - 'Analysis present: test -s $WORK_DIR/delta/ANALYSIS.md && test -s $WORK_DIR/delta/scenarios.json.'
72+ - 'Delta restatement and impact surface present: grep -q "影响面" $WORK_DIR/delta/ANALYSIS.md and grep -q "场景分解" $WORK_DIR/delta/ANALYSIS.md; the impact-surface table has at least one row; every row cites a file:line under op_host/, op_kernel/ or op_api/ and a verdict in {reuse, extend, new-branch, new-validation} (verifier cross-checks each cited file:line against $WORK_DIR/op/).'
73+ - 'Scenario table well-formed: python3 -c "import json;d=json.load(open(''$WORK_DIR/delta/scenarios.json''));assert isinstance(d,list) and d and all(x.get(''id'') and x.get(''op'') and x.get(''subtree'') and x.get(''scenario'') and x.get(''impact_rows'') and x.get(''acceptance'') for x in d)" exits 0.'
74+ - 'Views agree: the number of cells in the ANALYSIS.md scenario table equals len(scenarios.json) and the ids match in order (verifier checks both).'
75+ - 'Every impact row is consumed: the union of the cells impact_rows covers every non-reuse impact row of the table (a new-branch/new-validation/extend row assigned to no cell fails the review).'
76+ out_of_scope:
77+ - 'Write only $WORK_DIR/delta/; do not modify any file under $WORK_DIR/op/ (this node analyses, it does not change code), $WORK_DIR/golden.py, $WORK_DIR/spec/, $WORK_DIR/update/ or the delta requirement.'
78+ depends_on:
79+ - verify-baseline
80+ max_retries: 2
81+ on_exhaust: exit
82+ - id: generate-update-subgraph
83+ task_type: normal
84+ executor: general-executor
85+ verifier: general-verifier
86+ title: Generate the per-scenario update subgraph update-sub-graph.yaml
87+ goal:
88+ - 'Read $WORK_DIR/delta/scenarios.json (and $WORK_DIR/delta/ANALYSIS.md) and produce $WORK_DIR/.workflow/update-sub-graph.yaml: a dict with exactly one top-level key nodes holding K normal nodes, one per scenario cell, id update-scenario-<k> — each child contract is to implement that cell delta rows under the fix whitelist, rebuild and redeploy green, and make the cell acceptance green. Nothing in this task may hardcode an operator name, a scenario set or a cell count.'
89+ - 'Completion gate: the subgraph file loads through the harness validator (get_task.load_subgraph returns no error), K equals the scenarios.json cell count, and every child satisfies the 12-key normal-task schema with executor general-executor, verifier general-verifier, max_retries 2, on_exhaust exit.'
90+ approach:
91+ - 'Node schema = the harness normal task (id, task_type: normal, title, goal, approach, acceptance, out_of_scope, depends_on, executor, verifier, max_retries: 2, on_exhaust: exit) — exactly these 12 keys. Write the file as a YAML mapping whose sole top-level key is nodes (a bare list is invalid). goal / approach / acceptance / out_of_scope must each be a non-empty LIST of non-empty strings (a plain string is rejected by schema validation); depends_on lists only ids that exist in the same file, and a node with no dependencies uses an empty list.'
92+ - 'Enumerate the scenario cells in scenarios.json order, k = 1..K; per cell generate one node update-scenario-<k> — executor general-executor, verifier general-verifier. Its contract: implement exactly the cell impact rows (from $WORK_DIR/delta/ANALYSIS.md) inside the fix whitelist — op_host/, op_kernel/ and the resolved op_api_dir of the cell TARGET operator/variant subtree only, never a neighbour subtree — then rebuild and redeploy (through the build.entry resolved in $WORK_DIR/update/target-op.json for the recorded SoC, reinstall into $WORK_DIR/dev-package) and make the cell acceptance check green. It cites the cell ANALYSIS.md rows by id.'
93+ - 'Serialization (the build tree and dev-package are resources with no lock in this orchestrator, and they are shared by EVERY cell, not only by cells of one subtree): a child edits sources, then rebuilds through the resolved build entry and reinstalls into $WORK_DIR/dev-package — so no two children may rebuild or redeploy concurrently, whatever their subtree. Enumerate the cells in $WORK_DIR/delta/scenarios.json order and emit a single linear chain: child k (k = 1..K) depends_on child k-1, and child 1 uses depends_on: []. Source-disjointness alone does NOT make concurrent rebuilds safe (the build tree $WORK_DIR/op/build and $WORK_DIR/dev-package are shared), so subtree-scoping is never the serialization rule — this mirrors op-impl.yaml rule that kernel-touching steps of different branches never run concurrently.'
94+ - 'Each child acceptance is machine-checkable and stated concretely: the cell delta rows are realized at the cited file:line (the verifier re-reads the location), the package rebuilds for the recorded SoC (build.sh exits 0), the redeployment exports the aclnn symbol pair, and the cell own acceptance check (from scenarios.json) passes — expressed with exit codes / grep / row counts, never a self-declaration.'
95+ - 'Every child goal states its completion gate explicitly and references its authoritative ANALYSIS.md rows and target subtree by absolute path; every child out_of_scope names the frozen assets (golden.py, $WORK_DIR/update/baseline/, neighbour subtrees, $WORK_DIR/需求分析.md) read-only and forbids fixes outside its own subtree.'
96+ acceptance:
97+ - 'Contract-valid: ORCH_SKILL=the workflow-orchestrator skill directory ; python3 -c "import sys; sys.path.insert(0,\"$ORCH_SKILL/scripts\"); import get_task; nodes,err=get_task.load_subgraph(\"$WORK_DIR/.workflow/update-sub-graph.yaml\"); assert not err, err" exits 0.'
98+ - 'File shape: test -s $WORK_DIR/.workflow/update-sub-graph.yaml && python3 -c "import yaml,json; s=json.load(open(''$WORK_DIR/delta/scenarios.json'')); d=yaml.safe_load(open(''$WORK_DIR/.workflow/update-sub-graph.yaml'')); assert isinstance(d,dict) and set(d)=={''nodes''} and len(d[''nodes''])==len(s)" exits 0.'
99+ - 'Node ids are exactly update-scenario-<k> for k = 1..K in scenarios.json order, one per cell, and each child cites its cell ANALYSIS.md impact rows.'
100+ - 'Every child satisfies the 12-key normal-task schema with executor general-executor, verifier general-verifier, max_retries 2, on_exhaust exit; every child acceptance is checkable (exit codes / file paths / row counts).'
101+ - 'Serialization encoded: the children form one linear chain in scenarios.json order — update-scenario-k depends_on update-scenario-(k-1), and update-scenario-1 depends_on [] — so no two children can rebuild or redeploy the shared build tree / dev-package concurrently; the verifier confirms this shape from the file (a total chain is the only shape that makes the shared build tree safe), and get_task.load_subgraph above confirms every depends_on resolves inside the file.'
102+ - 'Whitelist encoded: every child out_of_scope restricts edits to op_host/op_kernel/op_api of its own target subtree only.'
103+ out_of_scope:
104+ - 'Do not create or modify any file other than $WORK_DIR/.workflow/update-sub-graph.yaml; do not write operator code; do not execute any scenario task.'
105+ depends_on:
106+ - analyze-delta
107+ max_retries: 2
108+ on_exhaust: exit
109+ - id: update-scenarios
110+ task_type: subgraph
111+ file: .workflow/update-sub-graph.yaml
112+ depends_on:
113+ - generate-update-subgraph
114+ - id: update-ut-st
115+ task_type: normal
116+ executor: general-executor
117+ verifier: general-verifier
118+ title: Extend the test suites for the delta - new UT/ST cases, existing suites untouched and green
119+ goal:
120+ - 'Extend the operator test suites for the delta: add UT and ST cases covering each scenario cell of $WORK_DIR/delta/scenarios.json — following op-impl.yaml write-tiling-ut and whitebox-gen node patterns, with cases derived from the delta acceptance semantics and ordered risk-first so the precision-critical and rejection scenarios run earliest — while every existing suite stays untouched (delta cases land in new files) and green.'
121+ - 'Completion gate: new UT cases exist for the delta host-visible branches (tiling validation / op_api L2), the host UT suites pass green under the isolated harness, the new ST device cases are declared for full-regression, and the existing suites row counts equal the baseline (nothing removed or rewritten).'
122+ approach:
123+ - 'Source the case set from the delta acceptance semantics: $WORK_DIR/delta/ANALYSIS.md impact rows and $WORK_DIR/需求分析.md acceptance — one case per scenario cell semantic (acceptance) and per new-validation (rejection) so every new branch has a regression guard. Risk-order: the precision-critical and rejection cases land in the earliest rows.'
124+ - 'UT: follow op-impl.yaml write-tiling-ut discipline for host-visible delta branches — one TEST_F per new tiling validation/short-circuit exit and per new op_api L2 branch, expectations from an independent hand-written oracle (never by including the implementation own tiling_struct/tiling headers), covering boundary values and the exact threshold +-1 where the delta introduces one. Run cd $WORK_DIR/op/tests/tiling && ./run.sh green (0 failed) and the op_api UT likewise; record the output in $WORK_DIR/update/ut-delta.log.'
125+ - 'ST: declare the new device cases as NEW CSV files under $WORK_DIR/op/tests/ following the standard L0/L1/L2 layer layout, using exactly the suffixes the blackbox-tester merge step globs — positive *_l0_functional.csv / *_l1_functional.csv and negative *_l2_exception.csv — so the merge step sees every delta case (a case written to any other suffix would be invisible to merge_cases.py and silently dropped from the regression); do not hand-edit existing case CSVs (the existing suite is frozen).'
126+ - 'Where the delta adds a validation, guard it with a failing case that actually feeds the relation the branch checks (mount the optional inputs the branch keys off, at the indices that are actually instanced); a case that only names a branch without exercising it does not cover it, and where the generator cannot express a required input pattern, extend it rather than record a gap.'
127+ - 'Guard the frozen baseline: compare the existing case sets under $WORK_DIR/op/tests/ against $WORK_DIR/update/baseline/cases/ — the pre-existing files/rows are unchanged (delta cases are additions in new files); record the existing row count and the delta row count.'
128+ - 'Evidence: $WORK_DIR/update/ut-st-delta.RECORD.md records the new case set (per scenario cell), the running counts, and the existing-suite untouched confirmation.'
129+ acceptance:
130+ - 'Host UT green: when the package ships a tiling UT, cd $WORK_DIR/op/tests/tiling && ./run.sh exits 0 with 0 failed, recorded in $WORK_DIR/update/ut-delta.log; the op_api UT suite under $WORK_DIR/op/tests/ likewise runs green (0 failed) when the delta touches op_api.'
131+ - 'Coverage of every scenario cell: every scenario cell in $WORK_DIR/delta/scenarios.json has at least one new UT or ST case citing it (recorded in ut-st-delta.RECORD.md); the verifier cross-checks cell-by-cell.'
132+ - 'New ST cases declared: new *_l0_functional.csv / *_l1_functional.csv / *_l2_exception.csv files exist under $WORK_DIR/op/tests/ and each is non-empty — these are exactly the suffixes merge_cases.py globs (positive *_l0_functional.csv / *_l1_functional.csv, negative *_l2_exception.csv), so no delta case is written to a suffix the merge step cannot see.'
133+ - 'Existing suites untouched: the pre-existing case files/rows under $WORK_DIR/op/tests/ are byte-unchanged versus $WORK_DIR/update/baseline/cases/ (new cases live in new files); the existing data-row count equals the baseline count recorded by verify-baseline.'
134+ - 'Oracle independence: the UT does not include the implementation own tiling_struct/tiling_arch35 headers (verifier checks the UT source); every new expect-failure case feeds the relation its validation checks.'
135+ - 'Evidence recorded: test -s $WORK_DIR/update/ut-st-delta.RECORD.md.'
136+ out_of_scope:
137+ - 'Modify only $WORK_DIR/op/tests/ (new UT/ST files) and $WORK_DIR/update/; the existing case sets are not edited (frozen); $WORK_DIR/golden.py, the tolerances and $WORK_DIR/update/baseline/ are read-only.'
138+ depends_on:
139+ - update-scenarios
140+ max_retries: 2
141+ on_exhaust: exit
142+ - id: full-regression
143+ task_type: normal
144+ executor: general-executor
145+ verifier: general-verifier
146+ title: Full regression - the frozen full suite plus the new delta cases green through TTK aclnn mode
147+ goal:
148+ - 'Prove the extended package still reproduces the frozen full suite and additionally lands the delta: run the frozen full suite (the verified baseline case sets) PLUS the new delta cases through TTK aclnn mode — every positive case precision-PASS and every negative case rejected — and re-run the host UT suites green when the delta changed code.'
149+ - 'Completion gate: the positive suite is all-green (parse_result.py --expect-total N exits 0), the negative suite is all-rejected (parse_result.py --negative exits 0), check_op_binpath proves the tested kernel came from THIS work_dir deployment, and the frozen baseline digest verifies (sha256sum -c exits 0).'
150+ approach:
151+ - 'Merge the suites with the blackbox-tester skill merge_cases.py (column-union, offset normalization; its exact-suffix matching keeps *_oversized.csv side tables out by construction). merge_cases.py takes ONE case directory and globs *_l0_functional.csv / *_l1_functional.csv as positive and *_l2_exception.csv as negative, so stage a merge input directory holding the frozen baseline case sets under $WORK_DIR/update/baseline/cases/ (the pre-change full suite, proven intact by the baseline digest) PLUS ONLY the new delta case files under $WORK_DIR/op/tests/ — never also the live copies of the pre-existing cases, which are the same rows as the frozen set and would be double-counted. Run it into a positive suite $WORK_DIR/op/tests/regression/blackbox_all.csv and a negative suite $WORK_DIR/op/tests/regression/blackbox_l2_neg.csv; record each suite data-row count — the --expect-total value — and the split (frozen count + delta count).'
152+ - 'Run TTK aclnn mode from $WORK_DIR/ops-test-kit (the blackbox-tester skill is the invocation authority for environment, vendor visibility, bin-path proof and result parsing): positive suite full (rm -f the result file first; python3 -m ttk aclnn -i $WORK_DIR/op/tests/regression/blackbox_all.csv --pc=1 --task-prof false --run 1 --device-whitelist 0 --input-dist uniform --compare stat_rel_err --plugin $WORK_DIR/golden.py -o $WORK_DIR/op/tests/regression/result.csv), negative suite likewise to result_l2.csv; resumes and reruns only via -t by name; the suite stays whole, never staged or sampled.'
153+ - 'Phase 2 - adjudicate failed positive rows: rerun each non-PASS row with -t by name adding --compare cross_check --config $WORK_DIR/ttk.conf.yaml, writing result-crosscheck.csv; a case passing under cross_check is adjudicated green; a still-failing case enters precision localization and fix. Skip this phase when phase 1 is all-green.'
154+ - 'Gate with the blackbox-tester skill parse_result.py: python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/regression/result.csv --expect-total <frozen+delta count> exits 0 (pass==total, fail==skip==0); the negative suite python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/regression/result_l2.csv --negative --expect-total <neg count> exits 0 (pass==0, every row rejected).'
155+ - 'Operator-source proof before trusting any result: python3 the blackbox-tester skill''s check_op_binpath.py on the debug log with --optype $OP_PASCAL --expect-dir $WORK_DIR/dev-package/vendors/$OP_PASCAL --require exits 0 — the tested kernel must come from this work_dir own deployment, never a built-in or stale vendor.'
156+ - 'Closing regression for the changed code: re-run the host UT suites (cd $WORK_DIR/op/tests/tiling && ./run.sh, 0 failed) and any existing whitebox branch batches, and re-run the frozen full suite after the last code change — a code touch re-greens the whole frozen suite, not just the delta own cases.'
157+ - 'Oracle-frozen check: sha256sum -c --quiet $WORK_DIR/update/BASELINE.sha256 exits 0 — the frozen baseline copies and golden.py are byte-identical to the verify-baseline baseline; a mismatch means the baseline or the oracle was silently edited to make the delta pass, which is a FAIL, not a pass.'
158+ - 'Fix discipline: reproduce each failure first with -t by name, then route by class (build failure -> ascendc-compile-debug; AIC error, crash, error codes, hang, timeout -> ascendc-runtime-debug; wrong precision -> ascendc-precision-debug; TTK-framework-level failure -> ttk-how-diagnose); fixes stay inside the whitelist ($WORK_DIR/op/op_host/, op_kernel/, op_api/, op_graph/); after any code change rebuild and redeploy before rerunning; never edit golden.py, the tolerances, the frozen baseline or the existing case sets to force green.'
159+ - 'Evidence: $WORK_DIR/update/regression.RECORD.md records suite row counts (frozen + delta), per-case results, the fix history, the commands run, the bin-path proof and the baseline-frozen check.'
160+ acceptance:
161+ - 'Suites built: test -s $WORK_DIR/op/tests/regression/blackbox_all.csv && test -s $WORK_DIR/op/tests/regression/blackbox_l2_neg.csv; the two --expect-total counts equal their suites data-row counts; the positive count equals the frozen full-suite count plus the new delta-case count.'
162+ - 'Positive gate all-green: after adjudication every case in the suite is green — all-green phase 1 is exactly python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/regression/result.csv --expect-total <frozen+delta count> exits 0; otherwise parse_result.py $WORK_DIR/op/tests/regression/result-crosscheck.csv --expect-total <phase-1 non-PASS count> also exits 0 and the union covers the suite.'
163+ - 'Negative gate all-rejected: python3 the blackbox-tester skill''s parse_result.py $WORK_DIR/op/tests/regression/result_l2.csv --negative --expect-total <neg count> exits 0 (pass==0, every row rejected).'
164+ - 'Operator source proven: python3 the blackbox-tester skill''s check_op_binpath.py <debug log> --optype $OP_PASCAL --expect-dir $WORK_DIR/dev-package/vendors/$OP_PASCAL --require exits 0.'
165+ - 'Frozen baseline and oracle untouched: sha256sum -c --quiet $WORK_DIR/update/BASELINE.sha256 exits 0; the frozen subset data-row count in the merged suite equals the baseline count recorded by verify-baseline (no frozen case silently dropped).'
166+ - 'Host UT green when code changed: cd $WORK_DIR/op/tests/tiling && ./run.sh exits 0 with 0 failed; the op_api UT likewise when op_api changed.'
167+ - 'Evidence recorded: test -s $WORK_DIR/update/regression.RECORD.md.'
168+ out_of_scope:
169+ - 'Modification whitelist: $WORK_DIR/op/op_host/, op_kernel/, op_api/, op_graph/ and the test artifacts regenerated under $WORK_DIR/op/tests/; everything else is read-only — $WORK_DIR/update/baseline/ (never modify), $WORK_DIR/golden.py (never modify), the tolerances, the existing case sets, $WORK_DIR/npu-arch.json, $WORK_DIR/ttk.conf.yaml, the delta requirement.'
170+ - 'A case that cannot pass without deviating from the delta requirement stays red with its attribution (requirement/oracle defect); the frozen full suite runs whole, never staged or sampled.'
171+ depends_on:
172+ - update-ut-st
173+ max_retries: 2
174+ on_exhaust: exit
175+ - id: review-docs
176+ task_type: normal
177+ executor: general-executor
178+ verifier: general-verifier
179+ title: Code-review the changed surface (fix within op/) and generate the paired interface docs
180+ goal:
181+ - 'Code-review the delta changed surface and generate the operator docs: run the ascendc-code-review skill over the changed files under $WORK_DIR/op/ (diff-scoped: the delta touched op_host/op_kernel/op_api files), producing the report $WORK_DIR/code-review/CODE_REVIEW.md with its verdict on the first line; close every blocking (FAIL) finding inside $WORK_DIR/op/ and re-run the full-regression gates green; then run the ascendc-docs-gen skill to emit the paired interface docs.'
182+ - 'Completion gate: the report exists with a verdict line, no FAIL finding is left unresolved (each closed in $WORK_DIR/code-review/CODE_REVIEW_FIX.md, or a zero-findings no-op recorded), the paired docs exist non-empty, the delta provenance is recorded, and — when a fix touched $WORK_DIR/op/ — the full-regression gates hold on regenerated results.'
183+ approach:
184+ - 'Load the ascendc-code-review skill first (mandatory) and run its review workflow (rule routing, per-clause review, line verification) with this workflow overlay: the review inputs are the CHANGED files of $WORK_DIR/op/ (op_host/, op_kernel/, op_api/), diff-scoped against $WORK_DIR/update/baseline/sources/ so unchanged code is discounted (out of review scope) but stays in regression scope; the report lands at $WORK_DIR/code-review/CODE_REVIEW.md. Every FAIL / SUSPICIOUS finding keeps a unique F / S id, a full path and a line-verified line number.'
185+ - 'The report first line is a single status — **状态**: ✅通过 when no FAIL finding is listed, **状态**: ❌失败 otherwise.'
186+ - 'Fix loop (this node owns it): confirm each FAIL at its cited location, fix only inside $WORK_DIR/op/ (op_host/, op_kernel/, op_api/, op_graph/), rebuild and redeploy, and re-run the full-regression gates (the TTK aclnn suites and the host UT) until they hold again; record every closure in $WORK_DIR/code-review/CODE_REVIEW_FIX.md. Zero FAIL findings -> record the no-op and change no code. A finding that cannot be fixed without deviating from the delta requirement stays open with its attribution.'
187+ - 'Then load the ascendc-docs-gen skill (mandatory — the single execution authority for doc structure and the paired delivery order) and generate the paired public docs from verifiable facts: the aclnn API interface doc $WORK_DIR/op/docs/aclnn<OpPascal>.md and $WORK_DIR/op/README.md, reflecting the delta (the new supported case/branch and any interface behavior change the requirement declares); expose both under the workflow path with ln -sfn op/docs $WORK_DIR/docs. <OpPascal> is confirmed against the hand-written public header $WORK_DIR/op/op_api/aclnn_<snake>.h, never guessed from directory names.'
188+ - 'Record the delta provenance: $WORK_DIR/code-review/DELTA.md maps each changed file under $WORK_DIR/op/ to the ANALYSIS.md impact row it serves and each deliberate deviation with its reason (the delta-change record aclnn-migrate keeps as MIGRATION.md).'
189+ - 'Do not append to any LOG file and do not reply DONE — logging is the workflow runner job.'
190+ acceptance:
191+ - 'Review report present with a verdict: test -s $WORK_DIR/code-review/CODE_REVIEW.md exits 0 and python3 -c "import sys;l=open(sys.argv[1],encoding=''utf-8'').readline().strip();assert l.startswith(''**状态**:'') and (''✅通过'' in l or ''❌失败'' in l)" $WORK_DIR/code-review/CODE_REVIEW.md exits 0.'
192+ - 'Blocking findings closed: test -s $WORK_DIR/code-review/CODE_REVIEW_FIX.md exits 0 and every FAIL finding id in CODE_REVIEW.md appears in CODE_REVIEW_FIX.md (verifier cross-checks the ids one by one), or the zero-findings no-op is explicitly recorded with no code modified.'
193+ - 'Paired docs present: OP_PASCAL=$(python3 -c "import json;print(json.load(open(''$WORK_DIR/update/target-op.json''))[''pascal''])") ; test -s $WORK_DIR/op/docs/aclnn${OP_PASCAL}.md && test -s $WORK_DIR/op/README.md && test -s $WORK_DIR/docs/aclnn${OP_PASCAL}.md.'
194+ - 'README links the doc it ships with: grep -qF "docs/aclnn${OP_PASCAL}.md" $WORK_DIR/op/README.md.'
195+ - 'Delta provenance recorded: test -s $WORK_DIR/code-review/DELTA.md and every changed file under $WORK_DIR/op/ appears in it (verifier diffs the changed set against $WORK_DIR/update/baseline/sources/).'
196+ - 'Regression holds when code changed: when this task modified any file under $WORK_DIR/op/, the full-regression was re-run green — parse_result.py <positive result.csv> --expect-total <count> exits 0, the negative gate exits 0, check_op_binpath.py --require exits 0, and sha256sum -c --quiet $WORK_DIR/update/BASELINE.sha256 exits 0.'
197+ - 'Frozen assets unchanged: $WORK_DIR/update/baseline/, $WORK_DIR/golden.py, the tolerances, the existing case sets and $WORK_DIR/需求分析.md are unmodified (verifier checks against the pre-task state).'
198+ out_of_scope:
199+ - 'Modify only $WORK_DIR/code-review/, $WORK_DIR/op/docs/, $WORK_DIR/op/README.md, the $WORK_DIR/docs symlink, and (for fixes) $WORK_DIR/op/op_host/, op_kernel/, op_api/, op_graph/ plus the build/dev-package artifacts they regenerate; everything else is read-only.'
200+ - 'Never modify $WORK_DIR/update/baseline/, $WORK_DIR/golden.py, the tolerances, the regression case set or $WORK_DIR/npu-arch.json to make a gate green; a suspected defect is attributed in the report, never patched in the doc place.'
201+ depends_on:
202+ - full-regression
203+ max_retries: 3
204+ on_exhaust: exit
@@ -0,0 +1,136 @@
1+# Prototype-first torch direct-invoke module (side-path, first of two).
2+# For a scenario whose spec is already clear, stand the operator up torch-E2E with
3+# the Ascend C <<<>>> direct-invoke style (the runtime-cloned samples corpus + the direct-invoke
4+# template route): a standalone .asc prototype (kernel + host/main driver) plus a
5+# torch adapter, then run the torch-API blackbox against the frozen golden. Minimal
6+# dependence on solution design; nothing here writes under $WORK_DIR/op/ (that is
7+# the ACLNN migration module's job). Input: a complete requirements-spec run's
8+# frozen artifacts (spec/spec.yaml, golden.py, npu-arch.json, ops-test-kit).
9+# Output: the operator proven torch-E2E against the golden, per-dtype and across
10+# the spec's boundary/extreme case suite. The chain is linear with a single entry
11+# gate; NPU work is serialized by the one device, so only the harness bring-up is
12+# build-heavy. The orchestrator wires the Codex layout ($WORK_DIR/.agents/skills
13+# plus $WORK_DIR/.codex/agents) automatically via link_agent_config.py.
14+workflow: proto-impl
15+max_parallel: 10
16+system_prompt: If needed, dispatch multi subagents to explore code under $WORK_DIR/requirements/references(if exists) relevant to this task, as development reference.
17+nodes:
18+- id: verify-inputs
19+ task_type: normal
20+ executor: general-executor
21+ verifier: general-verifier
22+ title: Module boundary gate - verify the frozen prototype inputs (spec, golden, arch, toolkit)
23+ goal:
24+ - 'Prove the frozen upstream artifacts in $WORK_DIR satisfy the proto-impl module input contract before any prototype work starts: the operator spec exists and parses, the independent golden exists, the target NPU architecture is recorded, and the ops-test-kit tree is present — so every later node works from a known-good input set.'
25+ - 'Completion gate: every input-contract file check passes, spec/spec.yaml parses as YAML carrying the fields the prototype is built from (op.name, math_semantics.formula, dtype_policy.supported_combinations, numerical_tolerance.per_dtype, plus boundary_conditions and extreme_inputs), and the frozen-input digest baseline is written so every later node can prove the frozen inputs were never silently edited.'
26+ approach:
27+ - 'This node verifies, never fixes: the inputs are frozen upstream products (the caller-supplied spec and golden). A failing check is a module-boundary violation, reported as FAILED with the failing check named — do not edit any input to make a check pass.'
28+ - 'Derive the operator name forms from spec.yaml: OP_SNAKE = op.name, OP_PASCAL = PascalCase (used by the harness and the runners).'
29+ - 'Input-contract files: $WORK_DIR/spec/spec.yaml, $WORK_DIR/golden.py, $WORK_DIR/npu-arch.json, and the toolkit tree $WORK_DIR/ops-test-kit/.'
30+ - 'Read $WORK_DIR/npu-arch.json and record the target NPU architecture (arch_info / npu_arch, e.g. 2201 -> dav-2201 or 3510 -> dav-3510): this selects the kernel build arch and the RegBase-vs-MemBase route every later node uses.'
31+ - 'Read spec.yaml and record the operator fact set the prototype consumes: inputs/outputs (name, order, dtypes), attributes, supported dtype combinations, the formula, the per-dtype tolerance, and the boundary/extreme case lists.'
32+ - 'Freeze the input baseline: write $WORK_DIR/.proto-impl/frozen-inputs.sha256 in sha256sum format covering the three frozen input files ($WORK_DIR/spec/spec.yaml, $WORK_DIR/golden.py, $WORK_DIR/npu-arch.json) with ABSOLUTE paths, so every later node can prove the frozen inputs were never silently edited (downstream nodes run sha256sum -c --quiet against it).'
33+ acceptance:
34+ - 'spec exists and parses: test -s $WORK_DIR/spec/spec.yaml && python3 -c "import yaml; yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml''))" exits 0.'
35+ - 'golden exists and parses: test -s $WORK_DIR/golden.py && python3 -c "import ast; ast.parse(open(''$WORK_DIR/golden.py'').read())" exits 0.'
36+ - 'architecture recorded: test -s $WORK_DIR/npu-arch.json && python3 -c "import json; d=json.load(open(''$WORK_DIR/npu-arch.json'')); assert d.get(''arch_info'') or d.get(''npu_arch'')" exits 0.'
37+ - 'toolkit present: test -d $WORK_DIR/ops-test-kit.'
38+ - 'spec carries the prototype fields: python3 -c "import yaml; s=yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml'')); assert s[''op''][''name'']; assert s[''math_semantics''][''formula'']; assert s[''dtype_policy''][''supported_combinations'']; assert s[''numerical_tolerance''][''per_dtype'']; assert ''boundary_conditions'' in s and ''extreme_inputs'' in s" exits 0.'
39+ - 'Operator name and supported-combination count derivable: python3 -c "import yaml; s=yaml.safe_load(open(''$WORK_DIR/spec/spec.yaml'')); print(s[''op''][''name''], len(s[''dtype_policy''][''supported_combinations'']))" exits 0 (the verifier re-derives both from spec.yaml and records them); a missing or unparseable input fails the gate — never reported as pass.'
40+ - 'Frozen-input baseline written and well-formed: test -s $WORK_DIR/.proto-impl/frozen-inputs.sha256 && sha256sum -c --quiet $WORK_DIR/.proto-impl/frozen-inputs.sha256 exits 0.'
41+ out_of_scope:
42+ - 'Verify only: no file under $WORK_DIR/spec/, $WORK_DIR/golden.py, $WORK_DIR/npu-arch.json or $WORK_DIR/ops-test-kit/ is modified; do not create prototype artifacts. The only write this node makes is the baseline $WORK_DIR/.proto-impl/frozen-inputs.sha256.'
43+ - 'Do not run any build, device test, or prototype task in this node; do not fix a failing check — report it.'
44+ depends_on: []
45+ max_retries: 2
46+ on_exhaust: exit
47+- id: gen-torch-harness
48+ task_type: normal
49+ executor: general-executor
50+ verifier: general-verifier
51+ title: Stand up the operator torch direct-invoke prototype harness (build + launch + torch binding green)
52+ goal:
53+ - 'Create the operator standalone Ascend C direct-invoke torch prototype at $WORK_DIR/prototype/ from the ascendc-direct-invoke-template skill references/add_custom/ route — the <<<>>> direct-invoke recipe (a pure-kernel .asc, a host+main driver .asc doing ACL init / H2D / direct kernel launch / sync / D2H, a torch adapter .cpp with TORCH_LIBRARY registration, a dual-target standalone CMakeLists.txt, run.sh and scripts/) — renamed to the operator, plus ONE generic python entry $WORK_DIR/prototype/run_case.py exposing run_case(shapes, dtypes, attrs) -> output torch tensors. The operator ABI (input/output count and order, dtypes, attrs) is read from $WORK_DIR/spec/spec.yaml.'
54+ - 'Completion gate: the harness toolchain is green end-to-end — the project builds for the architecture recorded in $WORK_DIR/npu-arch.json, the host driver launches the kernel directly and the torch extension loads and returns tensors — proven by the template own sample smoke (bash run.sh exits 0, both the direct and the torch path verify), and run_case.py exists and parses. The operator own compute and its wiring to $WORK_DIR/golden.py is the next task.'
55+ approach:
56+ - 'Load the ascendc-direct-invoke-template skill (the concrete <<<>>> engineering recipe and its [MODIFY] markers); for sample retrieval, shallow-clone the samples corpus at runtime (if $WORK_DIR/cannbot-skills has no .git: git clone --depth 1 https://gitcode.com/cann/cannbot-skills.git $WORK_DIR/cannbot-skills) and consult its ops/samples (the cannbot-knowledge runtime-clone pattern); follow the skill''s references/add_custom/ route — do not inline or re-derive the kernel syntax from memory.'
57+ - 'Enumerate the operator ABI from $WORK_DIR/spec/spec.yaml: inputs and outputs (name, count, order, dtypes) and attributes; these drive the host driver buffers and the torch adapter signature.'
58+ - 'Resolve the template through the loaded ascendc-direct-invoke-template skill: TEMPLATE_DIR is the loaded skill''s own directory; test -f $TEMPLATE_DIR/SKILL.md && test -d $TEMPLATE_DIR/references/add_custom.'
59+ - 'Copy the route: cp -a $TEMPLATE_DIR/references/add_custom/. $WORK_DIR/prototype/, then global-replace add_custom->OP_SNAKE and AddCustom->OP_PASCAL across file names and contents (the suffix _kernel/_torch/_tiling is fixed). Keep run.sh own OP_NAME and the CMake target/executable names in sync with the renamed operator — the template ships OP_NAME="add" against an add_custom target, so rename both or the sample smoke cannot locate its binary.'
60+ - 'Set the build arch from $WORK_DIR/npu-arch.json (the template --npu-arch=dav-2201 default; dav-3510 uses the RegBase path the skill documents) — the target SoC comes from npu-arch.json, never guessed.'
61+ - 'Keep the template proven sample compute in place as the toolchain bring-up kernel (its bundled sample golden is the bring-up oracle) and run bash run.sh to prove build + direct launch + torch binding green; save the full output to $WORK_DIR/prototype/harness.log.'
62+ - 'Add $WORK_DIR/prototype/run_case.py: a generic entry that builds the input torch tensors from (shapes, dtypes, attrs), invokes the exported torch.ops entry (the direct-invoke launch) and returns the output tensors — the single interface every later node and the blackbox runner call.'
63+ - 'Read-only on the frozen inputs: never modify $WORK_DIR/spec/spec.yaml, $WORK_DIR/golden.py, or $WORK_DIR/npu-arch.json.'
64+ acceptance:
65+ - 'Project skeleton present: test -d $WORK_DIR/prototype/op_kernel && test -d $WORK_DIR/prototype/op_host && test -d $WORK_DIR/prototype/op_extension && test -f $WORK_DIR/prototype/CMakeLists.txt && test -f $WORK_DIR/prototype/run.sh.'
66+ - 'No sample-name residue: ! grep -RniE "add_custom|AddCustom" $WORK_DIR/prototype --include="*.asc" --include="*.cpp" --include="*.h" --include="*.txt" --include="*.py" --include="*.sh".'
67+ - 'Toolchain smoke green and recorded: cd $WORK_DIR/prototype && bash run.sh > harness.log 2>&1 exits 0 (the sample compute builds, launches through the direct kernel call, and both the direct and the torch path verify), and test -s $WORK_DIR/prototype/harness.log.'
68+ - 'Generic entry present: test -s $WORK_DIR/prototype/run_case.py && python3 -c "import ast; ast.parse(open(''$WORK_DIR/prototype/run_case.py'').read())" exits 0 && grep -qF "def run_case" $WORK_DIR/prototype/run_case.py.'
69+ - 'The torch adapter library was built: find $WORK_DIR/prototype/build -name "*ops*.so" | grep -q .'
70+ - 'Frozen inputs untouched: sha256sum -c --quiet $WORK_DIR/.proto-impl/frozen-inputs.sha256 exits 0 (spec/spec.yaml, golden.py and npu-arch.json are byte-identical to the node-1 baseline).'
71+ out_of_scope:
72+ - 'Create or modify only files under $WORK_DIR/prototype/; do not write anything under $WORK_DIR/op/ (the ACLNN migration module job), and do not modify $WORK_DIR/spec/, $WORK_DIR/golden.py, $WORK_DIR/npu-arch.json, or $WORK_DIR/ops-test-kit/.'
73+ - 'Do not implement the operator compute nor wire the operator golden — the harness is brought up on the template sample kernel only.'
74+ depends_on:
75+ - verify-inputs
76+ max_retries: 2
77+ on_exhaust: exit
78+- id: impl-prototype-kernel
79+ task_type: normal
80+ executor: general-executor
81+ verifier: general-verifier
82+ title: Implement the operator compute in the direct-invoke kernel (per-dtype smoke green vs golden)
83+ goal:
84+ - 'Replace the harness bring-up sample compute with the operator real compute for the operator in $WORK_DIR/spec/spec.yaml: implement the spec math_semantics.formula in the kernel .asc across every dtype combination in dtype_policy.supported_combinations, adapt the host+main driver and the torch adapter to the operator real ABI (inputs/outputs/attrs), and point the harness oracle at the independent $WORK_DIR/golden.py.'
85+ - 'Completion gate: the project builds for the architecture recorded in $WORK_DIR/npu-arch.json and one smoke case per supported dtype combination is precision-green against $WORK_DIR/golden.py through the torch harness (driven by run_case.py), with a per-dtype PASS log.'
86+ approach:
87+ - 'The kernel logic is the spec formula only ($WORK_DIR/spec/spec.yaml math_semantics.formula, reference_oracle, numerical_tolerance) — never re-derived; keep the harness proven launch/data-flow plumbing (TQue / CopyIn-Compute-CopyOut / direct host launch) from the direct-invoke template unchanged except where the operator ABI requires.'
88+ - 'Implement every dtype combination in dtype_policy.supported_combinations; low-precision inputs follow the spec numerical_stability techniques (e.g. fp16/bf16 promoted to fp32 for the transcendental then rounded back) — the golden float64 accumulation rule applies to the golden, not the kernel.'
89+ - 'Adapt the host driver and the torch adapter to the operator ABI from spec.yaml inputs/outputs/attributes; every attribute is carried through to the host so the kernel reads it (an attr is never dropped or renamed).'
90+ - 'Oracle: the harness comparison uses $WORK_DIR/golden.py with the spec numerical_tolerance.per_dtype (rtol/atol/metric) — the golden is the independent oracle and is never modified.'
91+ - 'Smoke driver: write $WORK_DIR/prototype/smoke.py — for each dtype combination in the spec it builds one case, calls run_case.py, compares against golden.py at that dtype tolerance, prints one line per combination (PASS <dtype-combo> / FAIL <dtype-combo>) and exits 0 only when every combination is PASS.'
92+ - 'Fix-until-green mandate: iterate until every supported combination is green; the fix whitelist is $WORK_DIR/prototype/ only — never edit $WORK_DIR/spec/, $WORK_DIR/golden.py, or any frozen input. Consult the samples skill and the ascendc-precision-debug skill when a dtype misses tolerance; record the run in $WORK_DIR/prototype/kernel.log.'
93+ acceptance:
94+ - 'Builds for the recorded arch: cd $WORK_DIR/prototype && cmake -S . -B build && cmake --build build -j exits 0 (the direct-invoke project still compiles for the npu-arch.json target).'
95+ - 'Smoke driver present: test -s $WORK_DIR/prototype/smoke.py && python3 -c "import ast; ast.parse(open(''$WORK_DIR/prototype/smoke.py'').read())" exits 0.'
96+ - 'Per-dtype smoke green: cd $WORK_DIR/prototype && python3 smoke.py > kernel.log 2>&1 exits 0, and test -s kernel.log with ! grep -qE "^(FAIL|FAILED)" kernel.log and the PASS line count equal to the supported_combinations count of spec.yaml (checked by python3 over kernel.log and spec.yaml).'
97+ - 'Supported combinations covered: the dtype set printed in kernel.log equals the dtype set of spec.yaml dtype_policy.supported_combinations (the verifier re-derives the set from spec.yaml and re-greps the log).'
98+ - 'No frozen-input mutation: sha256sum -c --quiet $WORK_DIR/.proto-impl/frozen-inputs.sha256 exits 0 (spec/spec.yaml, golden.py and npu-arch.json are used as-is).'
99+ out_of_scope:
100+ - 'Modify only files under $WORK_DIR/prototype/; do not modify $WORK_DIR/spec/, $WORK_DIR/golden.py, $WORK_DIR/npu-arch.json, $WORK_DIR/ops-test-kit/, or anything under $WORK_DIR/op/.'
101+ - 'Do not change the operator spec semantics or the golden to make a case pass; a dtype that cannot meet tolerance without deviating from the spec stays red with its attribution (a spec/oracle defect).'
102+ depends_on:
103+ - gen-torch-harness
104+ max_retries: 2
105+ on_exhaust: exit
106+- id: blackbox-torch
107+ task_type: normal
108+ executor: general-executor
109+ verifier: general-verifier
110+ title: Full torch blackbox case suite - every in-fence case green vs golden (hard gate)
111+ goal:
112+ - 'Generate the operator blackbox torch case suite from $WORK_DIR/spec/spec.yaml boundary_conditions and extreme_inputs (across dtype_policy.supported_combinations) and run EVERY in-fence case through the torch harness against $WORK_DIR/golden.py at the spec per-dtype tolerance — all green (a hard gate).'
113+ - 'Completion gate: $WORK_DIR/prototype/cases.csv is a risk-ordered case set (shape x dtype x attrs) with the case-size fence at 2**22 elements applied and every excluded case recorded, and every in-fence case is green (or correctly rejected/empty per its spec machine_check) in $WORK_DIR/prototype/results.csv with 0 FAIL.'
114+ approach:
115+ - 'Case set from the spec: one case per boundary_conditions row and per extreme_inputs row (across the supported dtype combinations where the row fixes a dtype), plus a small positive core of representative shapes from shape_constraints; each case records its shape(s), dtype(s), attrs and the expected behavior (matches_oracle / returns_empty / raises_error / nan_propagates / equals) read from the spec machine_check.'
116+ - 'Risk ordering: order cases so the spec precision-critical and special-value rows (NaN / inf / all-zero / overflow) lead, followed by the boundary and the positive-core rows — the earliest rows are the highest-risk semantics.'
117+ - 'Case-size fence (fixed workflow contract, never widened to hide a failing case): a case is in-fence iff its total input elements (per input the product of its shape dims, summed over inputs) are <= 2**22 (4,194,304); derive the in-fence set with a recorded python pre-pass over cases.csv and list every excluded case (name -> shape -> total elements) in $WORK_DIR/prototype/blackbox.RECORD.md. If the fence would exclude the only case for a spec row, regenerate a smaller case for that row (same dtype/rank/value pattern) — coverage is never silently lost.'
118+ - 'Execution mechanism: TTK kernel mode does NOT fit the torch-adapter path (it compiles its own kernel rather than driving the direct-invoke torch extension), so use the plain runner $WORK_DIR/prototype/run_cases.py: it drives run_case.py per in-fence case and compares against $WORK_DIR/golden.py at the spec numerical_tolerance.per_dtype rtol/atol, writing one results row per case (name, shape, dtype, attrs, status PASS/FAIL/REJECTED/EMPTY).'
119+ - 'Semantics: a matches_oracle case must be precision-PASS; a returns_empty case must yield an empty output; a raises_error case must be REJECTED with the spec error_type; a nan_propagates case must yield NaN at the injected positions. A positive case that is not green enters precision fix (prototype/ only); a negative row that passes is a defect.'
120+ - 'Gate script: write $WORK_DIR/prototype/check_results.py — it asserts results.csv covers exactly the in-fence set of cases.csv and holds 0 FAIL, and exits 0 only then.'
121+ - 'Evidence: $WORK_DIR/prototype/results.csv and $WORK_DIR/prototype/blackbox.RECORD.md record the in-fence set, the fence-excluded rows with sizes, the per-case results, and the commands run; the gate numbers come from one clean full rerun after the last kernel change.'
122+ acceptance:
123+ - 'Case set exists: test -s $WORK_DIR/prototype/cases.csv and its data rows enumerate the spec boundary_conditions and extreme_inputs rows (the verifier counts them against spec.yaml).'
124+ - 'Runner and results exist: test -s $WORK_DIR/prototype/run_cases.py && test -s $WORK_DIR/prototype/results.csv.'
125+ - 'Gate green: python3 $WORK_DIR/prototype/check_results.py exits 0 — results.csv covers exactly the in-fence set of cases.csv and holds 0 FAIL (matches_oracle rows PASS, raises_error rows REJECTED, returns_empty rows EMPTY, nan_propagates rows observe NaN).'
126+ - 'Fence applied and recorded: $WORK_DIR/prototype/blackbox.RECORD.md lists every excluded case (name -> shape -> total elements) and the counts (in-fence + excluded = full case count); no excluded case is silently dropped.'
127+ - 'Coverage of the spec rows: every boundary_conditions and extreme_inputs row of spec.yaml is represented by at least one in-fence case (or has a recorded smaller-case regeneration); the verifier re-derives the row count from spec.yaml and re-greps cases.csv.'
128+ - 'No frozen-input mutation: sha256sum -c --quiet $WORK_DIR/.proto-impl/frozen-inputs.sha256 exits 0.'
129+ out_of_scope:
130+ - 'Create or modify only files under $WORK_DIR/prototype/; do not modify $WORK_DIR/spec/, $WORK_DIR/golden.py, $WORK_DIR/npu-arch.json, $WORK_DIR/ops-test-kit/, or anything under $WORK_DIR/op/.'
131+ - 'Do not shrink the case set, widen the fence, or relax the tolerance to make a failing case disappear; a case that stays red after prototype-side fixes is reported with its attribution (a spec/oracle defect).'
132+ - 'No performance work here; this task only proves the operator torch-E2E correctness.'
133+ depends_on:
134+ - impl-prototype-kernel
135+ max_retries: 2
136+ on_exhaust: exit
@@ -0,0 +1,72 @@
1+# Minimal requirements-spec workflow driving the shared workflow-orchestrator skill.
2+# The orchestrator wires the Codex layout ($WORK_DIR/.agents/skills plus
3+# $WORK_DIR/.codex/agents) automatically via link_agent_config.py.
4+workflow: requirements-spec
5+max_parallel: 10
6+system_prompt: If needed, dispatch multi subagents to explore code under $WORK_DIR/requirements/references(if exists) relevant to this task, as development reference.
7+nodes:
8+ - id: analyze-requirements
9+ task_type: normal
10+ executor: general-executor
11+ verifier: general-verifier
12+ title: Generate the requirements analysis document REQUIREMENTS.md
13+ goal:
14+ - "Produce $WORK_DIR/requirements/REQUIREMENTS.md for the operator described in $USER_PROMPT, covering its functional scope, inputs/outputs, and constraints, along with the research intermediates under $WORK_DIR/requirements/research/."
15+ - "The CANN-side research anchors on the existing (A2/A3-era) implementation and produces three artifacts under $WORK_DIR/requirements/research/cann/: code_walkthrough.md (call-chain walkthrough), code_design.md (deliverable coverage + analysis), and formula.md (formula extracted from the existing kernel's Compute method — the semantic anchor of the operator's math, reference evidence for downstream design/golden tasks)."
16+ approach:
17+ - "First read the customer requirement from the file named by $USER_PROMPT (the user prompt); extract the operator name and any specified runtime environment, invocation, network, dtype, or shape requirements."
18+ - "Load the ops-requirement-analysis skill first (mandatory) and follow its pipeline: stage 1 name resolution, stage 2 three-way research (model / competitor / CANN) with decision priority — math semantics and formula follow the competitor implementation (the primary semantic baseline and reference-oracle source); signatures, dtypes and deliverable facts follow the official IR when it hits (built-in or generation-gap operators — the only truth source against same-name ambiguity), and follow the competitor interface as the design baseline when IR misses (brand-new operators: aclnn mirrors PyTorch, GEIR mirrors TensorFlow, with the basis recorded); stage 3 requirement summary per its references/output_template.md."
19+ - "Load the cannbot-knowledge knowledge base at $WORK_DIR/cannbot-knowledge and query it for this operator and its key CANN/Ascend C APIs; reuse $WORK_DIR/cannbot-knowledge/artifacts/preflight.md when present, cite source card paths in the requirement research, and record no-hit topics explicitly."
20+ - "Treat $WORK_DIR/requirements/references/ (cann/, ascend/, competitor/ subdirectories) as the skill's reference/ tree for empirical source search."
21+ - "Consult the local built-in proto at $ASCEND_OPP_PATH/built-in/op_proto/inc/ as the highest-authority CANN fact source."
22+ - "Use the chip platform recorded in $WORK_DIR/npu-arch.json as the runtime-environment evidence."
23+ - "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."
24+ acceptance:
25+ - "$WORK_DIR/requirements/REQUIREMENTS.md exists and is non-empty."
26+ - "The document has the fixed section structure (## 1 需求背景 through ## 8 需求分析总结) with all sections filled."
27+ - "Supported data types, chip platform / runtime environment, and the operator formula are all traceable in the document."
28+ - "No bare COPY: directives remain; table of contents entries match the body headings."
29+ - "The §7.4 performance requirement section lists at least 4 concrete key shapes, states the source route (A / B / both not applicable), and fills in no target values."
30+ - "$WORK_DIR/requirements/research/cann/ contains code_walkthrough.md, code_design.md and formula.md; when no kernel source was found, formula.md carries an explicit 'Kernel code missing' note instead of invented line-level evidence."
31+ - "Brand-new operator (no CANN implementation at any level: ops-* / canndev / built-in proto all missed): code_design.md marks every deliverable ❌ and states 'CANN has no existing implementation; A5 is greenfield development'; formula.md then derives from competitor/paper formulas with sources noted."
32+ - "Each located competitor framework produces research/opensource/{framework}/code_walkthrough.md, code_design.md and formula.md; competitor formula.md carries source file:line references, and code_design.md states the op's forward/backward identity."
33+ - "model_research.md marks graded sources (arxiv / github / huggingface) on its reference links."
34+ - "§8.1 deliverables derive from the §7.3 invocation method per the mapping table (union for combined invocations), no fixed all-yes list; for a generation-gap (代际补齐) scenario, §8.2 declares the capability union is not narrowed plus the new-kernel subset + IsAiCoreSupport dispatch/fallback."
35+ - "formula.md is extracted from the existing kernel's Compute method (not via TensorFlow mapping); kernel dtype branches are listed separately, and every magic-number constant carries a source file:line reference."
36+ - "Variant full coverage: every tiling/kernel variant in the overview tables has its own detailed subsection (compute flow + buffer allocation + tiling strategy); no 'same as template 1' skips."
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."
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+ out_of_scope:
40+ - "Do not write spec.yaml, DESIGN.md, or any implementation code; this task only produces the requirements document and its research intermediates."
41+ depends_on: []
42+ max_retries: 1
43+ on_exhaust: exit
44+ - id: generate-spec
45+ task_type: normal
46+ executor: general-executor
47+ verifier: general-verifier
48+ title: Generate the operator spec file spec.yaml
49+ goal:
50+ - "Produce $WORK_DIR/spec/spec.yaml for the operator described in $WORK_DIR/requirements/REQUIREMENTS.md: a machine-checkable structured operator spec translated from and consistent with it, with no omission and no invented addition (every field traceable to REQUIREMENTS.md)."
51+ - "Use $WORK_DIR/spec/ as this task's working directory; the spec artifact is written there."
52+ approach:
53+ - "Load the ops-spec-gen skill first (mandatory); decide category and paradigms from its registries (category_enum.yaml, paradigm_enum.yaml, category_paradigm_map.yaml), never by intuition."
54+ - "Confirm $WORK_DIR/requirements/REQUIREMENTS.md exists; extract operator category/paradigms, input tensors + dtypes, output dtype/shape rules, math formula, reference oracle, numerical tolerance, boundary cases, target chips (runtime environment section), and non-tensor attributes."
55+ - "Generate the skeleton with the generator (never hand-write spec.yaml): python3 the ops-spec-gen skill's scripts/generate_spec.py --op-name <op-from-REQUIREMENTS> --category <Category> --paradigms <P1,P2> --inputs \"n1:dt1,dt2;n2:...\" --outputs <out> --description \"...\" --output-dir $WORK_DIR/spec"
56+ - "Select the conditional generator options per the skill's rule table: for Reduction categories choose --axis-source (fixed / implicit_all / input_tensor) by the operator's interface; add --paradigm-groups combination when the operator has mode-switch attributes; add --format-variants when computation differs by data layout."
57+ - "Hand-fill the required TODO fields per the skill: math_semantics.formula, reference_oracle.api, dtype_policy.supported_combinations, numerical_tolerance.per_dtype, op.platform_constraints.supported_chips, outputs[].shape_rule/dtype_rule, and determinism (accumulation_order / bitwise_reproducible); for VariableOutput/DynamicShape operators declare outputs[].shape_rule_kind: data_dependent with shape_rule_description + shape_bounds.max_elements instead of a shape_rule expression; review boundary_conditions / extreme_inputs / format_variants as needed. The formula form must match the 'core formula' row in REQUIREMENTS section 6 step by step."
58+ - "Pin the io table to the official truth (dtype-and-naming fence): build dtype_policy.supported_combinations and the input/output NAMES from the authoritative IR the requirement research identified — the built-in proto at $ASCEND_OPP_PATH/built-in/op_proto/inc/ when the operator exists there, else the competitor IR the REQUIREMENTS names as its semantic baseline — never from an aclnn capability list (§8.2.1-style union tables list what the API layer COULD carry, not what this operator commits to). The spec's per-input dtype set must equal the IR's per-input dtype set; every dtype the IR lists appears in the spec, every dtype the spec lists appears in the IR. When a genuinely wider set is a deliberate decision, keep it OUT of supported_combinations and record it as a separate expansion note in REQUIREMENTS instead — supported_combinations stays IR-pinned. Input/output tensor names likewise copy the IR names verbatim (a proto input named 'input' is 'input' in the spec, not 'x')."
59+ - "Run python3 the ops-spec-gen skill's scripts/validate_spec.py $WORK_DIR/spec/spec.yaml; fix and rerun on any FAIL until overall: PASS (exit 0); a stage SKIP (e.g. stage 9 without torch, stage 10 with unreachable oracle) counts as pass."
60+ - "Self-verify: stop and report if any spec-owned field conflicts with REQUIREMENTS rather than choosing silently."
61+ acceptance:
62+ - "$WORK_DIR/spec/spec.yaml exists, is non-empty, and parses as YAML: python3 -c \"import yaml; yaml.safe_load(open('$WORK_DIR/spec/spec.yaml'))\" exits 0."
63+ - "11-stage validation passes: python3 the ops-spec-gen skill's scripts/validate_spec.py $WORK_DIR/spec/spec.yaml ends with overall: PASS (exit 0)."
64+ - "No TODO or placeholder residue: ! grep -qiE 'TODO|<[A-Z_]+>' $WORK_DIR/spec/spec.yaml."
65+ - "dtype-and-naming fence holds: the io table is pinned to the IR the requirement research identified — for each input/output the spec's name equals the IR name and its dtype set equals the IR dtype set (equal, not superset); any deliberate expansion lives in REQUIREMENTS as a note, never in supported_combinations. The verifier re-derives the IR dtype set from the research intermediates (proto headers or the competitor source the REQUIREMENTS cites) and checks set equality per tensor; a mismatch is a fail, not a ⚠."
66+ - "spec-verifier reviews per agents/spec-verifier.md (11-stage + SPEC-* clauses) and cross-checks every spec-owned field against $WORK_DIR/requirements/REQUIREMENTS.md item by item: no omission, no invented addition; all clauses must be ✓ or ⚠ (no ❌) — machine-checkable clauses pass, ⚠ hints do not block."
67+ out_of_scope:
68+ - "Produce only $WORK_DIR/spec/spec.yaml: do not create or modify any other file — including $WORK_DIR/requirements/REQUIREMENTS.md, LOG.md/LOG.json (logging is handled by the workflow runner), or any implementation code."
69+ depends_on:
70+ - analyze-requirements
71+ max_retries: 1
72+ on_exhaust: exit