CATCCOS昇腾计算-通信融合算子模板库,是一个聚焦于提供高性能计算通信融合类算子基础模板的代码库。
| Files | Last commit | Last update |
|---|---|---|
性能修复与文档描述修正 Co-authored-by: dovahkiiin<haorunzhe@h-partners.com> # message auto-generated for no-merge-commit merge: !37 merge fix/update_shmem_and_doc_fix into master 性能修复与文档描述修正 Created-by: dovahkiiin Commit-by: dovahkiiin Merged-by: cann-robot Description: ## 变更描述 / Description 1. 升级3rdparty下的shmem版本以修复性能 2. 更正了文档中对datacopy的描述 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [x] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes # - References # ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [x] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!37 | 5 months ago | |
性能修复与文档描述修正 Co-authored-by: dovahkiiin<haorunzhe@h-partners.com> # message auto-generated for no-merge-commit merge: !37 merge fix/update_shmem_and_doc_fix into master 性能修复与文档描述修正 Created-by: dovahkiiin Commit-by: dovahkiiin Merged-by: cann-robot Description: ## 变更描述 / Description 1. 升级3rdparty下的shmem版本以修复性能 2. 更正了文档中对datacopy的描述 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [x] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes # - References # ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [x] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!37 | 5 months ago | |
Adapt allgather matmul dequant communication backend | 4 months ago | |
Adapt allgather matmul dequant communication backend | 4 months ago | |
新增pre-commit开源代码检查工具 Co-authored-by: dovahkiiin<haorunzhe@h-partners.com> # message auto-generated for no-merge-commit merge: !25 merge task/add_pre-commit into master 新增pre-commit开源代码检查工具 Created-by: dovahkiiin Commit-by: dovahkiiin Merged-by: cann-robot Description: ## 变更描述 / Description ## 检查项 ### 1. 通用基础检查 ([pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks)) | Hook | 功能 | |------|------| | trailing-whitespace | 删除行尾空格 | | end-of-file-fixer | 确保文件以空行结尾 | | check-yaml | 验证 YAML 语法 | | check-json | 验证 JSON 语法 | | check-added-large-files | 阻止提交大文件(默认 >500KB)| | check-merge-conflict | 检测合并冲突标记 | | detect-private-key | 检测私钥/敏感信息泄露 | ### 2. Python 代码检查 ([ruff](https://github.com/astral-sh/ruff)) - **ruff lint**: 代码规范检查(规则配置见 pre-commit/pyproject.toml) - 启用 D209(多行文档字符串格式) - 启用 SIM115(推荐 with 语句) - **ruff format**: 自动代码格式化 - **配置**: 使用 pre-commit/pyproject.toml,兼容 Python 3.10+ ### 3. Python 安全扫描 ([bandit](https://github.com/PyCQA/bandit)) - 扫描常见的 Python 安全漏洞(如硬编码密码、不安全的 eval、SQL 注入等) - **配置**: 中危及以上级别,配置见 pre-commit/pyproject.toml ### 4. 拼写检查 ([typos](https://github.com/crate-ci/typos)) - 检测代码和文档中的拼写错误 - **配置**: pre-commit/typos.toml,已添加昇腾生态相关词汇白名单 ### 5. C++ 代码格式化 ([clang-format](https://clang.llvm.org/docs/ClangFormat.html)) - 自动格式化 C/C++ 代码 - **风格**: Google Style,4 空格缩进,120 列限制,Allman 大括号风格 - **匹配文件**: *.c, *.h, *.cpp, *.hpp, *.cc, *.hh, *.cxx, *.hxx ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [x] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #123 可自动关闭 / Closes #123 to auto-close --> - Closes # - References # ## 测试信息 / Testing 功能测试   - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [ ] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!25 | 6 months ago | |
feat: 增加allgather_matmul算子用customClass接入pytorch的示例和对应的skil。 Co-authored-by: soyabean<sunyanbin8@huawei.com> Co-authored-by: i_soyabean<i_soyabean@noreply.gitcode.com> # message auto-generated for no-merge-commit merge: !16 merge feat/add-agmm-py into master feat: add agmm pytorch support example Created-by: i_soyabean Commit-by: soyabean;i_soyabean Merged-by: cann-robot Description: feat: 增加allgather_matmul算子接入pytorch的示例。 See merge request: cann/catccos!16 | 5 months ago | |
Fix Some Rdma Build Bug Co-authored-by: wuzhangda<wuzhangda@huawei.com> # message auto-generated for no-merge-commit merge: !49 merge rdma_bugfix into master Fix Some Rdma Build Bug Created-by: wuzhangda Commit-by: wuzhangda Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes # - References # ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [x] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!49 | 4 months ago | |
从平台获取 AICore 数并整理公共头文件 Co-authored-by: y00955618<yukainan1@huawei.com> # message auto-generated for no-merge-commit merge: !43 merge get_core_from_platform into master 从平台获取 AICore 数并整理公共头文件 Created-by: WinstonSmith Commit-by: y00955618 Merged-by: cann-robot Description: ## 变更说明 - 将 examples 和 dynamic_tiling 中固定使用的 BLOCK_NUM 改为通过 PlatformAscendCManager::GetCoreNumAic() 获取运行时 AICore 数。 - 调整 dynamic_tiling kernel launcher 参数传递,使 blockNum 从 main 传入具体 kernel 实现。 - 为 dynamic_tiling 链接补充 unified_dlog,解决 libtiling_api.a 引入 CheckLogLevel 时的 DSO missing from command line 问题。 - 将 examples/utils 下公共 .h 头文件移动到根目录 utils/。 - 将 catccos_operator.h 和 operator_registry.h 移动到 utils/,保留 examples/operator_host.h 作为 examples 专用聚合头。 - 更新 examples、torch_binding、tests/dynamic_tiling 的 include 路径。 ## 验证 - git diff --check 通过。 - 代码已推送到 origin/get_core_from_platform。 See merge request: cann/catccos!43 | 5 months ago | |
添加dispacth_gmm_dequant_swiglu算子 Co-authored-by: y00955618<yukainan1@huawei.com> # message auto-generated for no-merge-commit merge: !32 merge dispacth_gmm_dequant_swiglu into master 添加dispacth_gmm_dequant_swiglu算子 Created-by: WinstonSmith Commit-by: y00955618 Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 添加dispacth_gmm_dequant_swiglu算子 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [x] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes # - References # ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [x] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!32 | 5 months ago | |
Add device wrapper Co-authored-by: caixuyi<caixuyi1@huawei.com> # message auto-generated for no-merge-commit merge: !14 merge add_device into master Add device wrapper Created-by: caixuyi Commit-by: caixuyi Merged-by: cann-robot Description: ## 变更描述 / Description ### 背景 当前各 DGemm 示例中直接在 global kernel 内组装 kernel 参数并启动算子,参数构造逻辑分散在不同 example 中,不利于复用,也不方便 dynamic tiling 测试框架统一调度。 ### 修改内容 #### 1. 新增统一 DeviceDGemm 封装 - 新增 include/catccos/dgemm/device/device_dgemm.hpp - 提供统一的 Host 侧接口: - Initialize(args):将用户侧 Arguments 转换为 kernel 执行所需 Params - Run(stream, blockDim, fftsAddr):统一启动 DGemm kernel - 支持 fftsAddr 为 0 或非 0 两种 kernel 启动路径 #### 2. 重构 DGemm kernel 参数接口 - 为多个 DGemm kernel 补充 Arguments 和 ToUnderlyingArguments - 将原先分散在 device wrapper/global kernel 中的 layout、通信参数、scheduler 参数构造逻辑下沉到 kernel 内部 - 将 Params 构造函数调整为 CATLASS_HOST_DEVICE,支持 Host 侧构造参数 涉及算子包括: - allgather matmul - allgather matmul rdma - allgather matmul with gather result - allgather matmul dequant / dequant bias - alltoallv grouped matmul - grouped matmul alltoallv - alltoallv gmm v2 - matmul allreduce - matmul reduce scatter #### 3. 重构 examples 调用方式 - 各 example 的 *_device.h 改为定义 Config 模板和 DeviceDGemm 类型别名 - 各 main.cpp 改为通过: - 构造 DeviceOp::Arguments - deviceOp.Initialize(args) - deviceOp.Run(stream, BLOCK_NUM, fftsAddr) 启动算子 - 移除 example 中重复的 global kernel 参数拼装逻辑 #### 4. 调整 dynamic tiling 测试目录 - 将 examples/dynamic_tiling 移动到 tests/dynamic_tiling - 新增 tests/CMakeLists.txt,并在根 CMakeLists.txt 中添加 add_subdirectory(tests) - 更新 dynamic tiling README,补充测试使用方式和新增算子接入说明 - 更新 examples/run_all_examples.sh 中 dynamic tiling 的路径 #### 5. 其他脚本调整 - dispatch_gmm 和 dispatch_gmm_swiglu 运行脚本中补充 shmem 环境初始化 - run_all_examples.sh 中恢复运行: - alltoallv_grouped_matmul - grouped_matmul_alltoallv ### 验证 - 已完成代码重构和构建脚本路径调整 - dynamic tiling 测试入口已迁移至 tests/dynamic_tiling - 示例调用已统一切换为 DeviceDGemm::Initialize + Run 方式 ### 影响范围 - DGemm kernel 参数构造方式发生变化 - examples 的启动方式发生变化 - dynamic tiling 从 example 示例目录调整为 tests 测试目录 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [x] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #123 可自动关闭 / Closes #123 to auto-close --> - Closes # - References # ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [x] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!14 | 6 months ago | |
编译依赖配置整合 Co-authored-by: dovahkiiin<haorunzhe@h-partners.com> | 6 months ago | |
新增pre-commit开源代码检查工具 Co-authored-by: dovahkiiin<haorunzhe@h-partners.com> # message auto-generated for no-merge-commit merge: !25 merge task/add_pre-commit into master 新增pre-commit开源代码检查工具 Created-by: dovahkiiin Commit-by: dovahkiiin Merged-by: cann-robot Description: ## 变更描述 / Description ## 检查项 ### 1. 通用基础检查 ([pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks)) | Hook | 功能 | |------|------| | trailing-whitespace | 删除行尾空格 | | end-of-file-fixer | 确保文件以空行结尾 | | check-yaml | 验证 YAML 语法 | | check-json | 验证 JSON 语法 | | check-added-large-files | 阻止提交大文件(默认 >500KB)| | check-merge-conflict | 检测合并冲突标记 | | detect-private-key | 检测私钥/敏感信息泄露 | ### 2. Python 代码检查 ([ruff](https://github.com/astral-sh/ruff)) - **ruff lint**: 代码规范检查(规则配置见 pre-commit/pyproject.toml) - 启用 D209(多行文档字符串格式) - 启用 SIM115(推荐 with 语句) - **ruff format**: 自动代码格式化 - **配置**: 使用 pre-commit/pyproject.toml,兼容 Python 3.10+ ### 3. Python 安全扫描 ([bandit](https://github.com/PyCQA/bandit)) - 扫描常见的 Python 安全漏洞(如硬编码密码、不安全的 eval、SQL 注入等) - **配置**: 中危及以上级别,配置见 pre-commit/pyproject.toml ### 4. 拼写检查 ([typos](https://github.com/crate-ci/typos)) - 检测代码和文档中的拼写错误 - **配置**: pre-commit/typos.toml,已添加昇腾生态相关词汇白名单 ### 5. C++ 代码格式化 ([clang-format](https://clang.llvm.org/docs/ClangFormat.html)) - 自动格式化 C/C++ 代码 - **风格**: Google Style,4 空格缩进,120 列限制,Allman 大括号风格 - **匹配文件**: *.c, *.h, *.cpp, *.hpp, *.cc, *.hh, *.cxx, *.hxx ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [x] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #123 可自动关闭 / Closes #123 to auto-close --> - Closes # - References # ## 测试信息 / Testing 功能测试   - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [ ] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!25 | 6 months ago | |
Add device wrapper Co-authored-by: caixuyi<caixuyi1@huawei.com> # message auto-generated for no-merge-commit merge: !14 merge add_device into master Add device wrapper Created-by: caixuyi Commit-by: caixuyi Merged-by: cann-robot Description: ## 变更描述 / Description ### 背景 当前各 DGemm 示例中直接在 global kernel 内组装 kernel 参数并启动算子,参数构造逻辑分散在不同 example 中,不利于复用,也不方便 dynamic tiling 测试框架统一调度。 ### 修改内容 #### 1. 新增统一 DeviceDGemm 封装 - 新增 include/catccos/dgemm/device/device_dgemm.hpp - 提供统一的 Host 侧接口: - Initialize(args):将用户侧 Arguments 转换为 kernel 执行所需 Params - Run(stream, blockDim, fftsAddr):统一启动 DGemm kernel - 支持 fftsAddr 为 0 或非 0 两种 kernel 启动路径 #### 2. 重构 DGemm kernel 参数接口 - 为多个 DGemm kernel 补充 Arguments 和 ToUnderlyingArguments - 将原先分散在 device wrapper/global kernel 中的 layout、通信参数、scheduler 参数构造逻辑下沉到 kernel 内部 - 将 Params 构造函数调整为 CATLASS_HOST_DEVICE,支持 Host 侧构造参数 涉及算子包括: - allgather matmul - allgather matmul rdma - allgather matmul with gather result - allgather matmul dequant / dequant bias - alltoallv grouped matmul - grouped matmul alltoallv - alltoallv gmm v2 - matmul allreduce - matmul reduce scatter #### 3. 重构 examples 调用方式 - 各 example 的 *_device.h 改为定义 Config 模板和 DeviceDGemm 类型别名 - 各 main.cpp 改为通过: - 构造 DeviceOp::Arguments - deviceOp.Initialize(args) - deviceOp.Run(stream, BLOCK_NUM, fftsAddr) 启动算子 - 移除 example 中重复的 global kernel 参数拼装逻辑 #### 4. 调整 dynamic tiling 测试目录 - 将 examples/dynamic_tiling 移动到 tests/dynamic_tiling - 新增 tests/CMakeLists.txt,并在根 CMakeLists.txt 中添加 add_subdirectory(tests) - 更新 dynamic tiling README,补充测试使用方式和新增算子接入说明 - 更新 examples/run_all_examples.sh 中 dynamic tiling 的路径 #### 5. 其他脚本调整 - dispatch_gmm 和 dispatch_gmm_swiglu 运行脚本中补充 shmem 环境初始化 - run_all_examples.sh 中恢复运行: - alltoallv_grouped_matmul - grouped_matmul_alltoallv ### 验证 - 已完成代码重构和构建脚本路径调整 - dynamic tiling 测试入口已迁移至 tests/dynamic_tiling - 示例调用已统一切换为 DeviceDGemm::Initialize + Run 方式 ### 影响范围 - DGemm kernel 参数构造方式发生变化 - examples 的启动方式发生变化 - dynamic tiling 从 example 示例目录调整为 tests 测试目录 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [x] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #123 可自动关闭 / Closes #123 to auto-close --> - Closes # - References # ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [x] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [x] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!14 | 6 months ago | |
补充LICENSE信息 Co-authored-by: dovahkiiin<haorunzhe@h-partners.com> # message auto-generated for no-merge-commit merge: !35 merge task/add_LICENSE into master 补充LICENSE信息 Created-by: dovahkiiin Commit-by: dovahkiiin Merged-by: cann-robot Description: ## 变更描述 / Description 补充LICENSE信息 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [x] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes # - References # ## 测试信息 / Testing 不涉及 - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!35 | 5 months ago | |
新增pre-commit开源代码检查工具 Co-authored-by: dovahkiiin<haorunzhe@h-partners.com> # message auto-generated for no-merge-commit merge: !25 merge task/add_pre-commit into master 新增pre-commit开源代码检查工具 Created-by: dovahkiiin Commit-by: dovahkiiin Merged-by: cann-robot Description: ## 变更描述 / Description ## 检查项 ### 1. 通用基础检查 ([pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks)) | Hook | 功能 | |------|------| | trailing-whitespace | 删除行尾空格 | | end-of-file-fixer | 确保文件以空行结尾 | | check-yaml | 验证 YAML 语法 | | check-json | 验证 JSON 语法 | | check-added-large-files | 阻止提交大文件(默认 >500KB)| | check-merge-conflict | 检测合并冲突标记 | | detect-private-key | 检测私钥/敏感信息泄露 | ### 2. Python 代码检查 ([ruff](https://github.com/astral-sh/ruff)) - **ruff lint**: 代码规范检查(规则配置见 pre-commit/pyproject.toml) - 启用 D209(多行文档字符串格式) - 启用 SIM115(推荐 with 语句) - **ruff format**: 自动代码格式化 - **配置**: 使用 pre-commit/pyproject.toml,兼容 Python 3.10+ ### 3. Python 安全扫描 ([bandit](https://github.com/PyCQA/bandit)) - 扫描常见的 Python 安全漏洞(如硬编码密码、不安全的 eval、SQL 注入等) - **配置**: 中危及以上级别,配置见 pre-commit/pyproject.toml ### 4. 拼写检查 ([typos](https://github.com/crate-ci/typos)) - 检测代码和文档中的拼写错误 - **配置**: pre-commit/typos.toml,已添加昇腾生态相关词汇白名单 ### 5. C++ 代码格式化 ([clang-format](https://clang.llvm.org/docs/ClangFormat.html)) - 自动格式化 C/C++ 代码 - **风格**: Google Style,4 空格缩进,120 列限制,Allman 大括号风格 - **匹配文件**: *.c, *.h, *.cpp, *.hpp, *.cc, *.hh, *.cxx, *.hxx ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [x] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #123 可自动关闭 / Closes #123 to auto-close --> - Closes # - References # ## 测试信息 / Testing 功能测试   - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [ ] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [x] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [ ] 提交信息符合规范 / Commit message follows convention See merge request: cann/catccos!25 | 6 months ago |
CATCCOS
📌 简介
CATCCOS(CANN Templates for Compute-Communication Overlap Subroutines),中文名为昇腾计算-通信融合算子模板库,是一个聚焦于提供高性能计算通信融合类算子基础模板的代码库。
通过抽象分层的方式将计算-通信算子代码模板化。简化通算融合算子开发,解决易用性问题。内存语义实现计算通信细粒度并行,最大化掩盖度;根据计算通信特征,结合硬件架构深度优化,提供极致性能。
本代码仓为CATCCOS代码仓。结合昇腾生态力量,共同设计研发算子模板,并提供典型通算融合算子的高性能实现代码样例。
🧩 模板分层设计

