ops-gnn是昇腾生态下图神经网络(GNN)算子和特性的集合, 支持PYG和DGL框架。
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
ops-gnn框架搭建 Co-authored-by: vector5<caobingjie@huawei.com> Co-authored-by: goodpeople233<guojiong1@huawei.com> # message auto-generated for no-merge-commit merge: !1 merge master into master ops-gnn框架搭建 Created-by: goodpeople233 Commit-by: goodpeople233;vector5 Merged-by: cann-robot Description: ## 变更描述 / Description 建立ops-gnn基础框架 ## 改动类型 / 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 - [ ] 集成测试通过 / 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/ops-gnn!1 | 27 天前 | |
解决编译warning打屏以及编译运行时出现的错误 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !4 merge warning into master 解决编译warning打屏以及编译运行时出现的错误 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 1.修复了编译时出现的warning 2.修复了编译运行时出现的错误 ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#2](https://gitcode.com/cann/ops-gnn/issues/2) - References [#2](https://gitcode.com/cann/ops-gnn/issues/2) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention ## 修改内容 ### Python 打包警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | License classifiers are deprecated | 2 | classifiers 含 License :: OSI Approved :: MIT License | 删除该 classifier | pyproject.toml、setup.cfg | | project.license as a TOML table is deprecated | 2 | license = {text = "MIT"} TOML 表格式 | 改为 dynamic = ["license"],setup.py 中声明 license='MIT' | pyproject.toml、setup.py | | extras_require overwritten in pyproject.toml | 2 | setup.py 与 pyproject.toml 重复配置 | setup.py 删除 extras_require | setup.py | | setup.py install is deprecated | 1 | build.sh 调用 setup.py bdist_wheel | 改为 python -m pip wheel . --no-deps --no-build-isolation | scripts/build.sh | | wheel bdist_wheel FutureWarning | 2 | 自定义 CustomBDistWheel 类继承 vendored wheel | 删除 CustomBDistWheel 类,统一用 pip wheel | setup.py | | no files found matching '*.cu' | 1 | MANIFEST.in 引用不存在的 *.cu | 删除 *.cu,保留 *.h *.cpp | MANIFEST.in | ### CANN/Kernel 编译警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | kineto_LIBRARY-NOTFOUND CMake Warning | 2 | PyTorch CPU 版不含 CUDA profiling 库 libkineto.a,TorchConfig.cmake 中 find_library 查找不到输出 message(WARNING)。该库仅用于 CUDA 性能分析,NPU 平台不需要 | find_package(Torch) 前将 kineto_LIBRARY cache 变量预置为已存在的 libtorch.so,find_library 发现 cache 已有值则跳过搜索,不再输出 warning。libtorch.so 本就参与最终链接,不会引入新依赖 | CMakeLists.txt | | kernel type is not marked | 8 | segment_max_csr_kernel 未标记 aiv 属性 | kernel 函数添加 __attribute__((aiv)) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel_impl.h | | cce_global attribute ignored [-Wignored-attributes] | 4 | bisheng 编译器对 GM_ADDR 强转报 warning | kernel 启动行用 #pragma GCC diagnostic push/pop 精确抑制(CANN 工具链已知行为,C-style 强转是 kernel 启动的必要写法) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel.cpp | ### build.sh 错误处理改进 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | usage() 固定 exit 0,只显示命令错误,无完整帮助信息 | 改为 exit "${1:-0}" 支持自定义退出码 | scripts/build.sh | | Python 版本检测不传递给 CMake | 添加 Python3_ROOT_DIR 环境变量导出 | scripts/build.sh | | --clean 对 python 目标无效(CMakeCache.txt 缓存旧 Python 版本) | clean_build 移到 main 函数统一调用,删除 build_cpp 里的重复调用 | scripts/build.sh | | pip wheel -w output/whl 可能将 output/whl 创建为文件而非目录 | pip wheel 前加 mkdir -p output/whl | scripts/build.sh | ### CMakeLists.txt 改进 | 改进点 | 说明 | |--------|------| | 添加版权头注释 | 补充 CANN OSL 协议头 | | Python3 查找逻辑优化 | 优先用 Python3_ROOT_DIR 环境变量,避免找到错误版本 | | 抑制 kineto 警告 | find_package(Torch) 前将 kineto_LIBRARY 预置为已存在的 libtorch.so,利用 CMake find_library 在 cache 已有值时跳过搜索的机制消除 warning,libtorch.so 本就参与链接不引入额外依赖 | ### NPU 算子测试修复 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | add_sample 使用 torch::zeros_like 触发 tensor format 警告 | 改为 torch::empty_like(src1.cpu()).to(src1.device()) | csrc/npu/host/add_sample/add_sample.cpp | | test_add_sample_npu 直接创建 NPU tensor 失败 | 改为 CPU 创建后 .npu() 转移 | test/test_example.py | | uint8 张量在 NPU 上计算 expected 失败 | 改为 CPU 上计算后比较 | test/test_example.py | ### 环境要求更新 CANN 9.x + Ascend950 需要 PyTorch 2.7+ 及 v26.0.0 发布线的 torch_npu。 ## 测试验证 - ./scripts/build.sh python 正常构建,无任何警告 - ./scripts/build.sh --clean 清理缓存后构建,CMakeCache.txt 不再缓存旧 Python 版本 - ./scripts/build.sh 123 打印错误+完整帮助,退出码 1 - ./scripts/build.sh --help 显示帮助,退出码 0 - python3 -m pytest test/ -v 全部 13 个测试通过 - 兼容 Python 3.9+(setuptools>=61,CMake 3.15+) - 已在 Python 3.9.25 、Python 3.11.15 、Python3.12.13 验证通过 See merge request: cann/ops-gnn!4 | 20 天前 | |
修改中英文文档 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !11 merge docs into master 修改中英文文档 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 修改中英文文档,确保格式正确 1.代码块指定编程语言 2.表格前空行 3.修改链接 4.修改中文文档文件名和英文文档一致 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#9](https://gitcode.com/cann/ops-gnn/issues/9) - References [#9](https://gitcode.com/cann/ops-gnn/issues/9) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / 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/ops-gnn!11 | 5 天前 | |
添加segment_max_csr算子并优化基础框架 Co-authored-by: goodpeople233<guojiong1@huawei.com> # message auto-generated for no-merge-commit merge: !2 merge master into master 添加segment_max_csr算子并优化基础框架 Created-by: goodpeople233 Commit-by: goodpeople233 Merged-by: cann-robot Description: ## 变更描述 / Description 添加segment_max_csr算子,同时调整了目录划分,优化了编译逻辑。 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [x] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#1](https://gitcode.com/cann/ops-gnn/issues/1) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / 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/ops-gnn!2 | 26 天前 | |
解决编译warning打屏以及编译运行时出现的错误 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !4 merge warning into master 解决编译warning打屏以及编译运行时出现的错误 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 1.修复了编译时出现的warning 2.修复了编译运行时出现的错误 ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#2](https://gitcode.com/cann/ops-gnn/issues/2) - References [#2](https://gitcode.com/cann/ops-gnn/issues/2) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention ## 修改内容 ### Python 打包警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | License classifiers are deprecated | 2 | classifiers 含 License :: OSI Approved :: MIT License | 删除该 classifier | pyproject.toml、setup.cfg | | project.license as a TOML table is deprecated | 2 | license = {text = "MIT"} TOML 表格式 | 改为 dynamic = ["license"],setup.py 中声明 license='MIT' | pyproject.toml、setup.py | | extras_require overwritten in pyproject.toml | 2 | setup.py 与 pyproject.toml 重复配置 | setup.py 删除 extras_require | setup.py | | setup.py install is deprecated | 1 | build.sh 调用 setup.py bdist_wheel | 改为 python -m pip wheel . --no-deps --no-build-isolation | scripts/build.sh | | wheel bdist_wheel FutureWarning | 2 | 自定义 CustomBDistWheel 类继承 vendored wheel | 删除 CustomBDistWheel 类,统一用 pip wheel | setup.py | | no files found matching '*.cu' | 1 | MANIFEST.in 引用不存在的 *.cu | 删除 *.cu,保留 *.h *.cpp | MANIFEST.in | ### CANN/Kernel 编译警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | kineto_LIBRARY-NOTFOUND CMake Warning | 2 | PyTorch CPU 版不含 CUDA profiling 库 libkineto.a,TorchConfig.cmake 中 find_library 查找不到输出 message(WARNING)。该库仅用于 CUDA 性能分析,NPU 平台不需要 | find_package(Torch) 前将 kineto_LIBRARY cache 变量预置为已存在的 libtorch.so,find_library 发现 cache 已有值则跳过搜索,不再输出 warning。libtorch.so 本就参与最终链接,不会引入新依赖 | CMakeLists.txt | | kernel type is not marked | 8 | segment_max_csr_kernel 未标记 aiv 属性 | kernel 函数添加 __attribute__((aiv)) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel_impl.h | | cce_global attribute ignored [-Wignored-attributes] | 4 | bisheng 编译器对 GM_ADDR 强转报 warning | kernel 启动行用 #pragma GCC diagnostic push/pop 精确抑制(CANN 工具链已知行为,C-style 强转是 kernel 启动的必要写法) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel.cpp | ### build.sh 错误处理改进 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | usage() 固定 exit 0,只显示命令错误,无完整帮助信息 | 改为 exit "${1:-0}" 支持自定义退出码 | scripts/build.sh | | Python 版本检测不传递给 CMake | 添加 Python3_ROOT_DIR 环境变量导出 | scripts/build.sh | | --clean 对 python 目标无效(CMakeCache.txt 缓存旧 Python 版本) | clean_build 移到 main 函数统一调用,删除 build_cpp 里的重复调用 | scripts/build.sh | | pip wheel -w output/whl 可能将 output/whl 创建为文件而非目录 | pip wheel 前加 mkdir -p output/whl | scripts/build.sh | ### CMakeLists.txt 改进 | 改进点 | 说明 | |--------|------| | 添加版权头注释 | 补充 CANN OSL 协议头 | | Python3 查找逻辑优化 | 优先用 Python3_ROOT_DIR 环境变量,避免找到错误版本 | | 抑制 kineto 警告 | find_package(Torch) 前将 kineto_LIBRARY 预置为已存在的 libtorch.so,利用 CMake find_library 在 cache 已有值时跳过搜索的机制消除 warning,libtorch.so 本就参与链接不引入额外依赖 | ### NPU 算子测试修复 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | add_sample 使用 torch::zeros_like 触发 tensor format 警告 | 改为 torch::empty_like(src1.cpu()).to(src1.device()) | csrc/npu/host/add_sample/add_sample.cpp | | test_add_sample_npu 直接创建 NPU tensor 失败 | 改为 CPU 创建后 .npu() 转移 | test/test_example.py | | uint8 张量在 NPU 上计算 expected 失败 | 改为 CPU 上计算后比较 | test/test_example.py | ### 环境要求更新 CANN 9.x + Ascend950 需要 PyTorch 2.7+ 及 v26.0.0 发布线的 torch_npu。 ## 测试验证 - ./scripts/build.sh python 正常构建,无任何警告 - ./scripts/build.sh --clean 清理缓存后构建,CMakeCache.txt 不再缓存旧 Python 版本 - ./scripts/build.sh 123 打印错误+完整帮助,退出码 1 - ./scripts/build.sh --help 显示帮助,退出码 0 - python3 -m pytest test/ -v 全部 13 个测试通过 - 兼容 Python 3.9+(setuptools>=61,CMake 3.15+) - 已在 Python 3.9.25 、Python 3.11.15 、Python3.12.13 验证通过 See merge request: cann/ops-gnn!4 | 20 天前 | |
解决编译warning打屏以及编译运行时出现的错误 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !4 merge warning into master 解决编译warning打屏以及编译运行时出现的错误 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 1.修复了编译时出现的warning 2.修复了编译运行时出现的错误 ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#2](https://gitcode.com/cann/ops-gnn/issues/2) - References [#2](https://gitcode.com/cann/ops-gnn/issues/2) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention ## 修改内容 ### Python 打包警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | License classifiers are deprecated | 2 | classifiers 含 License :: OSI Approved :: MIT License | 删除该 classifier | pyproject.toml、setup.cfg | | project.license as a TOML table is deprecated | 2 | license = {text = "MIT"} TOML 表格式 | 改为 dynamic = ["license"],setup.py 中声明 license='MIT' | pyproject.toml、setup.py | | extras_require overwritten in pyproject.toml | 2 | setup.py 与 pyproject.toml 重复配置 | setup.py 删除 extras_require | setup.py | | setup.py install is deprecated | 1 | build.sh 调用 setup.py bdist_wheel | 改为 python -m pip wheel . --no-deps --no-build-isolation | scripts/build.sh | | wheel bdist_wheel FutureWarning | 2 | 自定义 CustomBDistWheel 类继承 vendored wheel | 删除 CustomBDistWheel 类,统一用 pip wheel | setup.py | | no files found matching '*.cu' | 1 | MANIFEST.in 引用不存在的 *.cu | 删除 *.cu,保留 *.h *.cpp | MANIFEST.in | ### CANN/Kernel 编译警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | kineto_LIBRARY-NOTFOUND CMake Warning | 2 | PyTorch CPU 版不含 CUDA profiling 库 libkineto.a,TorchConfig.cmake 中 find_library 查找不到输出 message(WARNING)。该库仅用于 CUDA 性能分析,NPU 平台不需要 | find_package(Torch) 前将 kineto_LIBRARY cache 变量预置为已存在的 libtorch.so,find_library 发现 cache 已有值则跳过搜索,不再输出 warning。libtorch.so 本就参与最终链接,不会引入新依赖 | CMakeLists.txt | | kernel type is not marked | 8 | segment_max_csr_kernel 未标记 aiv 属性 | kernel 函数添加 __attribute__((aiv)) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel_impl.h | | cce_global attribute ignored [-Wignored-attributes] | 4 | bisheng 编译器对 GM_ADDR 强转报 warning | kernel 启动行用 #pragma GCC diagnostic push/pop 精确抑制(CANN 工具链已知行为,C-style 强转是 kernel 启动的必要写法) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel.cpp | ### build.sh 错误处理改进 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | usage() 固定 exit 0,只显示命令错误,无完整帮助信息 | 改为 exit "${1:-0}" 支持自定义退出码 | scripts/build.sh | | Python 版本检测不传递给 CMake | 添加 Python3_ROOT_DIR 环境变量导出 | scripts/build.sh | | --clean 对 python 目标无效(CMakeCache.txt 缓存旧 Python 版本) | clean_build 移到 main 函数统一调用,删除 build_cpp 里的重复调用 | scripts/build.sh | | pip wheel -w output/whl 可能将 output/whl 创建为文件而非目录 | pip wheel 前加 mkdir -p output/whl | scripts/build.sh | ### CMakeLists.txt 改进 | 改进点 | 说明 | |--------|------| | 添加版权头注释 | 补充 CANN OSL 协议头 | | Python3 查找逻辑优化 | 优先用 Python3_ROOT_DIR 环境变量,避免找到错误版本 | | 抑制 kineto 警告 | find_package(Torch) 前将 kineto_LIBRARY 预置为已存在的 libtorch.so,利用 CMake find_library 在 cache 已有值时跳过搜索的机制消除 warning,libtorch.so 本就参与链接不引入额外依赖 | ### NPU 算子测试修复 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | add_sample 使用 torch::zeros_like 触发 tensor format 警告 | 改为 torch::empty_like(src1.cpu()).to(src1.device()) | csrc/npu/host/add_sample/add_sample.cpp | | test_add_sample_npu 直接创建 NPU tensor 失败 | 改为 CPU 创建后 .npu() 转移 | test/test_example.py | | uint8 张量在 NPU 上计算 expected 失败 | 改为 CPU 上计算后比较 | test/test_example.py | ### 环境要求更新 CANN 9.x + Ascend950 需要 PyTorch 2.7+ 及 v26.0.0 发布线的 torch_npu。 ## 测试验证 - ./scripts/build.sh python 正常构建,无任何警告 - ./scripts/build.sh --clean 清理缓存后构建,CMakeCache.txt 不再缓存旧 Python 版本 - ./scripts/build.sh 123 打印错误+完整帮助,退出码 1 - ./scripts/build.sh --help 显示帮助,退出码 0 - python3 -m pytest test/ -v 全部 13 个测试通过 - 兼容 Python 3.9+(setuptools>=61,CMake 3.15+) - 已在 Python 3.9.25 、Python 3.11.15 、Python3.12.13 验证通过 See merge request: cann/ops-gnn!4 | 20 天前 | |
modify readme Co-authored-by: gcw_CfilvwB1<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !9 merge readme2 into master modify readme Created-by: gcw_CfilvwB1 Commit-by: gcw_CfilvwB1 Merged-by: cann-robot Description: ## 变更描述 / Description 修改了README中的描述 修改cmakelists确保按README中编译运行能够通过 <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#7](https://gitcode.com/cann/ops-gnn/issues/7) - References [#7](https://gitcode.com/cann/ops-gnn/issues/7) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / 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/ops-gnn!9 | 12 天前 | |
modify readme Co-authored-by: gcw_CfilvwB1<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !9 merge readme2 into master modify readme Created-by: gcw_CfilvwB1 Commit-by: gcw_CfilvwB1 Merged-by: cann-robot Description: ## 变更描述 / Description 修改了README中的描述 修改cmakelists确保按README中编译运行能够通过 <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#7](https://gitcode.com/cann/ops-gnn/issues/7) - References [#7](https://gitcode.com/cann/ops-gnn/issues/7) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / 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/ops-gnn!9 | 12 天前 | |
添加segment_max_csr算子并优化基础框架 Co-authored-by: goodpeople233<guojiong1@huawei.com> # message auto-generated for no-merge-commit merge: !2 merge master into master 添加segment_max_csr算子并优化基础框架 Created-by: goodpeople233 Commit-by: goodpeople233 Merged-by: cann-robot Description: ## 变更描述 / Description 添加segment_max_csr算子,同时调整了目录划分,优化了编译逻辑。 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [x] 新功能 / New Feature - [ ] 性能优化 / Performance - [x] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#1](https://gitcode.com/cann/ops-gnn/issues/1) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / 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/ops-gnn!2 | 26 天前 | |
解决编译warning打屏以及编译运行时出现的错误 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !4 merge warning into master 解决编译warning打屏以及编译运行时出现的错误 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 1.修复了编译时出现的warning 2.修复了编译运行时出现的错误 ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#2](https://gitcode.com/cann/ops-gnn/issues/2) - References [#2](https://gitcode.com/cann/ops-gnn/issues/2) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention ## 修改内容 ### Python 打包警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | License classifiers are deprecated | 2 | classifiers 含 License :: OSI Approved :: MIT License | 删除该 classifier | pyproject.toml、setup.cfg | | project.license as a TOML table is deprecated | 2 | license = {text = "MIT"} TOML 表格式 | 改为 dynamic = ["license"],setup.py 中声明 license='MIT' | pyproject.toml、setup.py | | extras_require overwritten in pyproject.toml | 2 | setup.py 与 pyproject.toml 重复配置 | setup.py 删除 extras_require | setup.py | | setup.py install is deprecated | 1 | build.sh 调用 setup.py bdist_wheel | 改为 python -m pip wheel . --no-deps --no-build-isolation | scripts/build.sh | | wheel bdist_wheel FutureWarning | 2 | 自定义 CustomBDistWheel 类继承 vendored wheel | 删除 CustomBDistWheel 类,统一用 pip wheel | setup.py | | no files found matching '*.cu' | 1 | MANIFEST.in 引用不存在的 *.cu | 删除 *.cu,保留 *.h *.cpp | MANIFEST.in | ### CANN/Kernel 编译警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | kineto_LIBRARY-NOTFOUND CMake Warning | 2 | PyTorch CPU 版不含 CUDA profiling 库 libkineto.a,TorchConfig.cmake 中 find_library 查找不到输出 message(WARNING)。该库仅用于 CUDA 性能分析,NPU 平台不需要 | find_package(Torch) 前将 kineto_LIBRARY cache 变量预置为已存在的 libtorch.so,find_library 发现 cache 已有值则跳过搜索,不再输出 warning。libtorch.so 本就参与最终链接,不会引入新依赖 | CMakeLists.txt | | kernel type is not marked | 8 | segment_max_csr_kernel 未标记 aiv 属性 | kernel 函数添加 __attribute__((aiv)) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel_impl.h | | cce_global attribute ignored [-Wignored-attributes] | 4 | bisheng 编译器对 GM_ADDR 强转报 warning | kernel 启动行用 #pragma GCC diagnostic push/pop 精确抑制(CANN 工具链已知行为,C-style 强转是 kernel 启动的必要写法) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel.cpp | ### build.sh 错误处理改进 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | usage() 固定 exit 0,只显示命令错误,无完整帮助信息 | 改为 exit "${1:-0}" 支持自定义退出码 | scripts/build.sh | | Python 版本检测不传递给 CMake | 添加 Python3_ROOT_DIR 环境变量导出 | scripts/build.sh | | --clean 对 python 目标无效(CMakeCache.txt 缓存旧 Python 版本) | clean_build 移到 main 函数统一调用,删除 build_cpp 里的重复调用 | scripts/build.sh | | pip wheel -w output/whl 可能将 output/whl 创建为文件而非目录 | pip wheel 前加 mkdir -p output/whl | scripts/build.sh | ### CMakeLists.txt 改进 | 改进点 | 说明 | |--------|------| | 添加版权头注释 | 补充 CANN OSL 协议头 | | Python3 查找逻辑优化 | 优先用 Python3_ROOT_DIR 环境变量,避免找到错误版本 | | 抑制 kineto 警告 | find_package(Torch) 前将 kineto_LIBRARY 预置为已存在的 libtorch.so,利用 CMake find_library 在 cache 已有值时跳过搜索的机制消除 warning,libtorch.so 本就参与链接不引入额外依赖 | ### NPU 算子测试修复 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | add_sample 使用 torch::zeros_like 触发 tensor format 警告 | 改为 torch::empty_like(src1.cpu()).to(src1.device()) | csrc/npu/host/add_sample/add_sample.cpp | | test_add_sample_npu 直接创建 NPU tensor 失败 | 改为 CPU 创建后 .npu() 转移 | test/test_example.py | | uint8 张量在 NPU 上计算 expected 失败 | 改为 CPU 上计算后比较 | test/test_example.py | ### 环境要求更新 CANN 9.x + Ascend950 需要 PyTorch 2.7+ 及 v26.0.0 发布线的 torch_npu。 ## 测试验证 - ./scripts/build.sh python 正常构建,无任何警告 - ./scripts/build.sh --clean 清理缓存后构建,CMakeCache.txt 不再缓存旧 Python 版本 - ./scripts/build.sh 123 打印错误+完整帮助,退出码 1 - ./scripts/build.sh --help 显示帮助,退出码 0 - python3 -m pytest test/ -v 全部 13 个测试通过 - 兼容 Python 3.9+(setuptools>=61,CMake 3.15+) - 已在 Python 3.9.25 、Python 3.11.15 、Python3.12.13 验证通过 See merge request: cann/ops-gnn!4 | 20 天前 | |
add OAT rule Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !6 merge OAT into master add OAT rule Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 增加自定义OAT扫描规则 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [x] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#4](https://gitcode.com/cann/ops-gnn/issues/4) - References [#4](https://gitcode.com/cann/ops-gnn/issues/4) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [x] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention See merge request: cann/ops-gnn!6 | 19 天前 | |
修改中英文文档 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !11 merge docs into master 修改中英文文档 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 修改中英文文档,确保格式正确 1.代码块指定编程语言 2.表格前空行 3.修改链接 4.修改中文文档文件名和英文文档一致 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#9](https://gitcode.com/cann/ops-gnn/issues/9) - References [#9](https://gitcode.com/cann/ops-gnn/issues/9) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / 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/ops-gnn!11 | 5 天前 | |
修改中英文文档 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !11 merge docs into master 修改中英文文档 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 修改中英文文档,确保格式正确 1.代码块指定编程语言 2.表格前空行 3.修改链接 4.修改中文文档文件名和英文文档一致 ## 改动类型 / Change Type - [ ] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [x] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#9](https://gitcode.com/cann/ops-gnn/issues/9) - References [#9](https://gitcode.com/cann/ops-gnn/issues/9) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [ ] 单元测试通过 / UT passed - [ ] 集成测试通过 / ST passed - [ ] 人工验证通过 / 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/ops-gnn!11 | 5 天前 | |
解决编译warning打屏以及编译运行时出现的错误 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !4 merge warning into master 解决编译warning打屏以及编译运行时出现的错误 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 1.修复了编译时出现的warning 2.修复了编译运行时出现的错误 ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#2](https://gitcode.com/cann/ops-gnn/issues/2) - References [#2](https://gitcode.com/cann/ops-gnn/issues/2) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention ## 修改内容 ### Python 打包警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | License classifiers are deprecated | 2 | classifiers 含 License :: OSI Approved :: MIT License | 删除该 classifier | pyproject.toml、setup.cfg | | project.license as a TOML table is deprecated | 2 | license = {text = "MIT"} TOML 表格式 | 改为 dynamic = ["license"],setup.py 中声明 license='MIT' | pyproject.toml、setup.py | | extras_require overwritten in pyproject.toml | 2 | setup.py 与 pyproject.toml 重复配置 | setup.py 删除 extras_require | setup.py | | setup.py install is deprecated | 1 | build.sh 调用 setup.py bdist_wheel | 改为 python -m pip wheel . --no-deps --no-build-isolation | scripts/build.sh | | wheel bdist_wheel FutureWarning | 2 | 自定义 CustomBDistWheel 类继承 vendored wheel | 删除 CustomBDistWheel 类,统一用 pip wheel | setup.py | | no files found matching '*.cu' | 1 | MANIFEST.in 引用不存在的 *.cu | 删除 *.cu,保留 *.h *.cpp | MANIFEST.in | ### CANN/Kernel 编译警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | kineto_LIBRARY-NOTFOUND CMake Warning | 2 | PyTorch CPU 版不含 CUDA profiling 库 libkineto.a,TorchConfig.cmake 中 find_library 查找不到输出 message(WARNING)。该库仅用于 CUDA 性能分析,NPU 平台不需要 | find_package(Torch) 前将 kineto_LIBRARY cache 变量预置为已存在的 libtorch.so,find_library 发现 cache 已有值则跳过搜索,不再输出 warning。libtorch.so 本就参与最终链接,不会引入新依赖 | CMakeLists.txt | | kernel type is not marked | 8 | segment_max_csr_kernel 未标记 aiv 属性 | kernel 函数添加 __attribute__((aiv)) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel_impl.h | | cce_global attribute ignored [-Wignored-attributes] | 4 | bisheng 编译器对 GM_ADDR 强转报 warning | kernel 启动行用 #pragma GCC diagnostic push/pop 精确抑制(CANN 工具链已知行为,C-style 强转是 kernel 启动的必要写法) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel.cpp | ### build.sh 错误处理改进 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | usage() 固定 exit 0,只显示命令错误,无完整帮助信息 | 改为 exit "${1:-0}" 支持自定义退出码 | scripts/build.sh | | Python 版本检测不传递给 CMake | 添加 Python3_ROOT_DIR 环境变量导出 | scripts/build.sh | | --clean 对 python 目标无效(CMakeCache.txt 缓存旧 Python 版本) | clean_build 移到 main 函数统一调用,删除 build_cpp 里的重复调用 | scripts/build.sh | | pip wheel -w output/whl 可能将 output/whl 创建为文件而非目录 | pip wheel 前加 mkdir -p output/whl | scripts/build.sh | ### CMakeLists.txt 改进 | 改进点 | 说明 | |--------|------| | 添加版权头注释 | 补充 CANN OSL 协议头 | | Python3 查找逻辑优化 | 优先用 Python3_ROOT_DIR 环境变量,避免找到错误版本 | | 抑制 kineto 警告 | find_package(Torch) 前将 kineto_LIBRARY 预置为已存在的 libtorch.so,利用 CMake find_library 在 cache 已有值时跳过搜索的机制消除 warning,libtorch.so 本就参与链接不引入额外依赖 | ### NPU 算子测试修复 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | add_sample 使用 torch::zeros_like 触发 tensor format 警告 | 改为 torch::empty_like(src1.cpu()).to(src1.device()) | csrc/npu/host/add_sample/add_sample.cpp | | test_add_sample_npu 直接创建 NPU tensor 失败 | 改为 CPU 创建后 .npu() 转移 | test/test_example.py | | uint8 张量在 NPU 上计算 expected 失败 | 改为 CPU 上计算后比较 | test/test_example.py | ### 环境要求更新 CANN 9.x + Ascend950 需要 PyTorch 2.7+ 及 v26.0.0 发布线的 torch_npu。 ## 测试验证 - ./scripts/build.sh python 正常构建,无任何警告 - ./scripts/build.sh --clean 清理缓存后构建,CMakeCache.txt 不再缓存旧 Python 版本 - ./scripts/build.sh 123 打印错误+完整帮助,退出码 1 - ./scripts/build.sh --help 显示帮助,退出码 0 - python3 -m pytest test/ -v 全部 13 个测试通过 - 兼容 Python 3.9+(setuptools>=61,CMake 3.15+) - 已在 Python 3.9.25 、Python 3.11.15 、Python3.12.13 验证通过 See merge request: cann/ops-gnn!4 | 20 天前 | |
解决编译warning打屏以及编译运行时出现的错误 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !4 merge warning into master 解决编译warning打屏以及编译运行时出现的错误 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 1.修复了编译时出现的warning 2.修复了编译运行时出现的错误 ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#2](https://gitcode.com/cann/ops-gnn/issues/2) - References [#2](https://gitcode.com/cann/ops-gnn/issues/2) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention ## 修改内容 ### Python 打包警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | License classifiers are deprecated | 2 | classifiers 含 License :: OSI Approved :: MIT License | 删除该 classifier | pyproject.toml、setup.cfg | | project.license as a TOML table is deprecated | 2 | license = {text = "MIT"} TOML 表格式 | 改为 dynamic = ["license"],setup.py 中声明 license='MIT' | pyproject.toml、setup.py | | extras_require overwritten in pyproject.toml | 2 | setup.py 与 pyproject.toml 重复配置 | setup.py 删除 extras_require | setup.py | | setup.py install is deprecated | 1 | build.sh 调用 setup.py bdist_wheel | 改为 python -m pip wheel . --no-deps --no-build-isolation | scripts/build.sh | | wheel bdist_wheel FutureWarning | 2 | 自定义 CustomBDistWheel 类继承 vendored wheel | 删除 CustomBDistWheel 类,统一用 pip wheel | setup.py | | no files found matching '*.cu' | 1 | MANIFEST.in 引用不存在的 *.cu | 删除 *.cu,保留 *.h *.cpp | MANIFEST.in | ### CANN/Kernel 编译警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | kineto_LIBRARY-NOTFOUND CMake Warning | 2 | PyTorch CPU 版不含 CUDA profiling 库 libkineto.a,TorchConfig.cmake 中 find_library 查找不到输出 message(WARNING)。该库仅用于 CUDA 性能分析,NPU 平台不需要 | find_package(Torch) 前将 kineto_LIBRARY cache 变量预置为已存在的 libtorch.so,find_library 发现 cache 已有值则跳过搜索,不再输出 warning。libtorch.so 本就参与最终链接,不会引入新依赖 | CMakeLists.txt | | kernel type is not marked | 8 | segment_max_csr_kernel 未标记 aiv 属性 | kernel 函数添加 __attribute__((aiv)) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel_impl.h | | cce_global attribute ignored [-Wignored-attributes] | 4 | bisheng 编译器对 GM_ADDR 强转报 warning | kernel 启动行用 #pragma GCC diagnostic push/pop 精确抑制(CANN 工具链已知行为,C-style 强转是 kernel 启动的必要写法) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel.cpp | ### build.sh 错误处理改进 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | usage() 固定 exit 0,只显示命令错误,无完整帮助信息 | 改为 exit "${1:-0}" 支持自定义退出码 | scripts/build.sh | | Python 版本检测不传递给 CMake | 添加 Python3_ROOT_DIR 环境变量导出 | scripts/build.sh | | --clean 对 python 目标无效(CMakeCache.txt 缓存旧 Python 版本) | clean_build 移到 main 函数统一调用,删除 build_cpp 里的重复调用 | scripts/build.sh | | pip wheel -w output/whl 可能将 output/whl 创建为文件而非目录 | pip wheel 前加 mkdir -p output/whl | scripts/build.sh | ### CMakeLists.txt 改进 | 改进点 | 说明 | |--------|------| | 添加版权头注释 | 补充 CANN OSL 协议头 | | Python3 查找逻辑优化 | 优先用 Python3_ROOT_DIR 环境变量,避免找到错误版本 | | 抑制 kineto 警告 | find_package(Torch) 前将 kineto_LIBRARY 预置为已存在的 libtorch.so,利用 CMake find_library 在 cache 已有值时跳过搜索的机制消除 warning,libtorch.so 本就参与链接不引入额外依赖 | ### NPU 算子测试修复 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | add_sample 使用 torch::zeros_like 触发 tensor format 警告 | 改为 torch::empty_like(src1.cpu()).to(src1.device()) | csrc/npu/host/add_sample/add_sample.cpp | | test_add_sample_npu 直接创建 NPU tensor 失败 | 改为 CPU 创建后 .npu() 转移 | test/test_example.py | | uint8 张量在 NPU 上计算 expected 失败 | 改为 CPU 上计算后比较 | test/test_example.py | ### 环境要求更新 CANN 9.x + Ascend950 需要 PyTorch 2.7+ 及 v26.0.0 发布线的 torch_npu。 ## 测试验证 - ./scripts/build.sh python 正常构建,无任何警告 - ./scripts/build.sh --clean 清理缓存后构建,CMakeCache.txt 不再缓存旧 Python 版本 - ./scripts/build.sh 123 打印错误+完整帮助,退出码 1 - ./scripts/build.sh --help 显示帮助,退出码 0 - python3 -m pytest test/ -v 全部 13 个测试通过 - 兼容 Python 3.9+(setuptools>=61,CMake 3.15+) - 已在 Python 3.9.25 、Python 3.11.15 、Python3.12.13 验证通过 See merge request: cann/ops-gnn!4 | 20 天前 | |
解决编译warning打屏以及编译运行时出现的错误 Co-authored-by: wwwlyy<wangxiaohan40@h-partners.com> # message auto-generated for no-merge-commit merge: !4 merge warning into master 解决编译warning打屏以及编译运行时出现的错误 Created-by: gcw_CfilvwB1 Commit-by: wwwlyy Merged-by: cann-robot Description: ## 变更描述 / Description <!-- 本 PR 做了什么,为什么需要 / What does this PR do and why --> 1.修复了编译时出现的warning 2.修复了编译运行时出现的错误 ## 改动类型 / Change Type - [x] Bug 修复 / Bug Fix - [ ] 新功能 / New Feature - [ ] 性能优化 / Performance - [ ] 代码重构 / Refactoring - [ ] 文档更新 / Documentation - [ ] 测试相关 / Test - [ ] 其它 / Other ## 关联 Issue / Related Issues <!-- Closes #000 可自动关闭 / Closes #000 to auto-close --> - Closes [#2](https://gitcode.com/cann/ops-gnn/issues/2) - References [#2](https://gitcode.com/cann/ops-gnn/issues/2) ## 测试信息 / Testing <!-- 简要测试说明或关键结果 / Brief test description or key results --> - [x] 单元测试通过 / UT passed - [x] 集成测试通过 / ST passed - [x] 人工验证通过 / Manual verified ## 检查清单 / Checklist - [x] 代码符合规范 / Code follows style guide - [ ] 测试添加并通过 / Tests added and passed - [ ] 文档已更新 / Docs updated if needed - [ ] 无硬编码敏感信息 / No secrets hardcoded - [x] 提交信息符合规范 / Commit message follows convention ## 修改内容 ### Python 打包警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | License classifiers are deprecated | 2 | classifiers 含 License :: OSI Approved :: MIT License | 删除该 classifier | pyproject.toml、setup.cfg | | project.license as a TOML table is deprecated | 2 | license = {text = "MIT"} TOML 表格式 | 改为 dynamic = ["license"],setup.py 中声明 license='MIT' | pyproject.toml、setup.py | | extras_require overwritten in pyproject.toml | 2 | setup.py 与 pyproject.toml 重复配置 | setup.py 删除 extras_require | setup.py | | setup.py install is deprecated | 1 | build.sh 调用 setup.py bdist_wheel | 改为 python -m pip wheel . --no-deps --no-build-isolation | scripts/build.sh | | wheel bdist_wheel FutureWarning | 2 | 自定义 CustomBDistWheel 类继承 vendored wheel | 删除 CustomBDistWheel 类,统一用 pip wheel | setup.py | | no files found matching '*.cu' | 1 | MANIFEST.in 引用不存在的 *.cu | 删除 *.cu,保留 *.h *.cpp | MANIFEST.in | ### CANN/Kernel 编译警告修复 | 警告 | 次数 | 根因 | 修复方法 | 修改文件 | |------|------|------|----------|----------| | kineto_LIBRARY-NOTFOUND CMake Warning | 2 | PyTorch CPU 版不含 CUDA profiling 库 libkineto.a,TorchConfig.cmake 中 find_library 查找不到输出 message(WARNING)。该库仅用于 CUDA 性能分析,NPU 平台不需要 | find_package(Torch) 前将 kineto_LIBRARY cache 变量预置为已存在的 libtorch.so,find_library 发现 cache 已有值则跳过搜索,不再输出 warning。libtorch.so 本就参与最终链接,不会引入新依赖 | CMakeLists.txt | | kernel type is not marked | 8 | segment_max_csr_kernel 未标记 aiv 属性 | kernel 函数添加 __attribute__((aiv)) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel_impl.h | | cce_global attribute ignored [-Wignored-attributes] | 4 | bisheng 编译器对 GM_ADDR 强转报 warning | kernel 启动行用 #pragma GCC diagnostic push/pop 精确抑制(CANN 工具链已知行为,C-style 强转是 kernel 启动的必要写法) | csrc/npu/kernel/segment_max_csr/segment_max_csr_kernel.cpp | ### build.sh 错误处理改进 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | usage() 固定 exit 0,只显示命令错误,无完整帮助信息 | 改为 exit "${1:-0}" 支持自定义退出码 | scripts/build.sh | | Python 版本检测不传递给 CMake | 添加 Python3_ROOT_DIR 环境变量导出 | scripts/build.sh | | --clean 对 python 目标无效(CMakeCache.txt 缓存旧 Python 版本) | clean_build 移到 main 函数统一调用,删除 build_cpp 里的重复调用 | scripts/build.sh | | pip wheel -w output/whl 可能将 output/whl 创建为文件而非目录 | pip wheel 前加 mkdir -p output/whl | scripts/build.sh | ### CMakeLists.txt 改进 | 改进点 | 说明 | |--------|------| | 添加版权头注释 | 补充 CANN OSL 协议头 | | Python3 查找逻辑优化 | 优先用 Python3_ROOT_DIR 环境变量,避免找到错误版本 | | 抑制 kineto 警告 | find_package(Torch) 前将 kineto_LIBRARY 预置为已存在的 libtorch.so,利用 CMake find_library 在 cache 已有值时跳过搜索的机制消除 warning,libtorch.so 本就参与链接不引入额外依赖 | ### NPU 算子测试修复 | 问题 | 修复方法 | 修改文件 | |------|----------|----------| | add_sample 使用 torch::zeros_like 触发 tensor format 警告 | 改为 torch::empty_like(src1.cpu()).to(src1.device()) | csrc/npu/host/add_sample/add_sample.cpp | | test_add_sample_npu 直接创建 NPU tensor 失败 | 改为 CPU 创建后 .npu() 转移 | test/test_example.py | | uint8 张量在 NPU 上计算 expected 失败 | 改为 CPU 上计算后比较 | test/test_example.py | ### 环境要求更新 CANN 9.x + Ascend950 需要 PyTorch 2.7+ 及 v26.0.0 发布线的 torch_npu。 ## 测试验证 - ./scripts/build.sh python 正常构建,无任何警告 - ./scripts/build.sh --clean 清理缓存后构建,CMakeCache.txt 不再缓存旧 Python 版本 - ./scripts/build.sh 123 打印错误+完整帮助,退出码 1 - ./scripts/build.sh --help 显示帮助,退出码 0 - python3 -m pytest test/ -v 全部 13 个测试通过 - 兼容 Python 3.9+(setuptools>=61,CMake 3.15+) - 已在 Python 3.9.25 、Python 3.11.15 、Python3.12.13 验证通过 See merge request: cann/ops-gnn!4 | 20 天前 |
ops-gnn
English | 简体中文
ops-gnn 是昇腾生态下针对图神经网络(GNN)推出的一款算子库,支持基于NPU对图神经网络进行加速。
项目结构
ops-gnn/
├── csrc/ # C++/AscendC源码目录
│ ├── pybind.cpp # PyTorch绑定代码
│ └── npu/ # NPU相关代码
│ ├── host/ # Host端代码(按算子分类)
│ └── kernel/ # AscendC内核实现(按算子分类)
├── docs/ # 文档目录
├── python/ # Python源码目录
│ └── ops_gnn/ # Python包目录
│ ├── __init__.py # 包初始化文件
│ ├── add_sample.py # Python接口声明
│ ├── segment_max_csr.py # Python接口声明
│ └── typing.py # 类型定义
├── test/ # 测试目录
├── scripts/ # 构建脚本目录
│ └── build.sh # 统一构建脚本
├── cmake/ # CMake配置
│ └── OpsGNNConfig.cmake.in
├── CMakeLists.txt # CMake构建配置
├── setup.py # Python安装脚本 (使用PyTorch cpp_extension)
├── setup.cfg # setuptools配置
├── pyproject.toml # 现代Python项目配置
├── MANIFEST.in # 打包清单
└── LICENSE # CANN 许可证
环境要求
- Python 3.9+
- CMake 3.18+
- PyTorch 2.7+
- torch_npu 26.0.0 及之后版本 (PyTorch NPU 扩展)
- CANN Toolkit (AscendC 编译器)
- C++17 或更高版本编译器
CANN 环境配置
source ${ASCEND_HOME_PATH}/bin/setenv.bash
安装方法
方法1:使用pip直接安装
# 激活 CANN 环境
source ${ASCEND_HOME_PATH}/bin/setenv.bash
# 安装开发模式
pip install --no-build-isolation -e .
方法2:使用构建脚本
cd scripts
# 构建 Python 包
./build.sh python
方法3:使用CMake(Linux)
source /usr/local/Ascend/cann-9.1.0-beta.1/bin/setenv.bash
mkdir -p build_cmake
cd build_cmake
cmake ..
cmake --build .
运行测试
# 安装测试依赖
pip install pytest pytest-cov
# 运行所有测试
pytest test/ -v
使用示例
import torch
import ops_gnn
# NPU tensor 加法运算
src1 = torch.tensor([1, 2, 3, 4, 5], dtype=torch.uint8, device='npu')
src2 = torch.tensor([5, 4, 3, 2, 1], dtype=torch.uint8, device='npu')
result = ops_gnn.add_sample(src1, src2)
print(result) # 输出: tensor([6, 6, 6, 6, 6], device='npu:0', dtype=torch.uint8)
# CSR 格式的分段最大值运算
src = torch.tensor([[1, 2], [3, 4], [5, 6], [7, 8]], dtype=torch.float32, device='npu')
indptr = torch.tensor([0, 2, 4], dtype=torch.int32, device='npu')
result = ops_gnn.segment_max_csr(src, indptr)
print(result) # 输出: tensor([[3, 4], [7, 8]], device='npu:0')
算子列表
| 算子 | 功能 | 设备支持 |
|---|---|---|
add_sample |
两个 tensor 逐元素相加 | NPU |
segment_max_csr |
CSR 格式的分段最大值运算 | NPU |
开发指南
添加新的 NPU 算子
- 在
csrc/npu/kernel/<算子名>/中创建 AscendC 内核文件(.cpp)和头文件(.h) - 在
csrc/npu/host/<算子名>/中创建算子接口实现(.cpp)和头文件(.h) - 在
csrc/pybind.cpp中添加 PyTorch 绑定 - 在
python/ops_gnn/中创建 Python 接口声明文件 - 更新
python/ops_gnn/__init__.py导出新函数 - 在
test/中添加测试文件
许可证
CANN Open Software License Agreement Version 2.0