Skip to content
Merged
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
6 changes: 6 additions & 0 deletions src/kernels/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import importlib.metadata


__version__ = importlib.metadata.version("kernels")

from kernels.layer import (
Expand Down Expand Up @@ -28,6 +29,11 @@
load_kernel,
)


from kernels._windows import _add_additional_dll_paths

_add_additional_dll_paths()

__all__ = [
"__version__",
"CUDAProperties",
Expand Down
25 changes: 25 additions & 0 deletions src/kernels/_windows.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import platform


def _add_additional_dll_paths():
"""
Add special Windows DLL paths.

Recent versions of Python do use PATH as a load path anymore. This can
cause issues with libraries that are used by kernels such as dnnl. Here
we add several known paths.
"""

if platform.system() == "Windows":
_dll_paths = [
# Add Intel oneAPI directories for XPU support
r"C:\Program Files (x86)\Intel\oneAPI\dnnl\latest\bin",
]

for _path in _dll_paths:
if os.path.exists(_path):
try:
os.add_dll_directory(_path)
except Exception:
pass # Ignore if already added or permission issues
Loading