
【免费下载链接】cannbot-skillsCANNBot 是面向 CANN 开发的用于提升开发效率的系列智能体本仓库为其提供可复用的 Skills 模块。项目地址: https://gitcode.com/cann/cannbot-skillsThe user-facing skill entrypoint isskill/SKILL.md; the reusable workflow lives underagent/.Before reading archived runtime/docs or examples, runbash agent/scripts/init.shto restoreeasyasc/,doc/,doc_cn/, andagent/example/.Start every conversation by readingagent/ROUTER.mdfirstFollow the router-first reading order:readskill/SKILL.mdreadagent/ROUTER.mdread only one matching playbook for the current task when possibleread only the focused constraint, pattern, example, or map file that the playbook/router points toread source files only after the smaller guidance layers stop being enoughDo not start by loading giant summaries when a smaller route already answers the taskHigh-level owner files:agent/references/repo-map.md: top-level repository layout and ownership mapagent/references/code-paths.md: implementation-path lookup for operations and behaviorsdoc/11_architecture_for_contributors.md: contributor-level architecture and subsystem ownership fallback (restored on demand)agent/scripts/tools_summary.md: tool fallback; preferagent/references/examples/tool-catalog.mdandagent/playbooks/tool-authoring.mdfirstFor kernel authoring tasks:firstdoagent/playbooks/clarify-first.mdto settle the Contract Template before any code — this is a hard prerequisite, not an optional stepthen startagent/playbooks/kernel-authoring.mdpreferagent/scripts/select_kernel_example.py,agent/scripts/gen_kernel_skeleton.py, andagent/scripts/estimate_matmul_datamove.pybefore opening large prose filesthen read only the specific constraint or pattern file you needif you still need prose example notes, useagent/references/examples/kernel-index.mdbeforeagent/references/examples/kernel-catalog.mdFor kernel debugging tasks:start withagent/playbooks/kernel-debugging.mdthen read only the matching constraint file for the suspected failure modeFor tool changes:start withagent/playbooks/tool-authoring.mduseagent/references/examples/tool-catalog.mdbefore opening tool codeFor documentation changes:start withagent/playbooks/doc-authoring.mdthen useREADME.md,README_CN.md,agent/references/repo-map.md, anddoc/11_architecture_for_contributors.mdas neededFor repo-structure questions:start withagent/references/repo-map.mdthen useagent/references/code-paths.mdif the question is really about implementation locationthen usedoc/11_architecture_for_contributors.mdonly when the smaller maps are not enoughRepository working rulesBefore guessing, inspect the real implementation path for the target behavior inside this repository.check the relevant files undereasyasc/stub_functions/then parser lowering undereasyasc/parser/then simulator behavior undereasyasc/simulator/when execution semantics matterExisting kernels are for study, not copy-paste. Use them to understand repository semantics, constraints, and synchronization patterns.Unless the user explicitly requests otherwise or the task is already tied to an existing kernel file, implement a new kernel in a new file by default.In this repository, kernel means a function decorated withkernel. User-visible inputs and outputs must map strictly to theGMTensorarguments and returnedGMTensorobjects of thatkernelfunction.Build kernels incrementally: reason about tile strategy first, then implement and validate stage by stage instead of trying to finish the whole kernel in one jump.Justify each operation, cast, buffer, synchronization edge, and datamove from the target formula and hardware behavior. Do not keep a step only because another kernel happened to use it.Before golden inputs enter the kernel, only shape-only transforms are allowed, such assqueeze,unsqueeze, andreshape. Do not useexpand,tile,permute, or other layout-changing transforms unless the user explicitly wants that behavior.If any part of the reasoning is ambiguous or cannot be justified from repository evidence, stop and ask instead of guessing. For kernel authoring specifically, the Contract Template inagent/playbooks/clarify-first.mdmust be fully settled before you begin Step 1 ofagent/playbooks/kernel-authoring.md; do not substitute reasonable assumptions for questions on fields the playbook marks ASK.Treat warnings as signals that the mental model is incomplete. Investigate the root cause instead of accepting a passing result with unresolved warnings.Forauto_syncwarnings specifically, understand the synchronization model first, then either adjust the kernel or propose a concrete parser/autosync change.Update owner docs, not giant summariesWhen stable repository knowledge changes, refresh the owner files that actually describe that area:repository structure or subsystem ownership -agent/references/repo-map.mdand/ordoc/11_architecture_for_contributors.mdimplementation-path lookup -agent/references/code-paths.mdkernel additions or meaningful kernel changes -agent/references/examples/kernel-catalog.mdtool additions or tool behavior changes -agent/scripts/tools_summary.mddemo boundaries -agent/example/demo/README.mddocumentation entry maps -README.md,README_CN.md, and the affecteddoc/ordoc_cn/pagesIf atorch210npuconda environment is available it is a convenient example environment; otherwise use the default environment with the required dependencies.Typehints should be compatible with python3.8.All codes, error messages, and readme files should be written in English.Refer to theagent/example/kernelsfolder for templates.Environment setupThe simulator-only path (OpExec(..., simulatorTrue)) needs only a working Python PyTorch environment. The non-simulator path (OpExec(..., simulatorFalse),cannsimsmoke runs, and real on-device validation) additionally needs a Linux host and a local CANN install.Python / conda environmentCreate (or reuse) a Python environment. A conda env namedtorch210npuis the conventional example; any environment with the listed dependencies works.# example only — adjust to your local setup conda create -n torch210npu python3.10 -y conda activate torch210npuInstall the Python dependencies listed inrequirements.txt:pip install -r requirements.txtCurrentrequirements.txtcontents:numpy,torch,torch-npu,einops,prettytable,rich,sympy,setuptools,decorator,scipy,attrs,psutil. Keeptorch/torch-npualigned with your local CANN version. CANN itself is not a pip package and must be installed separately (see below).Typehints in this repository must stay compatible with Python 3.8.CANN install (Linux only)cannsimand real on-device validation require a Linux host plus a local CANN toolkit install. macOS / Windows arenotsupported for the non-simulator path.Download the CANN package matching your target architecture from:https://ascend.devcloud.huaweicloud.com/artifactory/cann-run-mirror/software/master/20260415000324328/Install the toolkit following the official CANN install guide, then export the install root so generatedb.sh/r.shscripts and restored helpers can find it:export ASCEND_HOME_PATHpath-to-your-CANN-install # the directory that contains bin/setenv.bash # optional: prepend a Python-with-NumPy for CANN opbuild # export EASYASC_PYTHON_BINconda-env/bin source ${ASCEND_HOME_PATH}/bin/setenv.bashDo not hardcode workstation-specific paths such as/home/user/...or/usr/local/Ascend/...into the delivered repository. Delivered scripts must stay environment-driven viaASCEND_HOME_PATH/ASCEND_INSTALL_PATH.What runs without CANN vs. what requires itSimulator-only kernel validation (OpExec(..., simulatorTrue)) — works on any OS with PyTorch installed; no CANN needed.OpExec(..., simulatorFalse),cannsimsmoke runs, and real NPU validation —requirea Linux host and a local CANN install withASCEND_HOME_PATHset.Python formattingFor Python code, do not automatically rewrite function signatures or calls into a one-argument-per-line style.Prefer compact formatting.Keep arguments on the same line if the result is still easy to read.Wrap only when necessary for readability or line length.If wrapping is needed, use a compact multi-line layout instead of placing every argument on its own line unless there is a clear readability benefit.Avoid unnecessary trailing commas that encourage vertical expansion.【免费下载链接】cannbot-skillsCANNBot 是面向 CANN 开发的用于提升开发效率的系列智能体本仓库为其提供可复用的 Skills 模块。项目地址: https://gitcode.com/cann/cannbot-skills创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考