Merged
refactor: unify SIMT sample CMake compilation #5656
ruoshuisixueAdd on Sep 4
refactor: unify SIMT sample CMake compilation #5656
Merged
Merged fromruoshuisixue/asc-devkit_pure2masterintocann/asc-devkitmaster
Total: 55 files changed+161-430
| @@ -209,7 +209,7 @@ add_executable(demo | |||
| 209 | 编译AI Core SIMT代码时,需要在编译选项中增加`--enable-simt`,或通过`CMAKE_ASC_ENABLE_SIMT`设置为ON启用SIMT编译模式,示例如下,完整样例请参考:[LINK](../../../../../../examples/03_simt_api/00_introduction/00_quickstart/hello_world_simt)。 | 209 | 编译AI Core SIMT代码时,需要在编译选项中增加`--enable-simt`,或通过`CMAKE_ASC_ENABLE_SIMT`设置为ON启用SIMT编译模式,示例如下,完整样例请参考:[LINK](../../../../../../examples/03_simt_api/00_introduction/00_quickstart/hello_world_simt)。 |
| 210 | 210 | ||
| 211 | ```cmake | 211 | ```cmake |
| 212 | -# CMAKE_ASC_ARCHITECTURES:指定NPU架构版本,可通过-DCMAKE_ASC_ARCHITECTURES=dav-xxxx覆盖默认值 | 212 | +# CMAKE_ASC_ARCHITECTURES:指定NPU架构版本,可通过-DCMAKE_ASC_ARCHITECTURES=dav-xxxx覆盖默认值,需要在find_package(ASC)前设置 |
| 213 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") | 213 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") |
| 214 | # CMAKE_ASC_ENABLE_SIMT:启用SIMT编译模式,需要在find_package(ASC)前设置 | 214 | # CMAKE_ASC_ENABLE_SIMT:启用SIMT编译模式,需要在find_package(ASC)前设置 |
| 215 | set(CMAKE_ASC_ENABLE_SIMT ON) | 215 | set(CMAKE_ASC_ENABLE_SIMT ON) |
| @@ -10,22 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 18 | ||
| 17 | add_executable(demo | 19 | add_executable(demo |
| 18 | hello_world.asc | 20 | hello_world.asc |
| 19 | ) | 21 | ) |
| 20 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 21 | - | ||
| 22 | - | ||
| 23 | -# ====================================================================================== | ||
| 24 | -# NPU 编译选项配置 | ||
| 25 | -# | ||
| 26 | -# 说明: | ||
| 27 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 28 | -# ====================================================================================== | ||
| 29 | -target_compile_options(demo PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | -) | ||
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,22 +10,12 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | add_executable(demo | 19 | add_executable(demo |
| 19 | gather_1d.asc | 20 | gather_1d.asc |
| 20 | ) | 21 | ) |
| 21 | - | ||
| 22 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 23 | - | ||
| 24 | -# ====================================================================================== | ||
| 25 | -# NPU 编译选项配置 | ||
| 26 | -# | ||
| 27 | -# 说明: | ||
| 28 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 29 | -# ====================================================================================== | ||
| 30 | -target_compile_options(demo PRIVATE | ||
| 31 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 32 | -) | ||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | ## 支持的CANN软件版本 | 11 | ## 支持的CANN软件版本 |
| 12 | 12 | ||
| 13 | -- \>= CANN 9.0.0 | 13 | +- \>= CANN 9.1.0 |
L | |||
| 14 | 14 | ||
| 15 | ## 目录结构 | 15 | ## 目录结构 |
| 16 | 16 | ||
| @@ -10,7 +10,7 @@ This sample implements a one-dimensional Gather operator in a simple scenario (w | |||
| 10 | 10 | ||
| 11 | ## Supported CANN Software Versions | 11 | ## Supported CANN Software Versions |
| 12 | 12 | ||
| 13 | -- \>= CANN 9.0.0 | 13 | +- \>= CANN 9.1.0 |
| 14 | 14 | ||
| 15 | ## Directory Structure | 15 | ## Directory Structure |
| 16 | 16 | ||
| @@ -85,4 +85,4 @@ Execute the following steps in the root directory of this sample to build and ru | |||
| 85 | 85 | ||
| 86 | ```text | 86 | ```text |
| 87 | [Success] Case accuracy is verification passed. | 87 | [Success] Case accuracy is verification passed. |
| 88 | - ``` | 88 | + ``` |
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,26 +10,16 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | add_executable(demo | 19 | add_executable(demo |
| 19 | gather_2d.asc | 20 | gather_2d.asc |
| 20 | ) | 21 | ) |
| 21 | 22 | ||
| 22 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 23 | - | ||
| 24 | -# ====================================================================================== | ||
| 25 | -# NPU 编译选项配置 | ||
| 26 | -# | ||
| 27 | -# 说明: | ||
| 28 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 29 | -# ====================================================================================== | ||
| 30 | -target_compile_options(demo PRIVATE | ||
| 31 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 32 | -) | ||
| 33 | - | ||
| 34 | target_link_libraries(demo PRIVATE | 23 | target_link_libraries(demo PRIVATE |
| 35 | m | 24 | m |
| 36 | platform | 25 | platform |
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | ## 支持的CANN软件版本 | 11 | ## 支持的CANN软件版本 |
| 12 | 12 | ||
| 13 | -- \>= CANN 9.0.0 | 13 | +- \>= CANN 9.1.0 |
| 14 | 14 | ||
| 15 | ## 目录结构介绍 | 15 | ## 目录结构介绍 |
| 16 | 16 | ||
| @@ -10,7 +10,7 @@ This sample implements a simple scenario (fixed shape) 2D Gather operator using | |||
| 10 | 10 | ||
| 11 | ## Supported CANN Software Versions | 11 | ## Supported CANN Software Versions |
| 12 | 12 | ||
| 13 | -- \>= CANN 9.0.0 | 13 | +- \>= CANN 9.1.0 |
| 14 | 14 | ||
| 15 | ## Directory Structure | 15 | ## Directory Structure |
| 16 | 16 | ||
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,25 +10,15 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | ||
| 15 | - | ||
| 16 | -project(kernel_samples LANGUAGES ASC CXX) | ||
| 17 | - | ||
| 18 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | + | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 17 | +project(kernel_samples LANGUAGES ASC CXX) | ||
| 19 | 18 | ||
| 20 | function(add_asc_executable TARGET_NAME SOURCE_FILE) | 19 | function(add_asc_executable TARGET_NAME SOURCE_FILE) |
| 21 | add_executable(${TARGET_NAME} ${SOURCE_FILE}) | 20 | add_executable(${TARGET_NAME} ${SOURCE_FILE}) |
| 22 | 21 | ||
| 23 | - # ====================================================================================== | ||
| 24 | - # NPU 编译选项配置 | ||
| 25 | - # | ||
| 26 | - # 说明: | ||
| 27 | - # - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 28 | - # ====================================================================================== | ||
| 29 | - target_compile_options(${TARGET_NAME} PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | - ) | ||
| 32 | - | ||
| 33 | target_link_libraries(${TARGET_NAME} PRIVATE | 22 | target_link_libraries(${TARGET_NAME} PRIVATE |
| 34 | m | 23 | m |
| 35 | platform | 24 | platform |
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | ## 支持的CANN软件版本 | 11 | ## 支持的CANN软件版本 |
| 12 | 12 | ||
| 13 | -- \>= CANN 9.0.0 | 13 | +- \>= CANN 9.1.0 |
| 14 | 14 | ||
| 15 | ## 目录结构介绍 | 15 | ## 目录结构介绍 |
| 16 | 16 | ||
| @@ -10,7 +10,7 @@ This example implements a generalized shape Gather operator based on the Ascend | |||
| 10 | 10 | ||
| 11 | ## Supported CANN Software Versions | 11 | ## Supported CANN Software Versions |
| 12 | 12 | ||
| 13 | -- \>= CANN 9.0.0 | 13 | +- \>= CANN 9.1.0 |
| 14 | 14 | ||
| 15 | ## Directory Structure | 15 | ## Directory Structure |
| 16 | 16 | ||
| @@ -169,4 +169,4 @@ Execute the following steps in the root directory of this example to compile and | |||
| 169 | 169 | ||
| 170 | ```text | 170 | ```text |
| 171 | [Success] Case accuracy is verification passed. | 171 | [Success] Case accuracy is verification passed. |
| 172 | - ``` | 172 | + ``` |
| @@ -10,22 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 18 | ||
| 17 | add_executable(demo | 19 | add_executable(demo |
| 18 | printf.asc | 20 | printf.asc |
| 19 | ) | 21 | ) |
| 20 | - | ||
| 21 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 22 | - | ||
| 23 | -# ====================================================================================== | ||
| 24 | -# NPU 编译选项配置 | ||
| 25 | -# | ||
| 26 | -# 说明: | ||
| 27 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 28 | -# ====================================================================================== | ||
| 29 | -target_compile_options(demo PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | -) | ||
| @@ -10,22 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 18 | ||
| 17 | add_executable(demo | 19 | add_executable(demo |
| 18 | assert.asc | 20 | assert.asc |
| 19 | ) | 21 | ) |
| 20 | - | ||
| 21 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 22 | - | ||
| 23 | -# ====================================================================================== | ||
| 24 | -# NPU 编译选项配置 | ||
| 25 | -# | ||
| 26 | -# 说明: | ||
| 27 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 28 | -# ====================================================================================== | ||
| 29 | -target_compile_options(demo PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | -) | ||
| @@ -10,22 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 18 | ||
| 17 | add_executable(demo | 19 | add_executable(demo |
| 18 | clock.asc | 20 | clock.asc |
| 19 | ) | 21 | ) |
| 20 | - | ||
| 21 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 22 | - | ||
| 23 | -# ====================================================================================== | ||
| 24 | -# NPU 编译选项配置 | ||
| 25 | -# | ||
| 26 | -# 说明: | ||
| 27 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 28 | -# ====================================================================================== | ||
| 29 | -target_compile_options(demo PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | -) | ||
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,22 +10,12 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | add_executable(demo | 19 | add_executable(demo |
| 19 | gather.asc | 20 | gather.asc |
| 20 | ) | 21 | ) |
| 21 | - | ||
| 22 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 23 | - | ||
| 24 | -# ====================================================================================== | ||
| 25 | -# NPU 编译选项配置 | ||
| 26 | -# | ||
| 27 | -# 说明: | ||
| 28 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 29 | -# ====================================================================================== | ||
| 30 | -target_compile_options(demo PRIVATE | ||
| 31 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 32 | -) | ||
| @@ -10,7 +10,7 @@ | |||
| 10 | - Ascend 950PR/Ascend 950DT | 10 | - Ascend 950PR/Ascend 950DT |
| 11 | 11 | ||
| 12 | ## 支持的CANN软件版本 | 12 | ## 支持的CANN软件版本 |
| 13 | -- \>= CANN 9.0.0 | 13 | +- \>= CANN 9.1.0 |
| 14 | 14 | ||
| 15 | ## 目录结构介绍 | 15 | ## 目录结构介绍 |
| 16 | 16 | ||
| @@ -9,7 +9,7 @@ This example is based on the Gather operator and demonstrates how to collect on- | |||
| 9 | - Ascend 950PR/Ascend 950DT | 9 | - Ascend 950PR/Ascend 950DT |
| 10 | 10 | ||
| 11 | ## Supported CANN Software Version | 11 | ## Supported CANN Software Version |
| 12 | -- \>= CANN 9.0.0 | 12 | +- \>= CANN 9.1.0 |
| 13 | 13 | ||
| 14 | ## Directory Structure | 14 | ## Directory Structure |
| 15 | 15 | ||
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,17 +10,16 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | add_executable(demo | 19 | add_executable(demo |
| 19 | add.asc | 20 | add.asc |
| 20 | ) | 21 | ) |
| 21 | 22 | ||
| 22 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 23 | - | ||
| 24 | target_compile_options(demo PRIVATE | 23 | target_compile_options(demo PRIVATE |
| 25 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 26 | -g | 24 | -g |
| 27 | ) | 25 | ) |
| @@ -11,16 +11,13 @@ | |||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | set(CMAKE_ASC_RUN_MODE "npu" CACHE STRING "Run mode: npu, sim") | 13 | set(CMAKE_ASC_RUN_MODE "npu" CACHE STRING "Run mode: npu, sim") |
| 14 | + | ||
| 14 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | 15 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") |
| 16 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 17 | ||
| 16 | find_package(ASC REQUIRED) | 18 | find_package(ASC REQUIRED) |
| 17 | - | ||
| 18 | project(kernel_samples LANGUAGES ASC CXX) | 19 | project(kernel_samples LANGUAGES ASC CXX) |
| 19 | 20 | ||
| 20 | add_executable(demo | 21 | add_executable(demo |
| 21 | log.asc | 22 | log.asc |
| 22 | ) | 23 | ) |
| 23 | - | ||
| 24 | -target_compile_options(demo PRIVATE | ||
| 25 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 26 | -) | ||
| @@ -8,9 +8,10 @@ | |||
| 8 | # See LICENSE in the root of the software repository for the full text of the License. | 8 | # See LICENSE in the root of the software repository for the full text of the License. |
| 9 | # ---------------------------------------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------------------------------------- |
| 10 | 10 | ||
| 11 | - | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | 12 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") |
| 13 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | + | ||
| 14 | find_package(ASC REQUIRED) | 15 | find_package(ASC REQUIRED) |
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 16 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | find_package(Python3 COMPONENTS Interpreter Development REQUIRED) | 17 | find_package(Python3 COMPONENTS Interpreter Development REQUIRED) |
| @@ -47,7 +48,3 @@ target_link_libraries(ascendc_roll PRIVATE | |||
| 47 | target_link_directories(ascendc_roll PRIVATE | 48 | target_link_directories(ascendc_roll PRIVATE |
| 48 | ${TORCH_NPU_LIBRARIES} | 49 | ${TORCH_NPU_LIBRARIES} |
| 49 | ) | 50 | ) |
| 50 | - | ||
| 51 | -target_compile_options(ascendc_roll PRIVATE | ||
| 52 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 53 | -) | ||
Mexamples/03_simt_api/02_features/01_api_features/00_memory_access/bank_conflict/CMakeLists.txt+3-12
| @@ -10,15 +10,16 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 18 | ||
| 17 | set(SCENARIO_NUM "0" CACHE STRING "Case type to run (0-4)") | 19 | set(SCENARIO_NUM "0" CACHE STRING "Case type to run (0-4)") |
| 18 | if(NOT SCENARIO_NUM MATCHES "^[0-4]$") | 20 | if(NOT SCENARIO_NUM MATCHES "^[0-4]$") |
| 19 | message(FATAL_ERROR "SCENARIO_NUM must be one of 0, 1, 2, 3, 4, but got ${SCENARIO_NUM}") | 21 | message(FATAL_ERROR "SCENARIO_NUM must be one of 0, 1, 2, 3, 4, but got ${SCENARIO_NUM}") |
| 20 | endif() | 22 | endif() |
| 21 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 22 | 23 | ||
| 23 | add_executable(demo | 24 | add_executable(demo |
| 24 | bank_conflict.asc | 25 | bank_conflict.asc |
| @@ -28,16 +29,6 @@ target_compile_definitions(demo PRIVATE | |||
| 28 | SCENARIO_NUM=${SCENARIO_NUM} | 29 | SCENARIO_NUM=${SCENARIO_NUM} |
| 29 | ) | 30 | ) |
| 30 | 31 | ||
| 31 | -# ====================================================================================== | ||
| 32 | -# NPU 编译选项配置 | ||
| 33 | -# | ||
| 34 | -# 说明: | ||
| 35 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 36 | -# ====================================================================================== | ||
| 37 | -target_compile_options(demo PRIVATE | ||
| 38 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 39 | -) | ||
| 40 | - | ||
| 41 | target_link_libraries(demo PRIVATE | 32 | target_link_libraries(demo PRIVATE |
| 42 | m | 33 | m |
| 43 | ) | 34 | ) |
Mexamples/03_simt_api/02_features/01_api_features/00_memory_access/insert_hash_table/CMakeLists.txt+3-9
| @@ -10,26 +10,20 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 18 | ||
| 17 | set(RUN_MODE "npu" CACHE STRING "Run mode: npu, sim") | 19 | set(RUN_MODE "npu" CACHE STRING "Run mode: npu, sim") |
| 18 | set(SOC_VERSION "" CACHE STRING "Simulator SOC version, e.g. Ascend950PR_9599") | 20 | set(SOC_VERSION "" CACHE STRING "Simulator SOC version, e.g. Ascend950PR_9599") |
| 19 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 20 | 21 | ||
| 21 | add_executable(demo | 22 | add_executable(demo |
| 22 | insert_hash_table.asc | 23 | insert_hash_table.asc |
| 23 | ) | 24 | ) |
| 24 | 25 | ||
| 25 | -# ====================================================================================== | ||
| 26 | -# NPU 编译选项配置 | ||
| 27 | -# | ||
| 28 | -# 说明: | ||
| 29 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 30 | -# ====================================================================================== | ||
| 31 | target_compile_options(demo PRIVATE | 26 | target_compile_options(demo PRIVATE |
| 32 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 33 | $<BUILD_INTERFACE:$<$<STREQUAL:${RUN_MODE},sim>:-g -O0>> | 27 | $<BUILD_INTERFACE:$<$<STREQUAL:${RUN_MODE},sim>:-g -O0>> |
| 34 | ) | 28 | ) |
| 35 | 29 | ||
Mexamples/03_simt_api/02_features/01_api_features/01_sync_instruction/memory_fence/CMakeLists.txt+5-15
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,12 +10,13 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | set(SCENARIO_NUM "1" CACHE STRING "Scene number (1-2)") | 19 | set(SCENARIO_NUM "1" CACHE STRING "Scene number (1-2)") |
| 19 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 20 | 20 | ||
| 21 | if(SCENARIO_NUM EQUAL 1) | 21 | if(SCENARIO_NUM EQUAL 1) |
| 22 | set(SCENARIO_SRC sync_barrier.asc) | 22 | set(SCENARIO_SRC sync_barrier.asc) |
| @@ -27,13 +27,3 @@ endif() | |||
| 27 | add_executable(demo | 27 | add_executable(demo |
| 28 | ${SCENARIO_SRC} | 28 | ${SCENARIO_SRC} |
| 29 | ) | 29 | ) |
| 30 | - | ||
| 31 | -# ====================================================================================== | ||
| 32 | -# NPU 编译选项配置 | ||
| 33 | -# | ||
| 34 | -# 说明: | ||
| 35 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 36 | -# ====================================================================================== | ||
| 37 | -target_compile_options(demo PRIVATE | ||
| 38 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 39 | -) | ||
Mexamples/03_simt_api/02_features/01_api_features/02_atomic_operation/atomic_add_perf/CMakeLists.txt+3-6
| @@ -10,11 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 15 | project(atomic_add_perf LANGUAGES ASC CXX) | 17 | project(atomic_add_perf LANGUAGES ASC CXX) |
| 16 | 18 | ||
| 17 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 18 | set(SCENARIO_NUM "1" CACHE STRING "Scenario number (1-16)") | 19 | set(SCENARIO_NUM "1" CACHE STRING "Scenario number (1-16)") |
| 19 | option(SKIP_VALIDATION "Skip result validation for replay-based profiling tools" OFF) | 20 | option(SKIP_VALIDATION "Skip result validation for replay-based profiling tools" OFF) |
| 20 | 21 | ||
| @@ -31,10 +32,6 @@ target_compile_definitions(atomic_add_perf PRIVATE | |||
| 31 | SKIP_VALIDATION=$<BOOL:${SKIP_VALIDATION}> | 32 | SKIP_VALIDATION=$<BOOL:${SKIP_VALIDATION}> |
| 32 | ) | 33 | ) |
| 33 | 34 | ||
| 34 | -target_compile_options(atomic_add_perf PRIVATE | ||
| 35 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 36 | -) | ||
| 37 | - | ||
| 38 | target_link_libraries(atomic_add_perf PRIVATE | 35 | target_link_libraries(atomic_add_perf PRIVATE |
| 39 | m | 36 | m |
| 40 | ) | 37 | ) |
| @@ -10,20 +10,16 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | ||
| 14 | - | ||
| 15 | -project(atomic_intrinsics LANGUAGES ASC CXX) | ||
| 16 | - | ||
| 17 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | + | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 17 | +project(atomic_intrinsics LANGUAGES ASC CXX) | ||
| 18 | 18 | ||
| 19 | add_executable(atomic_intrinsics | 19 | add_executable(atomic_intrinsics |
| 20 | atomic_intrinsics.asc | 20 | atomic_intrinsics.asc |
| 21 | ) | 21 | ) |
| 22 | 22 | ||
| 23 | -target_compile_options(atomic_intrinsics PRIVATE | ||
| 24 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 25 | -) | ||
| 26 | - | ||
| 27 | target_link_libraries(atomic_intrinsics PRIVATE | 23 | target_link_libraries(atomic_intrinsics PRIVATE |
| 28 | m | 24 | m |
| 29 | ) | 25 | ) |
Mexamples/03_simt_api/02_features/01_api_features/03_warp_instruction/sobel_warp_shfl/CMakeLists.txt+4-14
| @@ -10,22 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | ||
| 14 | - | ||
| 15 | -project(kernel_samples LANGUAGES ASC CXX) | ||
| 16 | - | ||
| 17 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | + | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 17 | +project(kernel_samples LANGUAGES ASC CXX) | ||
| 18 | 18 | ||
| 19 | add_executable(demo | 19 | add_executable(demo |
| 20 | sobel_warp_shfl.asc | 20 | sobel_warp_shfl.asc |
| 21 | ) | 21 | ) |
| 22 | - | ||
| 23 | -# ====================================================================================== | ||
| 24 | -# NPU 编译选项配置 | ||
| 25 | -# | ||
| 26 | -# 说明: | ||
| 27 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 28 | -# ====================================================================================== | ||
| 29 | -target_compile_options(demo PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | -) | ||
Mexamples/03_simt_api/02_features/01_api_features/04_cooperative_groups/reduce_sum/CMakeLists.txt+4-14
| @@ -10,26 +10,16 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | ||
| 14 | - | ||
| 15 | -project(kernel_samples LANGUAGES ASC CXX) | ||
| 16 | - | ||
| 17 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | + | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 17 | +project(kernel_samples LANGUAGES ASC CXX) | ||
| 18 | 18 | ||
| 19 | add_executable(cooperative_groups | 19 | add_executable(cooperative_groups |
| 20 | reduce_sum.asc | 20 | reduce_sum.asc |
| 21 | ) | 21 | ) |
| 22 | 22 | ||
| 23 | -# ====================================================================================== | ||
| 24 | -# NPU 编译选项配置 | ||
| 25 | -# | ||
| 26 | -# 说明: | ||
| 27 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 28 | -# ====================================================================================== | ||
| 29 | -target_compile_options(cooperative_groups PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | -) | ||
| 32 | - | ||
| 33 | target_link_libraries(cooperative_groups PRIVATE | 23 | target_link_libraries(cooperative_groups PRIVATE |
| 34 | m | 24 | m |
| 35 | ) | 25 | ) |
| @@ -11,9 +11,9 @@ | |||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 15 | find_package(ASC REQUIRED) | 16 | find_package(ASC REQUIRED) |
| 16 | - | ||
| 17 | project(basic_compile LANGUAGES ASC CXX) | 17 | project(basic_compile LANGUAGES ASC CXX) |
| 18 | 18 | ||
| 19 | add_executable(demo | 19 | add_executable(demo |
| @@ -25,16 +25,6 @@ set_target_properties(demo PROPERTIES | |||
| 25 | LINKER_LANGUAGE ASC | 25 | LINKER_LANGUAGE ASC |
| 26 | ) | 26 | ) |
| 27 | 27 | ||
| 28 | -# ====================================================================================== | ||
| 29 | -# NPU 编译选项配置 | ||
| 30 | -# | ||
| 31 | -# 说明: | ||
| 32 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 33 | -# ====================================================================================== | ||
| 34 | -target_compile_options(demo PRIVATE | ||
| 35 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 36 | -) | ||
| 37 | - | ||
| 38 | target_include_directories(demo PRIVATE | 28 | target_include_directories(demo PRIVATE |
| 39 | $ENV{ASCEND_HOME_PATH}/include | 29 | $ENV{ASCEND_HOME_PATH}/include |
| 40 | ) | 30 | ) |
| @@ -62,6 +62,8 @@ bisheng host.cpp kernel.asc -o demo --npu-arch=dav-3510 --enable-simt -I${ASCEND | |||
| 62 | # 1、设置编译配置变量 | 62 | # 1、设置编译配置变量 |
| 63 | # CMAKE_ASC_ARCHITECTURES:指定NPU架构版本,本样例仅支持 dav-3510,可通过-DCMAKE_ASC_ARCHITECTURES=dav-xxxx配置 | 63 | # CMAKE_ASC_ARCHITECTURES:指定NPU架构版本,本样例仅支持 dav-3510,可通过-DCMAKE_ASC_ARCHITECTURES=dav-xxxx配置 |
| 64 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") | 64 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") |
| 65 | +# CMAKE_ASC_ENABLE_SIMT:启用SIMT编译模式 | ||
| 66 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 65 | 67 | ||
| 66 | # 2、find_package(ASC)是CMake中用于查找和配置Ascend C编译工具链的命令 | 68 | # 2、find_package(ASC)是CMake中用于查找和配置Ascend C编译工具链的命令 |
| 67 | find_package(ASC) | 69 | find_package(ASC) |
| @@ -77,18 +79,6 @@ add_executable(demo | |||
| 77 | # 5、设置链接器语言为ASC | 79 | # 5、设置链接器语言为ASC |
| 78 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) | 80 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) |
| 79 | 81 | ||
| 80 | -# 6、配置编译选项:--npu-arch指定架构版本,--enable-simt启用SIMT模式 | ||
| 81 | -target_compile_options(demo PRIVATE | ||
| 82 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt>) | ||
| 83 | -``` | ||
| 84 | - | ||
| 85 | -在后续版本,可通过设置 `CMAKE_ASC_ENABLE_SIMT` 为ON启用SIMT模式替代上述步骤6的 `--enable-simt`编译选项: | ||
| 86 | - | ||
| 87 | -```cmake | ||
| 88 | -# 启用SIMT编译模式 | ||
| 89 | -set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 90 | -``` | ||
| 91 | - | ||
| 92 | ## 编译运行 | 82 | ## 编译运行 |
| 93 | 83 | ||
| 94 | 在本样例根目录下执行如下步骤,编译并执行样例。 | 84 | 在本样例根目录下执行如下步骤,编译并执行样例。 |
| @@ -62,6 +62,8 @@ In a project, CMake can be used to more conveniently compile Ascend C SIMT opera | |||
| 62 | # 1. Set compilation configuration variables | 62 | # 1. Set compilation configuration variables |
| 63 | # CMAKE_ASC_ARCHITECTURES: Specify NPU architecture version, this example only supports dav-3510, configurable via -DCMAKE_ASC_ARCHITECTURES=dav-xxxx | 63 | # CMAKE_ASC_ARCHITECTURES: Specify NPU architecture version, this example only supports dav-3510, configurable via -DCMAKE_ASC_ARCHITECTURES=dav-xxxx |
| 64 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") | 64 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") |
| 65 | +# CMAKE_ASC_ENABLE_SIMT: Enable SIMT compilation mode | ||
| 66 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 65 | 67 | ||
| 66 | # 2. find_package(ASC) is the CMake command for finding and configuring the Ascend C compilation toolchain | 68 | # 2. find_package(ASC) is the CMake command for finding and configuring the Ascend C compilation toolchain |
| 67 | find_package(ASC) | 69 | find_package(ASC) |
| @@ -77,18 +79,6 @@ add_executable(demo | |||
| 77 | # 5. Set linker language to ASC | 79 | # 5. Set linker language to ASC |
| 78 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) | 80 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) |
| 79 | 81 | ||
| 80 | -# 6. Configure compilation options: --npu-arch specifies architecture version, --enable-simt enables SIMT mode | ||
| 81 | -target_compile_options(demo PRIVATE | ||
| 82 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt>) | ||
| 83 | -``` | ||
| 84 | - | ||
| 85 | -In future versions, SIMT mode can be enabled by setting `CMAKE_ASC_ENABLE_SIMT` to ON instead of the `--enable-simt` compilation option in step 6 above: | ||
| 86 | - | ||
| 87 | -```cmake | ||
| 88 | -# Enable SIMT compilation mode | ||
| 89 | -set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 90 | -``` | ||
| 91 | - | ||
| 92 | ## Build and Run | 82 | ## Build and Run |
| 93 | 83 | ||
| 94 | Run the following steps in the root directory of this example to build and execute the example. | 84 | Run the following steps in the root directory of this example to build and execute the example. |
| @@ -11,9 +11,9 @@ | |||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 15 | find_package(ASC REQUIRED) | 16 | find_package(ASC REQUIRED) |
| 16 | - | ||
| 17 | project(separate_compile LANGUAGES ASC CXX) | 17 | project(separate_compile LANGUAGES ASC CXX) |
| 18 | 18 | ||
| 19 | add_executable(demo | 19 | add_executable(demo |
| @@ -26,14 +26,8 @@ set_target_properties(demo PROPERTIES | |||
| 26 | LINKER_LANGUAGE ASC | 26 | LINKER_LANGUAGE ASC |
| 27 | ) | 27 | ) |
| 28 | 28 | ||
| 29 | -# ====================================================================================== | ||
| 30 | -# NPU 编译选项配置 | ||
| 31 | -# | ||
| 32 | -# 说明: | ||
| 33 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 34 | -# ====================================================================================== | ||
| 35 | target_compile_options(demo PRIVATE | 29 | target_compile_options(demo PRIVATE |
| 36 | - $<$<COMPILE_LANGUAGE:ASC>:-dc --npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | 30 | + $<$<COMPILE_LANGUAGE:ASC>:-dc> |
| 37 | ) | 31 | ) |
| 38 | 32 | ||
| 39 | target_include_directories(demo PRIVATE | 33 | target_include_directories(demo PRIVATE |
| @@ -66,6 +66,8 @@ bisheng gather_compute.o gather_kernel.o main.o -o demo | |||
| 66 | # 1、设置编译配置变量 | 66 | # 1、设置编译配置变量 |
| 67 | # CMAKE_ASC_ARCHITECTURES:指定NPU架构版本,本样例仅支持 dav-3510,可通过-DCMAKE_ASC_ARCHITECTURES=dav-xxxx配置 | 67 | # CMAKE_ASC_ARCHITECTURES:指定NPU架构版本,本样例仅支持 dav-3510,可通过-DCMAKE_ASC_ARCHITECTURES=dav-xxxx配置 |
| 68 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") | 68 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") |
| 69 | +# CMAKE_ASC_ENABLE_SIMT:启用SIMT编译模式 | ||
| 70 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 69 | 71 | ||
| 70 | # 2、find_package(ASC)是CMake中用于查找和配置Ascend C编译工具链的命令 | 72 | # 2、find_package(ASC)是CMake中用于查找和配置Ascend C编译工具链的命令 |
| 71 | find_package(ASC) | 73 | find_package(ASC) |
| @@ -82,17 +84,12 @@ add_executable(demo | |||
| 82 | # 5、设置链接器语言为ASC | 84 | # 5、设置链接器语言为ASC |
| 83 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) | 85 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) |
| 84 | 86 | ||
| 85 | -# 6、配置编译选项:-dc启用单独编译,--npu-arch指定架构版本,--enable-simt启用SIMT模式 | 87 | +# 6、配置编译选项:-dc启用单独编译 |
| 86 | target_compile_options(demo PRIVATE | 88 | target_compile_options(demo PRIVATE |
| 87 | - $<$<COMPILE_LANGUAGE:ASC>:-dc --npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt>) | 89 | + $<$<COMPILE_LANGUAGE:ASC>:-dc>) |
| 88 | ``` | 90 | ``` |
| 89 | 91 | ||
| 90 | -在后续版本,可通过设置 `CMAKE_ASC_ENABLE_SIMT` 为ON启用SIMT模式替代上述步骤6的 `--enable-simt` 编译选项: | ||
| 91 | 92 | ||
| 92 | -```cmake | ||
| 93 | -# 启用SIMT编译模式 | ||
| 94 | -set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 95 | -``` | ||
| 96 | 93 | ||
| 97 | ## 编译运行 | 94 | ## 编译运行 |
| 98 | 95 | ||
| @@ -66,6 +66,8 @@ In a project, CMake can be used to more conveniently compile Ascend C SIMT opera | |||
| 66 | # 1. Set compilation configuration variables | 66 | # 1. Set compilation configuration variables |
| 67 | # CMAKE_ASC_ARCHITECTURES: Specify NPU architecture version, this example only supports dav-3510, configurable via -DCMAKE_ASC_ARCHITECTURES=dav-xxxx | 67 | # CMAKE_ASC_ARCHITECTURES: Specify NPU architecture version, this example only supports dav-3510, configurable via -DCMAKE_ASC_ARCHITECTURES=dav-xxxx |
| 68 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") | 68 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") |
| 69 | +# CMAKE_ASC_ENABLE_SIMT: Enable SIMT compilation mode | ||
| 70 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 69 | 71 | ||
| 70 | # 2. find_package(ASC) is the CMake command for finding and configuring the Ascend C compilation toolchain | 72 | # 2. find_package(ASC) is the CMake command for finding and configuring the Ascend C compilation toolchain |
| 71 | find_package(ASC) | 73 | find_package(ASC) |
| @@ -82,17 +84,12 @@ add_executable(demo | |||
| 82 | # 5. Set linker language to ASC | 84 | # 5. Set linker language to ASC |
| 83 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) | 85 | set_target_properties(demo PROPERTIES LINKER_LANGUAGE ASC) |
| 84 | 86 | ||
| 85 | -# 6. Configure compilation options: -dc enables separate compilation, --npu-arch specifies architecture version, --enable-simt enables SIMT mode | 87 | +# 6. Configure compilation options: -dc enables separate compilation |
| 86 | target_compile_options(demo PRIVATE | 88 | target_compile_options(demo PRIVATE |
L 级别:一般 问题:README still keeps --npu-arch in target_compile_options, but CMakeLists.txt removed it and only keeps -dc 影响:Users following the README would add redundant --npu-arch, inconsistent with actual CMakeLists.txt 修复建议:Remove --npu-arch from README's target_compile_options to match CMakeLists.txt ![]() ![]() | |||
| 87 | - $<$<COMPILE_LANGUAGE:ASC>:-dc --npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt>) | 89 | + $<$<COMPILE_LANGUAGE:ASC>:-dc>) |
| 88 | ``` | 90 | ``` |
| 89 | 91 | ||
| 90 | -In future versions, SIMT mode can be enabled by setting `CMAKE_ASC_ENABLE_SIMT` to ON instead of the `--enable-simt` compilation option in step 6 above: | ||
| 91 | 92 | ||
| 92 | -```cmake | ||
| 93 | -# Enable SIMT compilation mode | ||
| 94 | -set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 95 | -``` | ||
| 96 | 93 | ||
| 97 | ## Build and Run | 94 | ## Build and Run |
| 98 | 95 | ||
| @@ -11,9 +11,9 @@ | |||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 15 | find_package(ASC REQUIRED) | 16 | find_package(ASC REQUIRED) |
| 16 | - | ||
| 17 | project(dynamic_library_compile LANGUAGES ASC CXX) | 17 | project(dynamic_library_compile LANGUAGES ASC CXX) |
| 18 | 18 | ||
| 19 | add_library(gather_kernel SHARED | 19 | add_library(gather_kernel SHARED |
| @@ -28,16 +28,6 @@ set_target_properties(demo PROPERTIES | |||
| 28 | LINKER_LANGUAGE ASC | 28 | LINKER_LANGUAGE ASC |
| 29 | ) | 29 | ) |
| 30 | 30 | ||
| 31 | -# ====================================================================================== | ||
| 32 | -# NPU 编译选项配置 | ||
| 33 | -# | ||
| 34 | -# 说明: | ||
| 35 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 36 | -# ====================================================================================== | ||
| 37 | -target_compile_options(gather_kernel PRIVATE | ||
| 38 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 39 | -) | ||
| 40 | - | ||
| 41 | target_include_directories(demo PRIVATE | 31 | target_include_directories(demo PRIVATE |
| 42 | $ENV{ASCEND_HOME_PATH}/include | 32 | $ENV{ASCEND_HOME_PATH}/include |
| 43 | ) | 33 | ) |
| @@ -53,6 +53,8 @@ bisheng -shared kernel.asc -o libkernel.so -fPIC --npu-arch=dav-3510 --enable-si | |||
| 53 | 在 CMake 工程中,使用 `add_library` 配置 `SHARED` 关键字即可将 `.asc` 文件编译为动态共享库: | 53 | 在 CMake 工程中,使用 `add_library` 配置 `SHARED` 关键字即可将 `.asc` 文件编译为动态共享库: |
| 54 | 54 | ||
| 55 | ```cmake | 55 | ```cmake |
| 56 | +# 启用SIMT编译模式 | ||
| 57 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 56 | # 将.asc文件编译为动态共享库 | 58 | # 将.asc文件编译为动态共享库 |
| 57 | add_library(gather_kernel SHARED | 59 | add_library(gather_kernel SHARED |
| 58 | gather_kernel.asc | 60 | gather_kernel.asc |
| @@ -53,6 +53,8 @@ For more bisheng compilation options and usage, refer to [AI-Core Operator Compi | |||
| 53 | In a CMake project, use `add_library` with the `SHARED` keyword to compile `.asc` files into a dynamic shared library: | 53 | In a CMake project, use `add_library` with the `SHARED` keyword to compile `.asc` files into a dynamic shared library: |
| 54 | 54 | ||
| 55 | ```cmake | 55 | ```cmake |
| 56 | +# Enable SIMT compilation mode | ||
| 57 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 56 | # Compile .asc file into a dynamic shared library | 58 | # Compile .asc file into a dynamic shared library |
| 57 | add_library(gather_kernel SHARED | 59 | add_library(gather_kernel SHARED |
| 58 | gather_kernel.asc | 60 | gather_kernel.asc |
| @@ -11,9 +11,9 @@ | |||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 15 | ||
| 15 | find_package(ASC REQUIRED) | 16 | find_package(ASC REQUIRED) |
| 16 | - | ||
| 17 | project(static_library_compile LANGUAGES ASC CXX) | 17 | project(static_library_compile LANGUAGES ASC CXX) |
| 18 | 18 | ||
| 19 | add_library(gather_kernel STATIC | 19 | add_library(gather_kernel STATIC |
| @@ -28,16 +28,6 @@ set_target_properties(demo PROPERTIES | |||
| 28 | LINKER_LANGUAGE ASC | 28 | LINKER_LANGUAGE ASC |
| 29 | ) | 29 | ) |
| 30 | 30 | ||
| 31 | -# ====================================================================================== | ||
| 32 | -# NPU 编译选项配置 | ||
| 33 | -# | ||
| 34 | -# 说明: | ||
| 35 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 36 | -# ====================================================================================== | ||
| 37 | -target_compile_options(gather_kernel PRIVATE | ||
| 38 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 39 | -) | ||
| 40 | - | ||
| 41 | target_include_directories(demo PRIVATE | 31 | target_include_directories(demo PRIVATE |
| 42 | $ENV{ASCEND_HOME_PATH}/include | 32 | $ENV{ASCEND_HOME_PATH}/include |
| 43 | ) | 33 | ) |
| @@ -53,6 +53,8 @@ bisheng -lib kernel.asc -o libkernel.a --npu-arch=dav-3510 --enable-simt | |||
| 53 | 在 CMake 工程中,使用 `add_library` 配置 `STATIC` 关键字即可将 `.asc` 文件编译为静态库: | 53 | 在 CMake 工程中,使用 `add_library` 配置 `STATIC` 关键字即可将 `.asc` 文件编译为静态库: |
| 54 | 54 | ||
| 55 | ```cmake | 55 | ```cmake |
| 56 | +# 启用SIMT编译模式 | ||
| 57 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 56 | # 将.asc文件编译为静态库 | 58 | # 将.asc文件编译为静态库 |
| 57 | add_library(kernel STATIC | 59 | add_library(kernel STATIC |
| 58 | kernel.asc) | 60 | kernel.asc) |
| @@ -53,6 +53,8 @@ For more bisheng compilation options and usage, refer to [AI-Core Operator Compi | |||
| 53 | In a CMake project, use `add_library` with the `STATIC` keyword to compile `.asc` files into a static library: | 53 | In a CMake project, use `add_library` with the `STATIC` keyword to compile `.asc` files into a static library: |
| 54 | 54 | ||
| 55 | ```cmake | 55 | ```cmake |
| 56 | +# Enable SIMT compilation mode | ||
| 57 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 56 | # Compile .asc file into a static library | 58 | # Compile .asc file into a static library |
| 57 | add_library(kernel STATIC | 59 | add_library(kernel STATIC |
| 58 | kernel.asc) | 60 | kernel.asc) |
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -12,15 +11,11 @@ | |||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | find_package(ASC REQUIRED) | 16 | find_package(ASC REQUIRED) |
| 17 | - | ||
| 18 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 19 | 18 | ||
| 20 | add_executable(demo | 19 | add_executable(demo |
| 21 | aligned_types.asc | 20 | aligned_types.asc |
| 22 | ) | 21 | ) |
| 23 | - | ||
| 24 | -target_compile_options(demo PRIVATE | ||
| 25 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 26 | -) | ||
| @@ -1,22 +1,21 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | # See LICENSE in the root of the software repository for the full text of the License. | 8 | # See LICENSE in the root of the software repository for the full text of the License. |
| 10 | # ---------------------------------------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------------------------------------- |
| 11 | 10 | ||
| 12 | - | ||
| 13 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 14 | 12 | ||
| 15 | set(SCENARIO_NUM 0 CACHE STRING "Case type to run (0-1)") | 13 | set(SCENARIO_NUM 0 CACHE STRING "Case type to run (0-1)") |
| 14 | + | ||
| 16 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 15 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 16 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 17 | 17 | ||
| 18 | find_package(ASC REQUIRED) | 18 | find_package(ASC REQUIRED) |
| 19 | - | ||
| 20 | project(kernel_samples LANGUAGES ASC CXX) | 19 | project(kernel_samples LANGUAGES ASC CXX) |
| 21 | 20 | ||
| 22 | add_executable(data_cache_hint | 21 | add_executable(data_cache_hint |
| @@ -30,7 +29,3 @@ target_compile_definitions(data_cache_hint PRIVATE | |||
| 30 | target_link_libraries(data_cache_hint PRIVATE | 29 | target_link_libraries(data_cache_hint PRIVATE |
| 31 | m | 30 | m |
| 32 | ) | 31 | ) |
| 33 | - | ||
| 34 | -target_compile_options(data_cache_hint PRIVATE | ||
| 35 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 36 | -) | ||
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,12 +10,13 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | set(SCENARIO_NUM "7" CACHE STRING "Case type to run (0-7)") | 19 | set(SCENARIO_NUM "7" CACHE STRING "Case type to run (0-7)") |
| 19 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 20 | 20 | ||
| 21 | add_executable(matrix_transpose | 21 | add_executable(matrix_transpose |
| 22 | matrix_transpose.asc | 22 | matrix_transpose.asc |
| @@ -26,12 +26,6 @@ target_compile_definitions(matrix_transpose PRIVATE | |||
| 26 | SCENARIO_NUM=${SCENARIO_NUM} | 26 | SCENARIO_NUM=${SCENARIO_NUM} |
| 27 | ) | 27 | ) |
| 28 | 28 | ||
| 29 | -# ====================================================================================== | ||
| 30 | -# NPU 编译选项配置 | ||
| 31 | -# | ||
| 32 | -# 说明: | ||
| 33 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 34 | -# ====================================================================================== | ||
| 35 | target_compile_options(matrix_transpose PRIVATE | 29 | target_compile_options(matrix_transpose PRIVATE |
| 36 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt --cce-res-usage> | 30 | + $<$<COMPILE_LANGUAGE:ASC>:--cce-res-usage> |
| 37 | ) | 31 | ) |
| @@ -10,6 +10,9 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | ||
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | + | ||
| 13 | find_package(ASC REQUIRED) | 16 | find_package(ASC REQUIRED) |
| 14 | 17 | ||
| 15 | set(PROJECT_NAME "kernel_samples" CACHE STRING "Project name") | 18 | set(PROJECT_NAME "kernel_samples" CACHE STRING "Project name") |
| @@ -31,8 +34,3 @@ set(TARGET_FILENAME "demo" CACHE STRING "Execution file name") | |||
| 31 | add_executable(${TARGET_FILENAME} | 34 | add_executable(${TARGET_FILENAME} |
| 32 | ${CMAKE_CURRENT_SOURCE_DIR}/short_vector_add.asc | 35 | ${CMAKE_CURRENT_SOURCE_DIR}/short_vector_add.asc |
| 33 | ) | 36 | ) |
| 34 | - | ||
| 35 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | ||
| 36 | -target_compile_options(${TARGET_FILENAME} PRIVATE | ||
| 37 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 38 | -) | ||
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,12 +10,13 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | set(SCENARIO_NUM "1" CACHE STRING "Scenario number (1-13)") | 19 | set(SCENARIO_NUM "1" CACHE STRING "Scenario number (1-13)") |
| 19 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 20 | 20 | ||
| 21 | add_executable(grid_config | 21 | add_executable(grid_config |
| 22 | grid_config.asc | 22 | grid_config.asc |
| @@ -25,7 +25,3 @@ add_executable(grid_config | |||
| 25 | target_compile_definitions(grid_config PRIVATE | 25 | target_compile_definitions(grid_config PRIVATE |
| 26 | SCENARIO_NUM=${SCENARIO_NUM} | 26 | SCENARIO_NUM=${SCENARIO_NUM} |
| 27 | ) | 27 | ) |
| 28 | - | ||
| 29 | -target_compile_options(grid_config PRIVATE | ||
| 30 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 31 | -) | ||
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,25 +10,18 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 15 | ||
| 16 | +find_package(ASC REQUIRED) | ||
| 16 | project(kernel_samples LANGUAGES ASC CXX) | 17 | project(kernel_samples LANGUAGES ASC CXX) |
| 17 | 18 | ||
| 18 | add_executable(sincos_compute | 19 | add_executable(sincos_compute |
| 19 | sincos_compute.asc | 20 | sincos_compute.asc |
| 20 | ) | 21 | ) |
| 21 | 22 | ||
| 22 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 23 | - | ||
| 24 | -# ====================================================================================== | ||
| 25 | -# NPU 编译选项配置 | ||
| 26 | -# | ||
| 27 | -# 说明: | ||
| 28 | -# - 需根据实际部署的 NPU 硬件架构选择对应的 `npu-arch` 参数。 | ||
| 29 | -# ====================================================================================== | ||
| 30 | target_compile_options(sincos_compute PRIVATE | 23 | target_compile_options(sincos_compute PRIVATE |
| 31 | --cce-res-usage | 24 | --cce-res-usage |
| 32 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 33 | ) | 25 | ) |
| 34 | 26 | ||
| 35 | target_link_libraries(sincos_compute PRIVATE | 27 | target_link_libraries(sincos_compute PRIVATE |
| @@ -1,22 +1,21 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| 9 | # See LICENSE in the root of the software repository for the full text of the License. | 8 | # See LICENSE in the root of the software repository for the full text of the License. |
| 10 | # ---------------------------------------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------------------------------------- |
| 11 | 10 | ||
| 12 | - | ||
| 13 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 14 | 12 | ||
| 15 | set(SCENARIO_NUM 1 CACHE STRING "Case type to run (1-2)") | 13 | set(SCENARIO_NUM 1 CACHE STRING "Case type to run (1-2)") |
| 14 | + | ||
| 16 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 15 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 16 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 17 | 17 | ||
| 18 | find_package(ASC REQUIRED) | 18 | find_package(ASC REQUIRED) |
| 19 | - | ||
| 20 | project(kernel_samples LANGUAGES ASC CXX) | 19 | project(kernel_samples LANGUAGES ASC CXX) |
| 21 | 20 | ||
| 22 | add_executable(demo | 21 | add_executable(demo |
| @@ -30,7 +29,3 @@ target_compile_definitions(demo PRIVATE | |||
| 30 | target_link_libraries(demo PRIVATE | 29 | target_link_libraries(demo PRIVATE |
| 31 | m | 30 | m |
| 32 | ) | 31 | ) |
| 33 | - | ||
| 34 | -target_compile_options(demo PRIVATE | ||
| 35 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 36 | -) | ||
Mexamples/03_simt_api/03_best_practices/03_instruction_optimizations/atomic_histogram/CMakeLists.txt+5-16
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -10,28 +9,18 @@ | |||
| 10 | # ---------------------------------------------------------------------------------------------------------- | 9 | # ---------------------------------------------------------------------------------------------------------- |
| 11 | cmake_minimum_required(VERSION 3.16) | 10 | cmake_minimum_required(VERSION 3.16) |
| 12 | 11 | ||
| 13 | -find_package(ASC REQUIRED) | 12 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 13 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 14 | 14 | ||
| 15 | +find_package(ASC REQUIRED) | ||
| 15 | project(histogram LANGUAGES ASC CXX) | 16 | project(histogram LANGUAGES ASC CXX) |
| 16 | 17 | ||
| 17 | add_executable(histogram | 18 | add_executable(histogram |
| 18 | histogram.asc | 19 | histogram.asc |
| 19 | ) | 20 | ) |
| 20 | 21 | ||
| 21 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 22 | - | ||
| 23 | option(SKIP_VALIDATION "Skip result validation for replay-based profiling tools" OFF) | 22 | option(SKIP_VALIDATION "Skip result validation for replay-based profiling tools" OFF) |
| 24 | 23 | ||
| 25 | -# ====================================================================================== | ||
| 26 | -# NPU编译选项配置 | ||
| 27 | -# | ||
| 28 | -# 说明: | ||
| 29 | -# - 需根据实际部署的NPU硬件架构选择对应的`npu-arch`参数。 | ||
| 30 | -# ====================================================================================== | ||
| 31 | -target_compile_options(histogram PRIVATE | ||
| 32 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt> | ||
| 33 | -) | ||
| 34 | - | ||
| 35 | target_compile_definitions(histogram PRIVATE | 24 | target_compile_definitions(histogram PRIVATE |
| 36 | SKIP_VALIDATION=$<BOOL:${SKIP_VALIDATION}> | 25 | SKIP_VALIDATION=$<BOOL:${SKIP_VALIDATION}> |
| 37 | ) | 26 | ) |
| @@ -11,10 +11,11 @@ | |||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | set(SCENARIO_NUM 1 CACHE STRING "Case type to run (1-4)") | 13 | set(SCENARIO_NUM 1 CACHE STRING "Case type to run (1-4)") |
| 14 | + | ||
| 14 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | 15 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 16 | +set(CMAKE_ASC_ENABLE_SIMT ON) | ||
| 15 | 17 | ||
| 16 | find_package(ASC REQUIRED) | 18 | find_package(ASC REQUIRED) |
| 17 | - | ||
| 18 | project(kernel_samples LANGUAGES ASC CXX) | 19 | project(kernel_samples LANGUAGES ASC CXX) |
| 19 | 20 | ||
| 20 | add_executable(demo | 21 | add_executable(demo |
| @@ -28,7 +29,7 @@ target_compile_definitions(demo PRIVATE | |||
| 28 | ) | 29 | ) |
| 29 | 30 | ||
| 30 | target_compile_options(demo PRIVATE | 31 | target_compile_options(demo PRIVATE |
| 31 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --enable-simt --cce-res-usage> | 32 | + $<$<COMPILE_LANGUAGE:ASC>:--cce-res-usage> |
| 32 | ) | 33 | ) |
| 33 | 34 | ||
| 34 | target_link_libraries(demo PRIVATE | 35 | target_link_libraries(demo PRIVATE |
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -31,7 +30,6 @@ add_executable(demo | |||
| 31 | ) | 30 | ) |
| 32 | 31 | ||
| 33 | target_compile_options(demo PRIVATE | 32 | target_compile_options(demo PRIVATE |
| 34 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES}> | ||
| 35 | $<BUILD_INTERFACE:$<$<STREQUAL:${CMAKE_ASC_RUN_MODE},sim>:-g -O0>> | 33 | $<BUILD_INTERFACE:$<$<STREQUAL:${CMAKE_ASC_RUN_MODE},sim>:-g -O0>> |
| 36 | $<BUILD_INTERFACE:$<$<STREQUAL:${CMAKE_ASC_RUN_MODE},cpu>:-x c++>> | 34 | $<BUILD_INTERFACE:$<$<STREQUAL:${CMAKE_ASC_RUN_MODE},cpu>:-x c++>> |
| 37 | $<BUILD_INTERFACE:$<$<STREQUAL:${CMAKE_ASC_RUN_MODE},cpu>:-g -O2 -std=c++17 -D_GLIBCXX_USE_CXX11_ABI=0 -Wall -Werror>> | 35 | $<BUILD_INTERFACE:$<$<STREQUAL:${CMAKE_ASC_RUN_MODE},cpu>:-g -O2 -std=c++17 -D_GLIBCXX_USE_CXX11_ABI=0 -Wall -Werror>> |
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,12 +10,11 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | ||
| 15 | - | ||
| 16 | -project(kernel_samples LANGUAGES ASC CXX) | ||
| 17 | - | ||
| 18 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") |
| 19 | 14 | ||
| 15 | +find_package(ASC REQUIRED) | ||
| 16 | +project(kernel_samples LANGUAGES ASC CXX) | ||
| 17 | + | ||
| 20 | set(SCENARIO_NUM "3" CACHE STRING "Scenario number (0-14)") | 18 | set(SCENARIO_NUM "3" CACHE STRING "Scenario number (0-14)") |
| 21 | if(NOT SCENARIO_NUM MATCHES "^([0-9]|1[0-4])$") | 19 | if(NOT SCENARIO_NUM MATCHES "^([0-9]|1[0-4])$") |
| 22 | message(FATAL_ERROR "SCENARIO_NUM must be one of 0-14.") | 20 | message(FATAL_ERROR "SCENARIO_NUM must be one of 0-14.") |
| @@ -39,9 +37,6 @@ add_executable(ub_usage_limit | |||
| 39 | ${CASE_SOURCE} | 37 | ${CASE_SOURCE} |
| 40 | ) | 38 | ) |
| 41 | 39 | ||
| 42 | -target_compile_options(ub_usage_limit PRIVATE | ||
| 43 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES}> | ||
| 44 | -) | ||
| 45 | target_compile_definitions(ub_usage_limit PRIVATE | 40 | target_compile_definitions(ub_usage_limit PRIVATE |
| 46 | SCENARIO_NUM=${SCENARIO_NUM} | 41 | SCENARIO_NUM=${SCENARIO_NUM} |
| 47 | ) | 42 | ) |
| @@ -1,8 +1,7 @@ | |||
| 1 | # ---------------------------------------------------------------------------------------------------------- | 1 | # ---------------------------------------------------------------------------------------------------------- |
| 2 | -# This program is free software, you can redistribute it and/or modify it. | ||
| 3 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. | 2 | # Copyright (c) 2026 Huawei Technologies Co., Ltd. |
| 4 | -# This file is a part of the CANN Open Software. | 3 | +# This program is free software, you can redistribute it and/or modify it under the terms and conditions of |
| 5 | -# Licensed under CANN Open Software License Agreement Version 2.0 (the "License"). | 4 | +# CANN Open Software License Agreement Version 2.0 (the "License"). |
| 6 | # Please refer to the License for details. You may not use this file except in compliance with the License. | 5 | # Please refer to the License for details. You may not use this file except in compliance with the License. |
| 7 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | 6 | # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, |
| 8 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | 7 | # INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. |
| @@ -11,12 +10,11 @@ | |||
| 11 | 10 | ||
| 12 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 13 | 12 | ||
| 14 | -find_package(ASC REQUIRED) | ||
| 15 | - | ||
| 16 | -project(kernel_samples LANGUAGES ASC CXX) | ||
| 17 | - | ||
| 18 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") | 13 | set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture") |
| 19 | 14 | ||
| 15 | +find_package(ASC REQUIRED) | ||
| 16 | +project(kernel_samples LANGUAGES ASC CXX) | ||
| 17 | + | ||
| 20 | set(SCENARIO_NUM "1" CACHE STRING "Scenario number (1-16)") | 18 | set(SCENARIO_NUM "1" CACHE STRING "Scenario number (1-16)") |
| 21 | 19 | ||
| 22 | add_executable(grid_config | 20 | add_executable(grid_config |
| @@ -26,7 +24,3 @@ add_executable(grid_config | |||
| 26 | target_compile_definitions(grid_config PRIVATE | 24 | target_compile_definitions(grid_config PRIVATE |
| 27 | SCENARIO_NUM=${SCENARIO_NUM} | 25 | SCENARIO_NUM=${SCENARIO_NUM} |
| 28 | ) | 26 | ) |
| 29 | - | ||
| 30 | -target_compile_options(grid_config PRIVATE | ||
| 31 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES}> | ||
| 32 | -) | ||
| @@ -10,14 +10,14 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") | ||
| 14 | set(SCENARIO_NUM "0" CACHE STRING "Scenario: 0=SIMT-GroupInsertOrAssign, 1=MTE-TaskQueue") | 13 | set(SCENARIO_NUM "0" CACHE STRING "Scenario: 0=SIMT-GroupInsertOrAssign, 1=MTE-TaskQueue") |
| 15 | if (NOT SCENARIO_NUM MATCHES "^[0-1]$") | 14 | if (NOT SCENARIO_NUM MATCHES "^[0-1]$") |
| 16 | message(FATAL_ERROR "SCENARIO_NUM must be 0 or 1") | 15 | message(FATAL_ERROR "SCENARIO_NUM must be 0 or 1") |
| 17 | endif() | 16 | endif() |
| 18 | 17 | ||
| 19 | -find_package(ASC REQUIRED) | 18 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU architecture: dav-3510") |
| 20 | 19 | ||
| 20 | +find_package(ASC REQUIRED) | ||
| 21 | project(hash_table_mte_queue LANGUAGES ASC CXX) | 21 | project(hash_table_mte_queue LANGUAGES ASC CXX) |
| 22 | 22 | ||
| 23 | add_executable(hash_table_mte_queue | 23 | add_executable(hash_table_mte_queue |
| @@ -29,7 +29,3 @@ message(STATUS "[INFO] SCENARIO_NUM is ${SCENARIO_NUM} (0=SIMT-GroupInsertOrAssi | |||
| 29 | target_compile_definitions(hash_table_mte_queue PRIVATE | 29 | target_compile_definitions(hash_table_mte_queue PRIVATE |
| 30 | SCENARIO_NUM=${SCENARIO_NUM} | 30 | SCENARIO_NUM=${SCENARIO_NUM} |
| 31 | ) | 31 | ) |
| 32 | - | ||
| 33 | -target_compile_options(hash_table_mte_queue PRIVATE | ||
| 34 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES}> | ||
| 35 | -) | ||
| @@ -18,7 +18,6 @@ if (NOT SCENARIO_NUM MATCHES "^[0-3]$") | |||
| 18 | endif() | 18 | endif() |
| 19 | 19 | ||
| 20 | find_package(ASC REQUIRED) | 20 | find_package(ASC REQUIRED) |
| 21 | - | ||
| 22 | project(kernel_samples LANGUAGES ASC CXX) | 21 | project(kernel_samples LANGUAGES ASC CXX) |
| 23 | 22 | ||
| 24 | add_executable(demo | 23 | add_executable(demo |
| @@ -30,7 +29,3 @@ message(STATUS "[INFO] SCENARIO_NUM is ${SCENARIO_NUM} (0=SIMT-DirectGM, 1=SIMD, | |||
| 30 | target_compile_definitions(demo PRIVATE | 29 | target_compile_definitions(demo PRIVATE |
| 31 | SCENARIO_NUM=${SCENARIO_NUM} | 30 | SCENARIO_NUM=${SCENARIO_NUM} |
| 32 | ) | 31 | ) |
| 33 | - | ||
| 34 | -target_compile_options(demo PRIVATE | ||
| 35 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES}> | ||
| 36 | -) | ||
| @@ -10,12 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | 14 | ||
| 15 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 16 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 17 | ||
| 17 | set(SCENARIO_NUM "0" CACHE STRING "Case type to run: 0 normal, 1 fast") | 18 | set(SCENARIO_NUM "0" CACHE STRING "Case type to run: 0 normal, 1 fast") |
| 18 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 19 | 19 | ||
| 20 | add_executable(integer_div | 20 | add_executable(integer_div |
| 21 | integer_div.asc | 21 | integer_div.asc |
| @@ -25,10 +25,6 @@ target_compile_definitions(integer_div PRIVATE | |||
| 25 | SCENARIO_NUM=${SCENARIO_NUM} | 25 | SCENARIO_NUM=${SCENARIO_NUM} |
| 26 | ) | 26 | ) |
| 27 | 27 | ||
| 28 | -target_compile_options(integer_div PRIVATE | ||
| 29 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES}> | ||
| 30 | -) | ||
| 31 | - | ||
| 32 | target_link_libraries(integer_div PRIVATE | 28 | target_link_libraries(integer_div PRIVATE |
| 33 | m | 29 | m |
| 34 | ) | 30 | ) |
| @@ -10,12 +10,12 @@ | |||
| 10 | 10 | ||
| 11 | cmake_minimum_required(VERSION 3.16) | 11 | cmake_minimum_required(VERSION 3.16) |
| 12 | 12 | ||
| 13 | -find_package(ASC REQUIRED) | 13 | +set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") |
| 14 | 14 | ||
| 15 | +find_package(ASC REQUIRED) | ||
| 15 | project(kernel_samples LANGUAGES ASC CXX) | 16 | project(kernel_samples LANGUAGES ASC CXX) |
| 16 | 17 | ||
| 17 | set(SCENARIO_NUM "4" CACHE STRING "Case type to run (0-4)") | 18 | set(SCENARIO_NUM "4" CACHE STRING "Case type to run (0-4)") |
| 18 | -set(CMAKE_ASC_ARCHITECTURES "dav-3510" CACHE STRING "NPU ARCH, e.g. dav-3510") | ||
| 19 | 19 | ||
| 20 | if(NOT SCENARIO_NUM MATCHES "^[0-4]$") | 20 | if(NOT SCENARIO_NUM MATCHES "^[0-4]$") |
| 21 | message(FATAL_ERROR "SCENARIO_NUM must be one of 0, 1, 2, 3, 4.") | 21 | message(FATAL_ERROR "SCENARIO_NUM must be one of 0, 1, 2, 3, 4.") |
| @@ -37,7 +37,7 @@ target_compile_definitions(matrix_transpose PRIVATE | |||
| 37 | # - `--cce-res-usage`用于输出寄存器和栈等编译资源信息,便于分析资源使用。 | 37 | # - `--cce-res-usage`用于输出寄存器和栈等编译资源信息,便于分析资源使用。 |
| 38 | # ====================================================================================== | 38 | # ====================================================================================== |
| 39 | target_compile_options(matrix_transpose PRIVATE | 39 | target_compile_options(matrix_transpose PRIVATE |
| 40 | - $<$<COMPILE_LANGUAGE:ASC>:--npu-arch=${CMAKE_ASC_ARCHITECTURES} --cce-res-usage> | 40 | + $<$<COMPILE_LANGUAGE:ASC>:--cce-res-usage> |
| 41 | ) | 41 | ) |
| 42 | 42 | ||
| 43 | target_link_libraries(matrix_transpose PRIVATE | 43 | target_link_libraries(matrix_transpose PRIVATE |


级别:提示 问题:仅部分示例 README 更新了 CANN 版本要求至 9.1.0,其他示例(如 hello_world_simt、printf 等)未更新 影响:用户可能使用 CANN 9.0.0 编译其他示例但遇到 CMAKE_ASC_ENABLE_SIMT 不被支持的兼容性问题 修复建议:统一更新所有涉及 CMAKE_ASC_ENABLE_SIMT 变更的示例 README 中的 CANN 版本要求