Skip to content

Commit dd34f7e

Browse files
committed
Fixed loading spirv_utils dynamic library module
1 parent 616e223 commit dd34f7e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

third_party/intel/backend/driver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ def include_dir(self) -> list[str]:
108108
def compile_module_from_src(src, name):
109109
key = hashlib.sha256(src.encode("utf-8")).hexdigest()
110110
cache = get_cache_manager(key)
111-
cache_path = cache.get_file(f"{name}.so")
111+
file_name = name + (".pyd" if os.name == "nt" else ".so")
112+
cache_path = cache.get_file(file_name)
112113
if cache_path is None:
113114
with tempfile.TemporaryDirectory() as tmpdir:
114115
src_path = os.path.join(tmpdir, "main.cpp")
@@ -117,7 +118,7 @@ def compile_module_from_src(src, name):
117118
so = _build(name, src_path, tmpdir, compilation_helper.library_dir, compilation_helper.include_dir,
118119
compilation_helper.libraries)
119120
with open(so, "rb") as f:
120-
cache_path = cache.put(f.read(), f"{name}.so", binary=True)
121+
cache_path = cache.put(f.read(), file_name, binary=True)
121122
import importlib.util
122123
spec = importlib.util.spec_from_file_location(name, cache_path)
123124
mod = importlib.util.module_from_spec(spec)

0 commit comments

Comments
 (0)