资讯动态

Copilot Instructions for ONNX Runtime

发布时间:2026/9/13 19:46:46 来源:尧图企业网站定制
Copilot Instructions for ONNX Runtime【免费下载链接】onnxruntimeONNX Runtime: cross-platform, high performance ML inferencing and training accelerator项目地址: https://gitcode.com/GitHub_Trending/on/onnxruntimeRead and follow AGENTS.md for repository-wide guidance, including codebase conventions, architecture, and coding standards.这正是文档所要求的**保持 .github/copilot-instructions.md 最小化**它只负责把 GitHub Copilot 路由到 AGENTS.md 中的权威指导而**不**承载其他 Agent 无法发现的内容。原因很直接AGENTS.md 是通用规范如 [AGENTS.md](https://link.gitcode.com/i/d1958ad6531d2f4b295531cb7c21190f) 中 AGENTS 协议约定而 copilot-instructions.md 是 Copilot 专属入口若把知识写进专属文件本地 Agent 就无法发现等于制造了第二份会漂移的知识副本。 ## 三、添加路径级指令.github/instructions/ 的完整写法 路径级指令是这套体系中最精细的一层用于把「某子系统的不变量invariant」绑定到具体文件路径上。 ### 3.1 YAML frontmatter 结构 创建文件时需放在 .github/instructions/ 下文件名要有描述性以 *.instructions.md 结尾。文件头必须包含 YAML frontmatter提供有意义的 description 与 applyTo 字符串多个路径模式用**逗号分隔**。文档给出的标准模板 markdown --- description: Guidance for Example subsystem changes. applyTo: onnxruntime/core/example/**/*.cc,onnxruntime/core/example/**/*.h --- # Example Subsystem State the invariant, why it matters when that is not obvious, and what a correct change must update.3.2 仓库中的真实范例C API 指令仓库里已有现成的最佳实践样本 —— .github/instructions/c-api.instructions.md。其 frontmatter 如下--- description: C API implementation and review guidance for public C API updates. applyTo: include/onnxruntime/core/session/onnxruntime_c_api.h,include/onnxruntime/core/session/onnxruntime_ep_c_api.h ---注意它没有使用宽泛的applyTo: **而是精确限定到两个公开 C API 头文件正符合文档「使用能可靠识别相关改动的最窄路径」的要求。其正文沉淀了几条高价值不变量ABI 兼容性不得删除、重排或修改已发布 C API 结构体中的函数指针签名新增函数必须追加到OrtApi、OrtModelEditorApi、OrtCompileApi、OrtInteropApi见 include/onnxruntime/core/session/onnxruntime_c_api.h以及OrtEpApi见 include/onnxruntime/core/session/onnxruntime_ep_c_api.h的末尾并同步更新对应 initializer 表Doxygen 文档每个新 C API 成员必须完整注释行为、参数、返回值与所有权/生命周期要求并带\since Version X.Y.标签版本号纪律新增 API 时不要擅自 bumpORT_API_VERSION那是发布准备阶段的工作详见 docs/Versioning.mdC 包装层按需为每个新 C API 添加 C 包装声明在 include/onnxruntime/core/session/onnxruntime_cxx_api.h实现在 include/onnxruntime/core/session/onnxruntime_cxx_inline.h。这个例子完整演示了文档强调的「可操作的actionable不变量」每条都指向一个具体失败模式ABI 破坏、文档缺失、版本号误改和要求的修正动作而不是泛泛的「请小心」。四、作用域applyTo选型与匹配语义文档对applyTo给出三条明确规则使用最窄路径applyTo: **应被避免——仓库级指导属于 AGENTS.md路径级指令只负责特定路径实现与评审双向生效除非正文明确限定否则匹配的指令同时适用于实现implementation与评审review。这从 .github/skills/code-review/SKILL.md 中得到印证评审流程第一步就是「读取每个applyTo作用域覆盖到变更路径的.github/instructions/**/*.instructions.md文件」模式匹配语法多个模式用逗号分隔支持 glob如onnxruntime/core/example/**/*.cc。从代码结构看applyTo的 glob 语义与仓库中的路径约定保持一致C 源文件按子系统组织在onnxruntime/core/{graph,optimizer,framework,session,providers}下因此路径级指令通常精确到具体子系统目录甚至具体文件。五、Agent Skills深层工作流与知识的容器当知识不再只是「一条不变量」而是一整套可重复执行的流程如升级依赖、跑测试、排查 CI时应沉淀为 Skill放在 .github/skills/ 下每个 Skill 一个目录内含SKILL.md。仓库现有多达十余个 Skill覆盖典型维护场景Skill解决的问题.github/skills/code-review/SKILL.md评审 PR/分支/补丁的三步工作流确立评审范围 → 分析变更行为 → 输出可执行 findings.github/skills/ort-test/SKILL.mdCgtest与 Pythonunittest/pytest测试的定位与运行并给出「假绿false-green」五类陷阱.github/skills/ort-lint/SKILL.md用 lintrunner 完成 Cclang-format与 Pythonruff的格式化与静态检查.github/skills/ort-ci/SKILL.md触发/重跑/解堵 GitHub Actions 与 Azure Pipelines 检查含故障分类表.github/skills/onnx-opset-bump-checklist/SKILL.mdONNX 依赖/opset 升级的完整可重复流程文件分类、哈希校验、patch 重基、验证关卡5.1 Skill 的 YAML frontmatterSkill 同样使用 YAML frontmatter字段为name与description注意与路径级指令的descriptionapplyTo不同。以 .github/skills/code-review/SKILL.md 为例--- name: code-review description: Review ONNX Runtime pull requests, branches, commits, patches, and working-tree changes for actionable findings and missing tests. ---【免费下载链接】onnxruntimeONNX Runtime: cross-platform, high performance ML inferencing and training accelerator项目地址: https://gitcode.com/GitHub_Trending/on/onnxruntime创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价