Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion python/setup_tools/utils/ascend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion python/triton/runtime/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading