Skip to content

Commit 705730c

Browse files
committed
Changed condition to sysconfig call
Signed-off-by: Gregory Shimansky <[email protected]>
1 parent 89d5eee commit 705730c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

python/triton/compiler/compiler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import re
1717
import functools
1818
import os
19+
import sysconfig
1920

2021

2122
@dataclass
@@ -177,7 +178,7 @@ def triton_key():
177178

178179
# backend
179180
libtriton_hash = hashlib.sha256()
180-
ext = "so" if os.name != "nt" else "pyd"
181+
ext = sysconfig.get_config_var("EXT_SUFFIX").split(".")[-1]
181182
with open(os.path.join(TRITON_PATH, "_C", "libtriton." + ext), "rb") as f:
182183
while True:
183184
chunk = f.read(1024**2)

third_party/intel/backend/driver.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import hashlib
44
import shutil
5+
import sysconfig
56
import tempfile
67
from pathlib import Path
78
from functools import cached_property
@@ -108,7 +109,7 @@ def include_dir(self) -> list[str]:
108109
def compile_module_from_src(src, name):
109110
key = hashlib.sha256(src.encode("utf-8")).hexdigest()
110111
cache = get_cache_manager(key)
111-
file_name = name + (".pyd" if os.name == "nt" else ".so")
112+
file_name = f"{name}.{sysconfig.get_config_var('EXT_SUFFIX').split('.')[-1]}"
112113
cache_path = cache.get_file(file_name)
113114
if cache_path is None:
114115
with tempfile.TemporaryDirectory() as tmpdir:

0 commit comments

Comments
 (0)