分层详细介绍和各层级api,见api文档。
📁 目录结构说明
catccos
├── 3rdparty # 依赖的catlass工程文件
├── docs # 文档
├── examples # kernel使用样例
└── include # 模板头文件
💻 软硬件配套说明
-
硬件平台:
- CPU:
aarch64/x86_64 - NPU:
Atlas A2 训练系列产品/Atlas 800I A2 推理产品/A200I A2 Box 异构组件Atlas 800T A2 训练服务器Atlas 900 A2 PoD 集群基础单元Atlas 200T A2 Box16 异构子框Atlas 800I A2 推理服务器A200I A2 Box 异构组件
- CPU:
-
软件版本:
gcc >= 7.5, < 13(已测试7.5,8.3,9.3,11.4,建议使用9.3以上版本。)cmake >= 3.15python >= 3.10
-
CANN版本:
| CANN包类别 | 版本要求 | 获取方式 |
|---|---|---|
| 社区版 | 8.5.0.alpha002 及之后版本 | 社区CANN包下载地址 |
| 商用版 | 8.5.0及之后版本 | 请咨询对应Support/SupportE获取 |
- 安装CANN开发套件包:
chmod +x Ascend-cann-toolkit_<version>_linux-<arch>.run
./Ascend-cann-toolkit_<version>_linux-<arch>.run --install
🚀 快速上手
以matmul_allreduce算子样例为例,快速上手CATCCOS算子开发:
- 配置环境变量(可选)
# 用于统一配置CANN、SHMEM、CATLASS相关环境变量
source ./examples/utils/setup.sh
注意:
- 配置环境变量时,若CANN未安装到默认路径,需先配置ASCEND_HOME_PATH环境变量。
- 若使用
examples下的编译脚本,可跳过此步骤。
- 编译算子样例 进入examples下对应的算子目录并执行编译脚本,即可编译examples中的kernel代码。
cd examples/matmul_allreduce
bash scripts/build.sh
- 执行算子样例 进入examples下对应的算子目录并执行运行脚本,执行算子样例程序。
cd examples/matmul_allreduce
bash scripts/run.sh [device_list]
出现如下执行结果,说明算子运行成功,精度比较通过。
error num: 0
PASS
🛠 代码检查说明
代码检查请参考pre-commit-guide.md文档。