已合并
[v2.9.0][bugfix]cann and pta header mixing bulid bugfix #44992
Dring创建于 17 天前
[v2.9.0][bugfix]cann and pta header mixing bulid bugfix #44992
已合并
共 81 个文件变更+223-150
| @@ -281,8 +281,6 @@ def copy_hpp(): | |||
| 281 | "torch_npu/csrc/inductor/**/*.h", | 281 | "torch_npu/csrc/inductor/**/*.h", |
| 282 | "torch_npu/csrc/distributed/*.h", | 282 | "torch_npu/csrc/distributed/*.h", |
| 283 | "torch_npu/csrc/distributed/*.hpp", | 283 | "torch_npu/csrc/distributed/*.hpp", |
| 284 | - "third_party/acl/inc/*/*.h", | ||
| 285 | - "third_party/acl/inc/*/*/*.h", | ||
| 286 | "third_party/hccl/inc/*/*.h", | 284 | "third_party/hccl/inc/*/*.h", |
| 287 | ] | 285 | ] |
| 288 | glob_header_files = [] | 286 | glob_header_files = [] |
| @@ -299,6 +297,38 @@ def copy_hpp(): | |||
| 299 | os.makedirs(os.path.dirname(dst), exist_ok=True) | 297 | os.makedirs(os.path.dirname(dst), exist_ok=True) |
| 300 | ret.append((src, dst)) | 298 | ret.append((src, dst)) |
| 301 | 299 | ||
| 300 | + acl_include_root = os.path.join(BASE_DIR, "third_party", "acl", "inc") | ||
| 301 | + acl_header_files = glob.glob( | ||
| 302 | + os.path.join(acl_include_root, "**", "*.h"), | ||
| 303 | + recursive=True, | ||
| 304 | + ) | ||
| 305 | + for src in acl_header_files: | ||
| 306 | + relative_header = os.path.relpath(src, acl_include_root) | ||
| 307 | + dst = os.path.join( | ||
| 308 | + BASE_DIR, | ||
| 309 | + "libtorch_npu/include", | ||
| 310 | + relative_header, | ||
| 311 | + ) | ||
| 312 | + os.makedirs(os.path.dirname(dst), exist_ok=True) | ||
| 313 | + ret.append((src, dst)) | ||
| 314 | + | ||
| 315 | + # Preserve legacy include paths with forwarding headers, not duplicate ACL headers. | ||
| 316 | + wrapper_src = os.path.join( | ||
| 317 | + BASE_DIR, "build", "acl_compat_headers", relative_header | ||
| 318 | + ) | ||
| 319 | + os.makedirs(os.path.dirname(wrapper_src), exist_ok=True) | ||
| 320 | + with open(wrapper_src, "w", encoding="utf-8", newline="\n") as wrapper_file: | ||
| 321 | + wrapper_file.write("#pragma once\n#include <{}>\n".format( | ||
| 322 | + relative_header.replace(os.sep, "/") | ||
| 323 | + )) | ||
| 324 | + wrapper_dst = os.path.join( | ||
| 325 | + BASE_DIR, | ||
| 326 | + "libtorch_npu/include/third_party/acl/inc", | ||
| 327 | + relative_header, | ||
| 328 | + ) | ||
| 329 | + os.makedirs(os.path.dirname(wrapper_dst), exist_ok=True) | ||
| 330 | + ret.append((wrapper_src, wrapper_dst)) | ||
| 331 | + | ||
| 302 | return ret | 332 | return ret |
| 303 | 333 | ||
| 304 | ret = get_src_py_and_dst() | 334 | ret = get_src_py_and_dst() |
| @@ -55,8 +55,7 @@ def fetch_acl_headers(): | |||
| 55 | # 2. Fallback: copy from installed torch_npu | 55 | # 2. Fallback: copy from installed torch_npu |
| 56 | try: | 56 | try: |
| 57 | import torch_npu | 57 | import torch_npu |
| 58 | - installed_acl = Path( | 58 | + installed_acl = Path(torch_npu.__file__).resolve().parent / 'include' / 'acl' |
| 59 | - torch_npu.__file__).resolve().parent / 'include' / 'third_party' / 'acl' / 'inc' / 'acl' | ||
| 60 | if installed_acl.is_dir(): | 59 | if installed_acl.is_dir(): |
| 61 | acl_dest.mkdir(parents=True, exist_ok=True) | 60 | acl_dest.mkdir(parents=True, exist_ok=True) |
| 62 | shutil.copytree(str(installed_acl), str(acl_dest), dirs_exist_ok=True) | 61 | shutil.copytree(str(installed_acl), str(acl_dest), dirs_exist_ok=True) |
| @@ -473,9 +473,7 @@ def get_src_py_and_dst(): | |||
| 473 | "torch_npu/csrc/*/*/*.h", | 473 | "torch_npu/csrc/*/*/*.h", |
| 474 | "torch_npu/csrc/*/*/*/*.h", | 474 | "torch_npu/csrc/*/*/*/*.h", |
| 475 | "torch_npu/csrc/*/*/*/*/*.h", | 475 | "torch_npu/csrc/*/*/*/*/*.h", |
| 476 | - "third_party/acl/inc/*/*.h", | ||
| 477 | "third_party/hccl/inc/*/*.h", | 476 | "third_party/hccl/inc/*/*.h", |
| 478 | - "third_party/acl/inc/*/*/*.h", | ||
| 479 | "torch_npu/csrc/distributed/HCCLUtils.hpp", | 477 | "torch_npu/csrc/distributed/HCCLUtils.hpp", |
| 480 | "torch_npu/csrc/distributed/ProcessGroupHCCL.hpp" | 478 | "torch_npu/csrc/distributed/ProcessGroupHCCL.hpp" |
| 481 | ] | 479 | ] |
| @@ -491,6 +489,38 @@ def get_src_py_and_dst(): | |||
| 491 | os.makedirs(os.path.dirname(dst), exist_ok=True) | 489 | os.makedirs(os.path.dirname(dst), exist_ok=True) |
| 492 | ret.append((src, dst)) | 490 | ret.append((src, dst)) |
| 493 | 491 | ||
| 492 | + acl_include_root = os.path.join(BASE_DIR, "third_party", "acl", "inc") | ||
| 493 | + acl_header_files = glob.glob( | ||
| 494 | + os.path.join(acl_include_root, "**", "*.h"), | ||
| 495 | + recursive=True, | ||
| 496 | + ) | ||
| 497 | + for src in acl_header_files: | ||
| 498 | + relative_header = os.path.relpath(src, acl_include_root) | ||
| 499 | + dst = os.path.join( | ||
| 500 | + BASE_DIR, | ||
| 501 | + "build/packages/torch_npu/include", | ||
| 502 | + relative_header, | ||
| 503 | + ) | ||
| 504 | + os.makedirs(os.path.dirname(dst), exist_ok=True) | ||
| 505 | + ret.append((src, dst)) | ||
| 506 | + | ||
| 507 | + # Preserve legacy include paths with forwarding headers, not duplicate ACL headers. | ||
| 508 | + wrapper_src = os.path.join( | ||
| 509 | + BASE_DIR, "build", "acl_compat_headers", relative_header | ||
| 510 | + ) | ||
| 511 | + os.makedirs(os.path.dirname(wrapper_src), exist_ok=True) | ||
| 512 | + with open(wrapper_src, "w", encoding="utf-8", newline="\n") as wrapper_file: | ||
| 513 | + wrapper_file.write("#pragma once\n#include <{}>\n".format( | ||
| 514 | + relative_header.replace(os.sep, "/") | ||
| 515 | + )) | ||
| 516 | + wrapper_dst = os.path.join( | ||
| 517 | + BASE_DIR, | ||
| 518 | + "build/packages/torch_npu/include/third_party/acl/inc", | ||
| 519 | + relative_header, | ||
| 520 | + ) | ||
| 521 | + os.makedirs(os.path.dirname(wrapper_dst), exist_ok=True) | ||
| 522 | + ret.append((wrapper_src, wrapper_dst)) | ||
| 523 | + | ||
| 494 | torch_header_files = [ | 524 | torch_header_files = [ |
| 495 | "*/*.h", | 525 | "*/*.h", |
| 496 | "*/*/*.h", | 526 | "*/*/*.h", |
| @@ -21,7 +21,12 @@ def create_build_path(build_directory): | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | def build_stub(base_dir): | 23 | def build_stub(base_dir): |
| 24 | - build_stub_cmd = ["sh", os.path.join(base_dir, 'third_party/acl/libs/build_stub.sh')] | 24 | + build_stub_cmd = [ |
| 25 | + "sh", | ||
| 26 | + os.path.join(base_dir, 'third_party/acl/libs/build_stub.sh'), | ||
| 27 | + # Use the installed header root for both the ACL stub and C++ Extension. | ||
| 28 | + os.path.join(PYTORCH_NPU_INSTALL_PATH, "include"), | ||
| 29 | + ] | ||
| 25 | if subprocess.call(build_stub_cmd) != 0: | 30 | if subprocess.call(build_stub_cmd) != 0: |
| 26 | raise RuntimeError('Failed to build stub: {}'.format(build_stub_cmd)) | 31 | raise RuntimeError('Failed to build stub: {}'.format(build_stub_cmd)) |
| 27 | 32 | ||
| @@ -47,7 +52,6 @@ class TestPluggableAllocator(TestCase): | |||
| 47 | extra_ldflags.append(f"-L{PYTORCH_INSTALL_PATH}") | 52 | extra_ldflags.append(f"-L{PYTORCH_INSTALL_PATH}") |
| 48 | extra_include_paths = [os.path.join(TEST_DIR, "cpp_extensions")] | 53 | extra_include_paths = [os.path.join(TEST_DIR, "cpp_extensions")] |
| 49 | extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include')) | 54 | extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include')) |
| 50 | - extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include', 'third_party', 'acl', 'inc')) | ||
| 51 | 55 | ||
| 52 | cls.module = torch.utils.cpp_extension.load( | 56 | cls.module = torch.utils.cpp_extension.load( |
| 53 | name="pluggable_allocator_extensions", | 57 | name="pluggable_allocator_extensions", |
| @@ -2,8 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | -#include "third_party/acl/inc/acl/acl_base.h" | 5 | +#include <acl/acl_base.h> |
| 6 | -#include "third_party/acl/inc/acl/acl_rt.h" | 6 | +#include <acl/acl_rt.h> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | extern "C" { | 9 | extern "C" { |
| @@ -335,7 +335,7 @@ class TestRpc(TestCase): | |||
| 335 | 335 | ||
| 336 | 336 | ||
| 337 | def test_async_call_for_cpu(self): | 337 | def test_async_call_for_cpu(self): |
| 338 | - inputs = [torch.rand(1024, 1024).cpu(), torch.rand(1024, 1024, 1024).cpu()] | 338 | + inputs = [torch.rand(1024, 1024).cpu(), torch.rand(1024, 1024, 4).cpu()] |
| 339 | self._test_multiprocess(TestRpc._test_async_call_for_cpu, inputs, self.world_size_2p) | 339 | self._test_multiprocess(TestRpc._test_async_call_for_cpu, inputs, self.world_size_2p) |
| 340 | 340 | ||
| 341 | 341 | ||
| @@ -23,7 +23,11 @@ def create_build_path(build_directory): | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | def build_stub(base_dir): | 25 | def build_stub(base_dir): |
| 26 | - build_stub_cmd = ["sh", os.path.join(base_dir, "third_party/acl/libs/build_stub.sh")] | 26 | + build_stub_cmd = [ |
| 27 | + "sh", | ||
| 28 | + os.path.join(base_dir, "third_party/acl/libs/build_stub.sh"), | ||
| 29 | + os.path.join(PYTORCH_NPU_INSTALL_PATH, "include"), | ||
| 30 | + ] | ||
| 27 | if subprocess.call(build_stub_cmd) != 0: | 31 | if subprocess.call(build_stub_cmd) != 0: |
| 28 | raise RuntimeError(f"Failed to build stub: {build_stub_cmd}") | 32 | raise RuntimeError(f"Failed to build stub: {build_stub_cmd}") |
| 29 | 33 | ||
| @@ -43,7 +47,6 @@ class TestAllocatorTraceTracker(TestCase): | |||
| 43 | torch_npu_lib_path = os.path.join(PYTORCH_NPU_INSTALL_PATH, "lib") | 47 | torch_npu_lib_path = os.path.join(PYTORCH_NPU_INSTALL_PATH, "lib") |
| 44 | extra_include_paths = [ | 48 | extra_include_paths = [ |
| 45 | os.path.join(PYTORCH_NPU_INSTALL_PATH, "include"), | 49 | os.path.join(PYTORCH_NPU_INSTALL_PATH, "include"), |
| 46 | - os.path.join(PYTORCH_NPU_INSTALL_PATH, "include", "third_party", "acl", "inc"), | ||
| 47 | ] | 50 | ] |
| 48 | extra_ldflags = [ | 51 | extra_ldflags = [ |
| 49 | f"-L{cann_lib_path}", | 52 | f"-L{cann_lib_path}", |
| @@ -23,7 +23,11 @@ def create_build_path(build_directory): | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | def build_stub(base_dir): | 25 | def build_stub(base_dir): |
| 26 | - build_stub_cmd = ["sh", os.path.join(base_dir, 'third_party/acl/libs/build_stub.sh')] | 26 | + build_stub_cmd = [ |
| 27 | + "sh", | ||
| 28 | + os.path.join(base_dir, 'third_party/acl/libs/build_stub.sh'), | ||
| 29 | + os.path.join(PYTORCH_NPU_INSTALL_PATH, "include"), | ||
| 30 | + ] | ||
| 27 | if subprocess.call(build_stub_cmd) != 0: | 31 | if subprocess.call(build_stub_cmd) != 0: |
| 28 | raise RuntimeError('Failed to build stub: {}'.format(build_stub_cmd)) | 32 | raise RuntimeError('Failed to build stub: {}'.format(build_stub_cmd)) |
| 29 | 33 | ||
| @@ -56,7 +60,6 @@ class TestPluggableAllocator(TestCase): | |||
| 56 | extra_ldflags.append(f"-L{PYTORCH_INSTALL_PATH}") | 60 | extra_ldflags.append(f"-L{PYTORCH_INSTALL_PATH}") |
| 57 | extra_include_paths = [os.path.join(TEST_DIR, "cpp_extensions")] | 61 | extra_include_paths = [os.path.join(TEST_DIR, "cpp_extensions")] |
| 58 | extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, "include")) | 62 | extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, "include")) |
| 59 | - extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include', 'third_party', 'acl', 'inc')) | ||
| 60 | 63 | ||
| 61 | cls.module = torch.utils.cpp_extension.load( | 64 | cls.module = torch.utils.cpp_extension.load( |
| 62 | name="pluggable_allocator_extensions", | 65 | name="pluggable_allocator_extensions", |
| @@ -41,6 +41,7 @@ def build_stub(base_dir): | |||
| 41 | build_stub_cmd = [ | 41 | build_stub_cmd = [ |
| 42 | "sh", | 42 | "sh", |
| 43 | os.path.join(base_dir, "third_party/acl/libs/build_stub.sh"), | 43 | os.path.join(base_dir, "third_party/acl/libs/build_stub.sh"), |
| 44 | + os.path.join(PYTORCH_NPU_INSTALL_PATH, "include"), | ||
| 44 | ] | 45 | ] |
| 45 | if subprocess.call(build_stub_cmd) != 0: | 46 | if subprocess.call(build_stub_cmd) != 0: |
| 46 | raise RuntimeError(f"Failed to build stub: {build_stub_cmd}") | 47 | raise RuntimeError(f"Failed to build stub: {build_stub_cmd}") |
| @@ -79,7 +80,6 @@ class TestSanitizerPluggableAllocator(TestCase): | |||
| 79 | extra_ldflags.append(f"-L{PYTORCH_INSTALL_PATH}") | 80 | extra_ldflags.append(f"-L{PYTORCH_INSTALL_PATH}") |
| 80 | extra_include_paths = [os.path.join(TEST_DIR, "cpp_extensions")] | 81 | extra_include_paths = [os.path.join(TEST_DIR, "cpp_extensions")] |
| 81 | extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include')) | 82 | extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include')) |
| 82 | - extra_include_paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, 'include', 'third_party', 'acl', 'inc')) | ||
| 83 | 83 | ||
| 84 | cls.module = torch.utils.cpp_extension.load( | 84 | cls.module = torch.utils.cpp_extension.load( |
| 85 | name="sanitizer_pluggable_allocator_extensions", | 85 | name="sanitizer_pluggable_allocator_extensions", |
| @@ -9,6 +9,8 @@ from torch_npu.testing.common_utils import create_common_tensor, check_operators | |||
| 9 | 9 | ||
| 10 | os.environ["COMBINED_ENABLE"] = "1" # Open combined-view cases optimization | 10 | os.environ["COMBINED_ENABLE"] = "1" # Open combined-view cases optimization |
| 11 | 11 | ||
| 12 | +SKIP_REASON = "Temporarily skipped; see https://gitcode.com/Ascend/pytorch/issues/4356" | ||
| 13 | + | ||
| 12 | # Optimized view Ops contains Transpose, permute, narrow, strideslice, select, unfold | 14 | # Optimized view Ops contains Transpose, permute, narrow, strideslice, select, unfold |
| 13 | 15 | ||
| 14 | # The test case is a continuous optimization test case for aclop | 16 | # The test case is a continuous optimization test case for aclop |
| @@ -19,6 +21,7 @@ os.environ["COMBINED_ENABLE"] = "1" # Open combined-view cases optimization | |||
| 19 | 21 | ||
| 20 | 22 | ||
| 21 | class SingleViewCopyToContiguous(TestCase): | 23 | class SingleViewCopyToContiguous(TestCase): |
| 24 | + | ||
| 22 | def test_view_copy(self, device="npu"): | 25 | def test_view_copy(self, device="npu"): |
| 23 | dtype_list1 = [np.float16, np.float32] | 26 | dtype_list1 = [np.float16, np.float32] |
| 24 | format_list1 = [0, 3, 29] | 27 | format_list1 = [0, 3, 29] |
| @@ -66,6 +69,7 @@ class SingleViewCopyToContiguous(TestCase): | |||
| 66 | cpu_out2 = cpu_input.view(1, 6, cpu_input.size(2) * cpu_input.size(3), 1).clone() | 69 | cpu_out2 = cpu_input.view(1, 6, cpu_input.size(2) * cpu_input.size(3), 1).clone() |
| 67 | self.assertRtolEqual(npu_out2.to("cpu").numpy(), cpu_out2.numpy()) | 70 | self.assertRtolEqual(npu_out2.to("cpu").numpy(), cpu_out2.numpy()) |
| 68 | 71 | ||
| 72 | + | ||
| 69 | def test_unsqueeze_copy(self, device="npu"): | 73 | def test_unsqueeze_copy(self, device="npu"): |
| 70 | dtype_list2 = [np.float16, np.float32] | 74 | dtype_list2 = [np.float16, np.float32] |
| 71 | format_list2 = [2, 3, 29] | 75 | format_list2 = [2, 3, 29] |
| @@ -98,6 +102,7 @@ class SingleViewCopyToContiguous(TestCase): | |||
| 98 | cpu_out = cpu_input.unsqueeze(i).clone() | 102 | cpu_out = cpu_input.unsqueeze(i).clone() |
| 99 | self.assertRtolEqual(npu_out.to("cpu").numpy(), cpu_out.numpy()) | 103 | self.assertRtolEqual(npu_out.to("cpu").numpy(), cpu_out.numpy()) |
| 100 | 104 | ||
| 105 | + | ||
| 101 | def test_flatten_copy(self, device="npu"): | 106 | def test_flatten_copy(self, device="npu"): |
| 102 | dtype_list3 = [np.float16, np.float32] | 107 | dtype_list3 = [np.float16, np.float32] |
| 103 | format_list3 = [0, 3, 29] | 108 | format_list3 = [0, 3, 29] |
| @@ -127,6 +132,7 @@ class SingleViewCopyToContiguous(TestCase): | |||
| 127 | cpu_out = torch.flatten(cpu_input, 0, 1).clone() | 132 | cpu_out = torch.flatten(cpu_input, 0, 1).clone() |
| 128 | self.assertRtolEqual(npu_out.to("cpu").numpy(), cpu_out.numpy()) | 133 | self.assertRtolEqual(npu_out.to("cpu").numpy(), cpu_out.numpy()) |
| 129 | 134 | ||
| 135 | + | ||
| 130 | def test_narrow_at_first_axis_copy(self, device="npu"): | 136 | def test_narrow_at_first_axis_copy(self, device="npu"): |
| 131 | # this case: slice at the first dim, tensor with offset remains contiguous | 137 | # this case: slice at the first dim, tensor with offset remains contiguous |
| 132 | dtype_list4 = [np.float16, np.float32] | 138 | dtype_list4 = [np.float16, np.float32] |
| @@ -1,20 +1,23 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | 2 | ||
| 3 | +set -e | ||
| 4 | + | ||
| 3 | CDIR="$(cd "$(dirname "$0")" ; pwd -P)" | 5 | CDIR="$(cd "$(dirname "$0")" ; pwd -P)" |
| 4 | 6 | ||
| 5 | -cd ${CDIR} | 7 | +cd "${CDIR}" |
| 8 | + | ||
| 9 | +ACL_INCLUDE_DIR="${1:-../inc}" | ||
| 6 | 10 | ||
| 7 | gcc -fPIC -shared -o libhccl.so -I./ hccl.cpp | 11 | gcc -fPIC -shared -o libhccl.so -I./ hccl.cpp |
| 8 | 12 | ||
| 9 | -gcc -fPIC -shared -o libascendcl.so -I../inc acl.cpp | 13 | +gcc -fPIC -shared -o libascendcl.so -I"${ACL_INCLUDE_DIR}" acl.cpp |
| 10 | 14 | ||
| 11 | -gcc -fPIC -shared -o libacl_op_compiler.so -I../inc acl_op_compiler.cpp | 15 | +gcc -fPIC -shared -o libacl_op_compiler.so -I"${ACL_INCLUDE_DIR}" acl_op_compiler.cpp |
| 12 | 16 | ||
| 13 | -gcc -fPIC -shared -o libge_runner.so -I../inc ge_runner.cpp ge_api.cpp | 17 | +gcc -fPIC -shared -o libge_runner.so -I"${ACL_INCLUDE_DIR}" ge_runner.cpp ge_api.cpp |
| 14 | 18 | ||
| 15 | -gcc -fPIC -shared -o libgraph.so -I../inc graph.cpp operator_factory.cpp operator.cpp tensor.cpp | 19 | +gcc -fPIC -shared -o libgraph.so -I"${ACL_INCLUDE_DIR}" graph.cpp operator_factory.cpp operator.cpp tensor.cpp |
| 16 | 20 | ||
| 17 | -gcc -fPIC -shared -o libacl_tdt_channel.so -I../inc acl_tdt.cpp | 21 | +gcc -fPIC -shared -o libacl_tdt_channel.so -I"${ACL_INCLUDE_DIR}" acl_tdt.cpp |
| 18 | - | ||
| 19 | -gcc -fPIC -shared -o libascend_ml.so -I../inc aml_fwk_detect.cpp | ||
| 20 | 22 | ||
| 23 | +gcc -fPIC -shared -o libascend_ml.so -I"${ACL_INCLUDE_DIR}" aml_fwk_detect.cpp | ||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | -#include "third_party/acl/inc/acl/acl.h" | 15 | +#include <acl/acl.h> |
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | extern "C" { | 18 | extern "C" { |
| @@ -95,13 +95,11 @@ def _build_npu_ext(obj_name: str, src_path, src_dir) -> str: | |||
| 95 | 95 | ||
| 96 | torch_npu_dir = torch_npu_root / "include" | 96 | torch_npu_dir = torch_npu_root / "include" |
| 97 | torch_npu_lib_dir = torch_npu_root / "lib" | 97 | torch_npu_lib_dir = torch_npu_root / "lib" |
| 98 | - acl_inc_dir = torch_npu_dir / "third_party" / "acl" / "inc" | ||
| 99 | 98 | ||
| 100 | cc_cmd += [ | 99 | cc_cmd += [ |
| 101 | f"-I{torch_npu_dir}", | 100 | f"-I{torch_npu_dir}", |
| 102 | f"-I{cpp_common_dir}", | 101 | f"-I{cpp_common_dir}", |
| 103 | f"-L{torch_npu_lib_dir}", | 102 | f"-L{torch_npu_lib_dir}", |
| 104 | - f"-I{acl_inc_dir}", | ||
| 105 | "-ltorch_npu", | 103 | "-ltorch_npu", |
| 106 | f"-Wl,-rpath", | 104 | f"-Wl,-rpath", |
| 107 | "-std=c++17", | 105 | "-std=c++17", |
| @@ -43,7 +43,7 @@ def include_paths(npu: bool = False) -> List[str]: | |||
| 43 | os.path.join(lib_include, 'TH'), | 43 | os.path.join(lib_include, 'TH'), |
| 44 | os.path.join(lib_include, 'THC') | 44 | os.path.join(lib_include, 'THC') |
| 45 | ] | 45 | ] |
| 46 | - include_path = os.path.join(PYTORCH_NPU_INSTALL_PATH, "include", "third_party", "acl", "inc") | 46 | + include_path = os.path.join(PYTORCH_NPU_INSTALL_PATH, "include") |
| 47 | paths.extend([include_path]) | 47 | paths.extend([include_path]) |
| 48 | if npu: | 48 | if npu: |
| 49 | ASCEND_HOME = get_ascend_home() | 49 | ASCEND_HOME = get_ascend_home() |
| @@ -55,7 +55,6 @@ def include_paths(npu: bool = False) -> List[str]: | |||
| 55 | os.path.join(ASCEND_HOME, "include/experiment/msprof"), | 55 | os.path.join(ASCEND_HOME, "include/experiment/msprof"), |
| 56 | ]) | 56 | ]) |
| 57 | 57 | ||
| 58 | - paths.append(os.path.join(PYTORCH_NPU_INSTALL_PATH, "include")) | ||
| 59 | return paths | 58 | return paths |
| 60 | 59 | ||
| 61 | 60 | ||
| @@ -163,4 +162,4 @@ def patch_get_cpp_torch_device_options(): | |||
| 163 | 162 | ||
| 164 | 163 | ||
| 165 | def patch_get_optimization_cflags(): | 164 | def patch_get_optimization_cflags(): |
| 166 | - cpp_builder._get_optimization_cflags = _get_optimization_cflags | 165 | + cpp_builder._get_optimization_cflags = _get_optimization_cflags |
| @@ -8,7 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | -#include "third_party/acl/inc/acl/acl.h" | 11 | +#include <acl/acl.h> |
| 12 | 12 | ||
| 13 | namespace at_npu { | 13 | namespace at_npu { |
| 14 | namespace native { | 14 | namespace native { |
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | -#include "third_party/acl/inc/acl/acl_base.h" | 6 | +#include <acl/acl_base.h> |
| 7 | 7 | ||
| 8 | namespace at_npu { | 8 | namespace at_npu { |
| 9 | namespace native { | 9 | namespace native { |
| @@ -2,8 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | -#include "third_party/acl/inc/acl/acl_base.h" | 5 | +#include <acl/acl_base.h> |
| 6 | -#include "third_party/acl/inc/acl/acl_rt.h" | 6 | +#include <acl/acl_rt.h> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | -#include "third_party/acl/inc/acl/acl_base.h" | 26 | +#include <acl/acl_base.h> |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | namespace { | 29 | namespace { |
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | -#include "third_party/acl/inc/acl/acl_base.h" | 6 | +#include <acl/acl_base.h> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | namespace torch_npu { | 9 | namespace torch_npu { |
| @@ -8,8 +8,8 @@ | |||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | -#include "third_party/acl/inc/acl/acl_rt.h" | 11 | +#include <acl/acl_rt.h> |
| 12 | -#include "third_party/acl/inc/acl/acl_base.h" | 12 | +#include <acl/acl_base.h> |
| 13 | 13 | ||
| 14 | namespace torch_npu { | 14 | namespace torch_npu { |
| 15 | 15 | ||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -#include "third_party/acl/inc/acl/acl_rt.h" | 8 | +#include <acl/acl_rt.h> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | namespace torch_npu { | 11 | namespace torch_npu { |
| @@ -6,8 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | -#include <third_party/acl/inc/acl/acl.h> | 9 | +#include <acl/acl.h> |
| 10 | -#include <third_party/acl/inc/acl/acl_rt.h> | 10 | +#include <acl/acl_rt.h> |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | -#include "third_party/acl/inc/acl/acl.h" | 12 | +#include <acl/acl.h> |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | constexpr size_t kVersionIndex1 = 1; | 15 | constexpr size_t kVersionIndex1 = 1; |
| @@ -17,8 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | -#include "third_party/acl/inc/acl/acl_base.h" | 20 | +#include <acl/acl_base.h> |
| 21 | -#include "third_party/acl/inc/acl/acl_rt.h" | 21 | +#include <acl/acl_rt.h> |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 24 | ||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/acl.h" | 7 | +#include <acl/acl.h> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -#include <third_party/acl/inc/acl/acl.h> | 8 | +#include <acl/acl.h> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | 11 | ||
| @@ -49,4 +49,4 @@ private: | |||
| 49 | std::unordered_set<aclrtEvent> ipc_events_; | 49 | std::unordered_set<aclrtEvent> ipc_events_; |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | -} // namespace c10_npu | 52 | +} // namespace c10_npu |
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | -#include <third_party/acl/inc/acl/acl_base.h> | 18 | +#include <acl/acl_base.h> |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | 21 | ||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | -#include "third_party/acl/inc/acl/acl_rt.h" | 14 | +#include <acl/acl_rt.h> |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | 17 | ||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | -#include <third_party/acl/inc/acl/acl.h> | 19 | +#include <acl/acl.h> |
| 20 | 20 | ||
| 21 | namespace c10_npu { | 21 | namespace c10_npu { |
| 22 | 22 | ||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/error_codes/rt_error_codes.h" | 7 | +#include <acl/error_codes/rt_error_codes.h> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/acl_base.h" | 7 | +#include <acl/acl_base.h> |
| 8 | -#include "third_party/acl/inc/acl/acl_rt.h" | 8 | +#include <acl/acl_rt.h> |
| 9 | -#include "third_party/acl/inc/acl/super_kernel.h" | 9 | +#include <acl/super_kernel.h> |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -#include <third_party/acl/inc/acl/acl_rt.h> | 4 | +#include <acl/acl_rt.h> |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| @@ -20,7 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | -#include <third_party/acl/inc/acl/acl_rt.h> | 23 | +#include <acl/acl_rt.h> |
| 24 | 24 | ||
| 25 | namespace c10_npu { | 25 | namespace c10_npu { |
| 26 | struct timeval delay = { 0, 1 }; | 26 | struct timeval delay = { 0, 1 }; |
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include <third_party/acl/inc/acl/acl_op.h> | 10 | +#include <acl/acl_op.h> |
| 11 | 11 | ||
| 12 | namespace c10_npu { | 12 | namespace c10_npu { |
| 13 | 13 | ||
| @@ -184,4 +184,4 @@ public: | |||
| 184 | 184 | ||
| 185 | static ::c10_npu::register_queue_cb::NPUCallBackRegisterBuilder \ | 185 | static ::c10_npu::register_queue_cb::NPUCallBackRegisterBuilder \ |
| 186 | register_queue_func_builder(execF, copyF, releaseF, newF, deleteF, copyReleaseParamF, releaseParamF); | 186 | register_queue_func_builder(execF, copyF, releaseF, newF, deleteF, copyReleaseParamF, releaseParamF); |
| 187 | -} // namespace c10_npu | 187 | +} // namespace c10_npu |
| @@ -20,7 +20,7 @@ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | -#include "third_party/acl/inc/acl/acl_rt.h" | 23 | +#include <acl/acl_rt.h> |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | 26 | ||
| @@ -10,8 +10,8 @@ | |||
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | -#include "third_party/acl/inc/acl/acl.h" | 13 | +#include <acl/acl.h> |
| 14 | -#include "third_party/acl/inc/acl/acl_op.h" | 14 | +#include <acl/acl_op.h> |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | namespace c10_npu { | 17 | namespace c10_npu { |
| @@ -1,8 +1,8 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -#include "third_party/acl/inc/acl/acl_base.h" | 4 | +#include <acl/acl_base.h> |
| 5 | -#include "third_party/acl/inc/acl/acl_rt.h" | 5 | +#include <acl/acl_rt.h> |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | ||
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/acl_base.h" | 7 | +#include <acl/acl_base.h> |
| 8 | -#include "third_party/acl/inc/acl/acl_rt.h" | 8 | +#include <acl/acl_rt.h> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | 11 | ||
| @@ -7,9 +7,9 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl.h" | 10 | +#include <acl/acl.h> |
| 11 | -#include "third_party/acl/inc/acl/acl_base.h" | 11 | +#include <acl/acl_base.h> |
| 12 | -#include "third_party/acl/inc/acl/acl_rt.h" | 12 | +#include <acl/acl_rt.h> |
| 13 | 13 | ||
| 14 | namespace c10_npu { | 14 | namespace c10_npu { |
| 15 | namespace impl { | 15 | namespace impl { |
| @@ -2,12 +2,12 @@ | |||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | -#include "third_party/acl/inc/acl/acl_rt.h" | 5 | +#include <acl/acl_rt.h> |
| 6 | -#include "third_party/acl/inc/acl/acl_base.h" | 6 | +#include <acl/acl_base.h> |
| 7 | -#include "third_party/acl/inc/acl/acl_mdl.h" | 7 | +#include <acl/acl_mdl.h> |
| 8 | -#include "third_party/acl/inc/acl/acl_prof.h" | 8 | +#include <acl/acl_prof.h> |
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl.h" | 10 | +#include <acl/acl.h> |
| 11 | 11 | ||
| 12 | using aclrtHostFunc = void (*)(void *args); | 12 | using aclrtHostFunc = void (*)(void *args); |
| 13 | struct aclrtMemUsageInfo; | 13 | struct aclrtMemUsageInfo; |
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | -#include "third_party/acl/inc/acl/acl_rt.h" | 9 | +#include <acl/acl_rt.h> |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | ||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | -#include "third_party/acl/inc/acl/acl_rt.h" | 5 | +#include <acl/acl_rt.h> |
| 6 | 6 | ||
| 7 | namespace c10_npu { | 7 | namespace c10_npu { |
| 8 | namespace queue { | 8 | namespace queue { |
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | ||
| 2 | -#include "third_party/acl/inc/aml/aml_fwk_detect.h" | 2 | +#include <aml/aml_fwk_detect.h> |
| 3 | 3 | ||
| 4 | namespace c10_npu { | 4 | namespace c10_npu { |
| 5 | namespace amlapi { | 5 | namespace amlapi { |
| @@ -1,8 +1,8 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | -#include "third_party/acl/inc/acl/super_kernel.h" | 3 | +#include <acl/super_kernel.h> |
| 4 | -#include "third_party/acl/inc/acl/acl_base.h" | 4 | +#include <acl/acl_base.h> |
| 5 | -#include "third_party/acl/inc/acl/acl_mdl.h" | 5 | +#include <acl/acl_mdl.h> |
| 6 | 6 | ||
| 7 | namespace c10_npu { | 7 | namespace c10_npu { |
| 8 | namespace skapi { | 8 | namespace skapi { |
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | -#include "third_party/acl/inc/acl/acl_base.h" | 6 | +#include <acl/acl_base.h> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| @@ -22,8 +22,8 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | -#include "third_party/acl/inc/acl/acl_op_compiler.h" | 25 | +#include <acl/acl_op_compiler.h> |
| 26 | -#include "third_party/acl/inc/acl/acl_rt.h" | 26 | +#include <acl/acl_rt.h> |
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | 29 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | -#include <third_party/acl/inc/acl/acl.h> | 3 | +#include <acl/acl.h> |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl_base.h" | 10 | +#include <acl/acl_base.h> |
| 11 | 11 | ||
| 12 | namespace c10_npu { | 12 | namespace c10_npu { |
| 13 | const int g_toAclOffset = 256; | 13 | const int g_toAclOffset = 256; |
| @@ -33,8 +33,8 @@ | |||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | -#include "third_party/acl/inc/acl/acl.h" | 36 | +#include <acl/acl.h> |
| 37 | -#include "third_party/acl/inc/acl/acl_base.h" | 37 | +#include <acl/acl_base.h> |
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | 40 | ||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | -#include "third_party/acl/inc/acl/acl_rt.h" | 19 | +#include <acl/acl_rt.h> |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | 22 | ||
| @@ -362,7 +362,7 @@ void TensorPipeAgent::checkAndSetStaticGroup(const c10::intrusive_ptr<::c10d::St | |||
| 362 | returnedVec = store->compareSet(isStaticGroupKey, std::vector<uint8_t>(), isStaticGroupVec); | 362 | returnedVec = store->compareSet(isStaticGroupKey, std::vector<uint8_t>(), isStaticGroupVec); |
| 363 | std::string returnedVal = std::string(returnedVec.begin(), returnedVec.end()); | 363 | std::string returnedVal = std::string(returnedVec.begin(), returnedVec.end()); |
| 364 | // In both cases, the returned value should be the value of isStaticGroupStr, | 364 | // In both cases, the returned value should be the value of isStaticGroupStr, |
| 365 | - // otherwise there is a discrepency with initialization among one of the | 365 | + // otherwise there is a discrepancy with initialization among one of the |
| 366 | // members | 366 | // members |
| 367 | } | 367 | } |
| 368 | 368 | ||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | -#include "third_party/acl/inc/acl/acl_base.h" | 6 | +#include <acl/acl_base.h> |
| 7 | 7 | ||
| 8 | namespace c10d { | 8 | namespace c10d { |
| 9 | namespace symmetric_memory { | 9 | namespace symmetric_memory { |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/acl_base.h" | 7 | +#include <acl/acl_base.h> |
| 8 | 8 | ||
| 9 | namespace at_npu { | 9 | namespace at_npu { |
| 10 | namespace native { | 10 | namespace native { |
| @@ -47,4 +47,4 @@ public: | |||
| 47 | } // namespace native | 47 | } // namespace native |
| 48 | } // namespace at_npu | 48 | } // namespace at_npu |
| 49 | 49 | ||
| 50 | -#endif // __NATIVE_NPU_UTILS_FORMAT_INFER__ | 50 | +#endif // __NATIVE_NPU_UTILS_FORMAT_INFER__ |
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -#include "third_party/acl/inc/acl/acl_op_compiler.h" | 8 | +#include <acl/acl_op_compiler.h> |
| 9 | 9 | ||
| 10 | namespace at_npu { | 10 | namespace at_npu { |
| 11 | namespace aclops { | 11 | namespace aclops { |
| @@ -27,4 +27,4 @@ void InitializeJitCompilationMode(); | |||
| 27 | } // namespace aclops | 27 | } // namespace aclops |
| 28 | } // namespace at_npu | 28 | } // namespace at_npu |
| 29 | 29 | ||
| 30 | -#endif // AT_NPU_ACLOPS_LAZYINITACLOPS_H_ | 30 | +#endif // AT_NPU_ACLOPS_LAZYINITACLOPS_H_ |
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/acl.h" | 7 | +#include <acl/acl.h> |
| 8 | -#include "third_party/acl/inc/acl/acl_base.h" | 8 | +#include <acl/acl_base.h> |
| 9 | 9 | ||
| 10 | namespace at_npu { | 10 | namespace at_npu { |
| 11 | namespace native { | 11 | namespace native { |
| @@ -39,4 +39,4 @@ public: | |||
| 39 | } // namespace native | 39 | } // namespace native |
| 40 | } // namespace at_npu | 40 | } // namespace at_npu |
| 41 | 41 | ||
| 42 | -#endif | 42 | +#endif |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/acl_base.h" | 7 | +#include <acl/acl_base.h> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| @@ -451,4 +451,4 @@ extern std::recursive_mutex deterministic_launch_mutex; | |||
| 451 | } // namespace native | 451 | } // namespace native |
| 452 | } // namespace at_npu | 452 | } // namespace at_npu |
| 453 | 453 | ||
| 454 | -#endif | 454 | +#endif |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | -#include <third_party/acl/inc/acl/acl_op_compiler.h> | 5 | +#include <acl/acl_op_compiler.h> |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | namespace at_npu { | 8 | namespace at_npu { |
| @@ -147,4 +147,4 @@ AoeDumpGraphManager& aoe_manager(); | |||
| 147 | } // namespace native | 147 | } // namespace native |
| 148 | } // namespace at_npu | 148 | } // namespace at_npu |
| 149 | 149 | ||
| 150 | -#endif // __NATIVE_NPU_TOOLS_AOEUTILS__ | 150 | +#endif // __NATIVE_NPU_TOOLS_AOEUTILS__ |
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | -#include "third_party/acl/inc/acl/acl_base.h" | 6 | +#include <acl/acl_base.h> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| @@ -40,4 +40,4 @@ struct ContiguousTensorDesc { | |||
| 40 | } // namespace native | 40 | } // namespace native |
| 41 | } // namespace at_npu | 41 | } // namespace at_npu |
| 42 | 42 | ||
| 43 | -#endif | 43 | +#endif |
| @@ -1,10 +1,10 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -#include "third_party/acl/inc/acl/acl_rt.h" | 4 | +#include <acl/acl_rt.h> |
| 5 | -#include <third_party/acl/inc/acl/acl_base.h> | 5 | +#include <acl/acl_base.h> |
| 6 | -#include <third_party/acl/inc/acl/acl_prof.h> | 6 | +#include <acl/acl_prof.h> |
| 7 | -#include <third_party/acl/inc/acl/acl_op.h> | 7 | +#include <acl/acl_op.h> |
| 8 | 8 | ||
| 9 | namespace at_npu { | 9 | namespace at_npu { |
| 10 | namespace native { | 10 | namespace native { |
| @@ -76,4 +76,4 @@ aclError AclopStopDumpArgs(uint32_t dumpType); | |||
| 76 | } // namespace native | 76 | } // namespace native |
| 77 | } // namespace at_npu | 77 | } // namespace at_npu |
| 78 | 78 | ||
| 79 | -#endif // __TORCH_NPU_INTERFACE_ACLINTERFACE__ | 79 | +#endif // __TORCH_NPU_INTERFACE_ACLINTERFACE__ |
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -#include "third_party/acl/inc/acl/acl_base.h" | 8 | +#include <acl/acl_base.h> |
| 9 | 9 | ||
| 10 | namespace at_npu | 10 | namespace at_npu |
| 11 | { | 11 | { |
| @@ -207,4 +207,4 @@ aclError AclDestroyAclOpExecutor(aclOpExecutor *executor) | |||
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | } // namespace native | 209 | } // namespace native |
| 210 | -} // namespace at_npu | 210 | +} // namespace at_npu |
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -#include "third_party/acl/inc/acl/acl_op_compiler.h" | 4 | +#include <acl/acl_op_compiler.h> |
| 5 | 5 | ||
| 6 | typedef struct aclOpExecutor aclOpExecutor; | 6 | typedef struct aclOpExecutor aclOpExecutor; |
| 7 | 7 | ||
| @@ -150,4 +150,4 @@ ACL_FUNC_VISIBILITY aclError AclDestroyAclOpExecutor(aclOpExecutor *executor); | |||
| 150 | } // namespace native | 150 | } // namespace native |
| 151 | } // namespace at_npu | 151 | } // namespace at_npu |
| 152 | 152 | ||
| 153 | -#endif // __NATIVE_NPU_INTERFACE_ACLOPCOMPILE__ | 153 | +#endif // __NATIVE_NPU_INTERFACE_ACLOPCOMPILE__ |
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl_mdl.h" | 10 | +#include <acl/acl_mdl.h> |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -#include "third_party/acl/inc/acl/acl_prof.h" | 4 | +#include <acl/acl_prof.h> |
| 5 | 5 | ||
| 6 | namespace at_npu { | 6 | namespace at_npu { |
| 7 | namespace native { | 7 | namespace native { |
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -#include <third_party/acl/inc/acl/acl_prof.h> | 4 | +#include <acl/acl_prof.h> |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | namespace at_npu { | 7 | namespace at_npu { |
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | -#include "third_party/acl/inc/acl/acl_base.h" | 3 | +#include <acl/acl_base.h> |
| 4 | -#include "third_party/acl/inc/acl/acl_rt.h" | 4 | +#include <acl/acl_rt.h> |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| @@ -14,8 +14,8 @@ | |||
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | -#include "third_party/acl/inc/acl/acl_base.h" | 17 | +#include <acl/acl_base.h> |
| 18 | -#include "third_party/acl/inc/acl/acl.h" | 18 | +#include <acl/acl.h> |
| 19 | 19 | ||
| 20 | using std::string; | 20 | using std::string; |
| 21 | using std::vector; | 21 | using std::vector; |
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | -#include <third_party/acl/inc/graph/operator.h> | 6 | +#include <graph/operator.h> |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| @@ -21,4 +21,4 @@ using DynamicInputRegFunc = std::function<ge::OperatorPtr(DyNumAndIndex, std::st | |||
| 21 | } // namespace native | 21 | } // namespace native |
| 22 | } // namespace at_npu | 22 | } // namespace at_npu |
| 23 | 23 | ||
| 24 | -#endif // __NATIVE_NPU_UTILS_NPU_CONFIG__ | 24 | +#endif // __NATIVE_NPU_UTILS_NPU_CONFIG__ |
| @@ -7,9 +7,9 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl.h" | 10 | +#include <acl/acl.h> |
| 11 | -#include "third_party/acl/inc/acl/acl_base.h" | 11 | +#include <acl/acl_base.h> |
| 12 | -#include "third_party/acl/inc/acl/acl_op.h" | 12 | +#include <acl/acl_op.h> |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | 15 | ||
| @@ -2,8 +2,8 @@ | |||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | -#include "third_party/acl/inc/acl/acl_base.h" | 5 | +#include <acl/acl_base.h> |
| 6 | -#include "third_party/acl/inc/acl/acl_rt.h" | 6 | +#include <acl/acl_rt.h> |
| 7 | 7 | ||
| 8 | typedef void* NPUdeviceptr; | 8 | typedef void* NPUdeviceptr; |
| 9 | 9 | ||
| @@ -5,7 +5,7 @@ | |||
| 5 | // in model.so, and should not refer to any aten/c10 headers except the stable | 5 | // in model.so, and should not refer to any aten/c10 headers except the stable |
| 6 | // C ABI defined in torch_npu/csrc/inductor/aoti_torch/c/shim.h. The same rule | 6 | // C ABI defined in torch_npu/csrc/inductor/aoti_torch/c/shim.h. The same rule |
| 7 | // applies to other files under torch_npu/csrc/inductor/aoti_runtime/. | 7 | // applies to other files under torch_npu/csrc/inductor/aoti_runtime/. |
| 8 | -#include <third_party/acl/inc/acl/acl_base.h> | 8 | +#include <acl/acl_base.h> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | 11 | ||
| @@ -8,8 +8,8 @@ | |||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | -#include "third_party/acl/inc/profiling/prof_api.h" | 11 | +#include <profiling/prof_api.h> |
| 12 | -#include "third_party/acl/inc/profiling/prof_common.h" | 12 | +#include <profiling/prof_common.h> |
| 13 | 13 | ||
| 14 | struct TilingMem { | 14 | struct TilingMem { |
| 15 | std::unique_ptr<void, decltype(&aclrtFreeHost)> arg_tiling_host; | 15 | std::unique_ptr<void, decltype(&aclrtFreeHost)> arg_tiling_host; |
| @@ -1,8 +1,8 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -#include "third_party/acl/inc/acl/acl_base.h" | 4 | +#include <acl/acl_base.h> |
| 5 | -#include "third_party/acl/inc/acl/acl_rt.h" | 5 | +#include <acl/acl_rt.h> |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | rtError_t common_launch(char* kernelName, const void* func, uint32_t gridX, void* args, uint32_t argsSize, | 8 | rtError_t common_launch(char* kernelName, const void* func, uint32_t gridX, void* args, uint32_t argsSize, |
| @@ -10,4 +10,4 @@ rtError_t common_launch(char* kernelName, const void* func, uint32_t gridX, void | |||
| 10 | rtError_t common_launch_dyn(char* kernelName, void* func, void* tiling_func, int64_t tilingSize, void* arg_tiling_host, | 10 | rtError_t common_launch_dyn(char* kernelName, void* func, void* tiling_func, int64_t tilingSize, void* arg_tiling_host, |
| 11 | void* arg_tiling_device, uint32_t gridX, void* args, uint32_t argsSize, rtStream_t stream); | 11 | void* arg_tiling_device, uint32_t gridX, void* args, uint32_t argsSize, rtStream_t stream); |
| 12 | void opcommand_call(const char* name, std::function<int()> launch_call); | 12 | void opcommand_call(const char* name, std::function<int()> launch_call); |
| 13 | -#endif // BUILD_LIBTORCH | 13 | +#endif // BUILD_LIBTORCH |
| @@ -8,8 +8,8 @@ | |||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | -#include "third_party/acl/inc/acl/acl_base.h" | 11 | +#include <acl/acl_base.h> |
| 12 | -#include "third_party/acl/inc/acl/acl_rt.h" | 12 | +#include <acl/acl_rt.h> |
| 13 | 13 | ||
| 14 | namespace torch_npu { | 14 | namespace torch_npu { |
| 15 | namespace ipc { | 15 | namespace ipc { |
| @@ -264,4 +264,4 @@ namespace NPUCachingAllocator { | |||
| 264 | REGISTER_FREE_MEMORY_CALLBACK("npu_ipc_collect", NpuIPCCollectCallback); | 264 | REGISTER_FREE_MEMORY_CALLBACK("npu_ipc_collect", NpuIPCCollectCallback); |
| 265 | 265 | ||
| 266 | } // namespace NPUCachingAllocator | 266 | } // namespace NPUCachingAllocator |
| 267 | -} // namespace c10_npu | 267 | +} // namespace c10_npu |
| @@ -22,8 +22,8 @@ | |||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | -#include "third_party/acl/inc/acl/acl_base.h" | 25 | +#include <acl/acl_base.h> |
| 26 | -#include "third_party/acl/inc/acl/acl_rt.h" | 26 | +#include <acl/acl_rt.h> |
| 27 | 27 | ||
| 28 | namespace torch_npu { | 28 | namespace torch_npu { |
| 29 | namespace reductions { | 29 | namespace reductions { |
| @@ -5,9 +5,9 @@ | |||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -#include "third_party/acl/inc/acl/acl_base.h" | 8 | +#include <acl/acl_base.h> |
| 9 | -#include "third_party/acl/inc/acl/acl_rt.h" | 9 | +#include <acl/acl_rt.h> |
| 10 | -#include "third_party/acl/inc/acl/super_kernel.h" | 10 | +#include <acl/super_kernel.h> |
| 11 | 11 | ||
| 12 | struct PendingTensorData { | 12 | struct PendingTensorData { |
| 13 | PendingTensorData(uintptr_t dataPtr, Py_ssize_t nbytes, PyObject* shape, PyObject* dtype) | 13 | PendingTensorData(uintptr_t dataPtr, Py_ssize_t nbytes, PyObject* shape, PyObject* dtype) |
| @@ -27,7 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | 29 | ||
| 30 | -#include <third_party/acl/inc/acl/acl.h> | 30 | +#include <acl/acl.h> |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | 33 | ||
| @@ -3,9 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | -#include "third_party/acl/inc/acl/acl.h" | 6 | +#include <acl/acl.h> |
| 7 | -#include "third_party/acl/inc/acl/acl_base.h" | 7 | +#include <acl/acl_base.h> |
| 8 | -#include "third_party/acl/inc/acl/acl_rt.h" | 8 | +#include <acl/acl_rt.h> |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | 11 | ||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl_prof.h" | 10 | +#include <acl/acl_prof.h> |
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | ||
| @@ -7,8 +7,8 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl_base.h" | 10 | +#include <acl/acl_base.h> |
| 11 | -#include "third_party/acl/inc/acl/acl_rt.h" | 11 | +#include <acl/acl_rt.h> |
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | 14 | ||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | -#include "third_party/acl/inc/acl/acl_prof.h" | 7 | +#include <acl/acl_prof.h> |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | 10 | ||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -#include "third_party/acl/inc/acl/acl_rt.h" | 10 | +#include <acl/acl_rt.h> |
| 11 | 11 | ||
| 12 | namespace torch_npu { | 12 | namespace torch_npu { |
| 13 | namespace profiler { | 13 | namespace profiler { |
| @@ -1,7 +1,6 @@ | |||
| 1 | import os | 1 | import os |
| 2 | import setuptools | 2 | import setuptools |
| 3 | 3 | ||
| 4 | -import torch | ||
| 5 | import torch.utils.cpp_extension as TorchExtension | 4 | import torch.utils.cpp_extension as TorchExtension |
| 6 | 5 | ||
| 7 | import torch_npu | 6 | import torch_npu |
| @@ -38,7 +37,6 @@ def NpuExtension(name, sources, *args, **kwargs): | |||
| 38 | torch_npu_dir = PYTORCH_NPU_INSTALL_PATH | 37 | torch_npu_dir = PYTORCH_NPU_INSTALL_PATH |
| 39 | include_dirs = kwargs.get('include_dirs', []) | 38 | include_dirs = kwargs.get('include_dirs', []) |
| 40 | include_dirs.append(os.path.join(torch_npu_dir, 'include')) | 39 | include_dirs.append(os.path.join(torch_npu_dir, 'include')) |
| 41 | - include_dirs.append(os.path.join(torch_npu_dir, 'include', 'third_party', 'acl', 'inc')) | ||
| 42 | include_dirs.append(os.path.join(torch_npu_dir, 'include', 'third_party', 'hccl', 'inc')) | 40 | include_dirs.append(os.path.join(torch_npu_dir, 'include', 'third_party', 'hccl', 'inc')) |
| 43 | include_dirs += TorchExtension.include_paths() | 41 | include_dirs += TorchExtension.include_paths() |
| 44 | kwargs['include_dirs'] = include_dirs | 42 | kwargs['include_dirs'] = include_dirs |