已合并
算子直调+aclgraph示例代码readme增加编译选项说明 #4081
mihudan创建于 1月20日
算子直调+aclgraph示例代码readme增加编译选项说明 #4081
已合并
mihudan创建于 1月20日
4 个文件变更+16-5
Mexamples/kernel_extension_aclgraph/pybind/README.md+4-2
@@ -127,8 +127,8 @@
1271. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch1271. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch
128 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。128 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。
129 129
130- 本样例需torch2.6.0版本以上,支持`backend="npugraph_ex"`需7.3.0版本以上。130+ 本样例需torch2.6.0以上版本,支持`backend="npugraph_ex"`需7.3.0以上版本
131-2. 根据实际环境安装CANN toolkit包,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。131+2. 根据实际环境安装CANN toolkit包,本样例需8.5.0及以上版本,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。
1323. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装:1323. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装:
133 133
134 ```bash134 ```bash
@@ -152,6 +152,8 @@
152 152 
153 153 
154- 样例执行154- 样例执行
155+ 
156+ 参考[表格](https://www.hiascend.com/document/detail/zh/canncommercial/850/opdevg/BishengCompiler/atlas_bisheng_10_0010.html),根据实际昇腾AI处理器架构修改[setup.py](./setup.py)中的--npu-arch参数,并执行如下命令:
155 157
156 ```bash158 ```bash
157 python setup.py bdist_wheel159 python setup.py bdist_wheel
Mexamples/kernel_extension_aclgraph/pybind/setup.py+4-0
@@ -58,6 +58,9 @@ class AscendBuildExtension(build_ext):
58 ext_fullpath = self.get_ext_fullpath(ext.name)58 ext_fullpath = self.get_ext_fullpath(ext.name)
59 os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True)59 os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True)
60 60 
61+ use_cxx11_abi = torch._C._GLIBCXX_USE_CXX11_ABI
62+ abi_value = "1" if use_cxx11_abi else "0"
63+ 
61 compile_cmd = [64 compile_cmd = [
62 "bisheng",65 "bisheng",
63 "-x", "asc",66 "-x", "asc",
@@ -65,6 +68,7 @@ class AscendBuildExtension(build_ext):
65 "-shared",68 "-shared",
66 "-fPIC",69 "-fPIC",
67 "-std=c++17",70 "-std=c++17",
71+ f"-D_GLIBCXX_USE_CXX11_ABI={abi_value}",
68 "-ltorch_npu", "-ltorch", "-lc10",72 "-ltorch_npu", "-ltorch", "-lc10",
69 *ext.sources,73 *ext.sources,
70 "-o", ext_fullpath,74 "-o", ext_fullpath,
Mexamples/kernel_extension_aclgraph/torch_library/README.md+4-3
@@ -126,8 +126,8 @@
1261. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch1261. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch
127 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。127 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。
128 128
129- 本样例需torch2.6.0版本以上,支持`backend="npugraph_ex"`需7.3.0版本以上。129+ 本样例需torch2.6.0以上版本,支持`backend="npugraph_ex"`需7.3.0以上版本
130-2. 根据实际环境安装CANN toolkit包,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。130+2. 根据实际环境安装CANN toolkit包,本样例需8.5.0及以上版本,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。
1313. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装:1313. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装:
132 132
133 ```bash133 ```bash
@@ -151,7 +151,8 @@
151 151 
152 152 
153- 样例执行153- 样例执行
154- 154+ 
155+ 参考[表格](https://www.hiascend.com/document/detail/zh/canncommercial/850/opdevg/BishengCompiler/atlas_bisheng_10_0010.html),根据实际昇腾AI处理器架构修改[setup.py](./setup.py)中的--npu-arch参数,并执行如下命令:
155 ```bash156 ```bash
156 python setup.py bdist_wheel157 python setup.py bdist_wheel
157 pip install dist/*.whl --force-reinstall158 pip install dist/*.whl --force-reinstall
Mexamples/kernel_extension_aclgraph/torch_library/setup.py+4-0
@@ -58,6 +58,9 @@ class AscendBuildExtension(build_ext):
58 ext_fullpath = self.get_ext_fullpath(ext.name)58 ext_fullpath = self.get_ext_fullpath(ext.name)
59 os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True)59 os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True)
60 60 
61+ use_cxx11_abi = torch._C._GLIBCXX_USE_CXX11_ABI
62+ abi_value = "1" if use_cxx11_abi else "0"
63+ 
61 compile_cmd = [64 compile_cmd = [
62 "bisheng",65 "bisheng",
63 "-x", "asc",66 "-x", "asc",
@@ -65,6 +68,7 @@ class AscendBuildExtension(build_ext):
65 "-shared",68 "-shared",
66 "-fPIC",69 "-fPIC",
67 "-std=c++17",70 "-std=c++17",
71+ f"-D_GLIBCXX_USE_CXX11_ABI={abi_value}",
68 "-ltorch_npu", "-ltorch", "-lc10",72 "-ltorch_npu", "-ltorch", "-lc10",
69 *ext.sources,73 *ext.sources,
70 "-o", ext_fullpath,74 "-o", ext_fullpath,