Skip to content

Commit 133e266

Browse files
authored
Use sysconfig.get_config_var('EXT_SUFFIX') in intel/backend/driver.py (#2637)
Part of #2478 Signed-off-by: Anatoly Myachev <[email protected]>
1 parent ee9dc3a commit 133e266

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

third_party/intel/backend/driver.py

Lines changed: 4 additions & 2 deletions
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
@@ -115,7 +116,8 @@ def libsycl_dir(self) -> Optional[str]:
115116
def compile_module_from_src(src, name):
116117
key = hashlib.sha256(src.encode("utf-8")).hexdigest()
117118
cache = get_cache_manager(key)
118-
cache_path = cache.get_file(f"{name}.so")
119+
file_name = f"{name}.{sysconfig.get_config_var('EXT_SUFFIX').split('.')[-1]}"
120+
cache_path = cache.get_file(file_name)
119121
if cache_path is None:
120122
with tempfile.TemporaryDirectory() as tmpdir:
121123
src_path = os.path.join(tmpdir, "main.cpp")
@@ -127,7 +129,7 @@ def compile_module_from_src(src, name):
127129
so = _build(name, src_path, tmpdir, compilation_helper.library_dir, compilation_helper.include_dir,
128130
compilation_helper.libraries, extra_compile_args=extra_compiler_args)
129131
with open(so, "rb") as f:
130-
cache_path = cache.put(f.read(), f"{name}.so", binary=True)
132+
cache_path = cache.put(f.read(), file_name, binary=True)
131133
import importlib.util
132134
spec = importlib.util.spec_from_file_location(name, cache_path)
133135
mod = importlib.util.module_from_spec(spec)

0 commit comments

Comments
 (0)