Skip to content

Commit

Permalink
[CPU][driver] Skip non-existent sys paths
Browse files Browse the repository at this point in the history
  • Loading branch information
digantdesai committed Dec 19, 2024
1 parent 911429d commit 83f48c6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions third_party/cpu/backend/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from triton.backends.driver import DriverBase
from triton.backends.compiler import GPUTarget

from pathlib import Path
from triton._C.libtriton import llvm

_dirname = os.getenv("TRITON_SYS_PATH", default="/usr/local")
Expand All @@ -22,10 +23,19 @@
# resources.files() doesn't exist for Python < 3.9
_triton_C_dir = importlib.resources.path(triton, "_C").__enter__()

include_dirs = [os.path.join(_dirname, "include")]
library_dirs = [os.path.join(_dirname, "lib"), _triton_C_dir]
include_dirs = []
library_dirs = [_triton_C_dir]
libraries = ["stdc++"]

# Skip non-existent paths
sys_include_dir = os.path.join(_dirname, "include")
if os.path.exists(sys_include_dir):
include_dirs.append(sys_include_dir)

sys_lib_dir = os.path.join(_dirname, "lib")
if os.path.exists(sys_lib_dir):
library_dirs.append(sys_lib_dir)


def compile_module_from_src(src, name):
key = hashlib.md5(src.encode("utf-8")).hexdigest()
Expand Down

0 comments on commit 83f48c6

Please sign in to comment.