diff --git a/python/setup_tools/utils/ascend.py b/python/setup_tools/utils/ascend.py index 957b90588c..21e8749a27 100644 --- a/python/setup_tools/utils/ascend.py +++ b/python/setup_tools/utils/ascend.py @@ -7,6 +7,22 @@ downloader = DownloadManager() flagtree_submodule_dir = os.path.join(flagtree_root_dir, "third_party") +triton_root = os.path.join(flagtree_root_dir, "python") +# create a link for spec +triton_spec_link = os.path.join(triton_root, "triton", "ascend") +if not os.path.exists(triton_spec_link): + os.symlink(os.path.join(flagtree_root_dir, "third_party", "ascend", "backend"), triton_spec_link) + + +def get_extra_spec_packages(): + pkgs = ["triton/ascend"] + # scan triton_spec_link for subpackages + for root, dirs, files in os.walk(triton_spec_link): + for d in dirs: + pkg = os.path.relpath(os.path.join(root, d), triton_root) + pkgs.append(pkg) + return pkgs + def get_extra_install_packages(): return [ @@ -16,7 +32,7 @@ def get_extra_install_packages(): "triton/extension/buffer", "triton/extension/buffer/language", "triton/experimental/tle/language/dsa/ascend", - ] + ] + get_extra_spec_packages() def get_package_dir(): diff --git a/python/triton/runtime/driver.py b/python/triton/runtime/driver.py index 5903a063eb..1f7177cfd5 100644 --- a/python/triton/runtime/driver.py +++ b/python/triton/runtime/driver.py @@ -92,6 +92,6 @@ def spec_path(path_list: list): return triton_root = current_path[:idx + len("/triton")] rel_path = current_path[idx + len(marker):] - backend_path = os.path.join(triton_root, "backends", "ascend", "spec", "triton", rel_path) + backend_path = os.path.join(triton_root, "ascend", "spec", "triton", rel_path) if os.path.isdir(backend_path): path_list.insert(0, backend_path) diff --git a/third_party/ascend/backend/spec/triton/compiler/compiler.py b/third_party/ascend/backend/spec/triton/compiler/compiler.py index cc7ba30e7c..96d4e01808 100644 --- a/third_party/ascend/backend/spec/triton/compiler/compiler.py +++ b/third_party/ascend/backend/spec/triton/compiler/compiler.py @@ -137,7 +137,8 @@ def parse_options(self): def triton_key(): import pkgutil TRITON_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - TRITON_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(TRITON_PATH)))) # spec -> triton + # TRITON_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(TRITON_PATH)))) # spec -> triton + TRITON_PATH = os.path.dirname(os.path.dirname(os.path.dirname(TRITON_PATH))) # spec -> triton contents = [] # frontend with open(__file__, "rb") as f: