Skip to content

Commit eabe39b

Browse files
committed
make sure intel-pti package is optional
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 1456b85 commit eabe39b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

third_party/proton/proton/profile.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ def _select_backend() -> str:
2424
elif backend == "xpu":
2525
global UTILS_CACHE_PATH
2626
UTILS_CACHE_PATH = triton.runtime.driver.active.build_proton_help_lib()
27-
files = importlib.metadata.files('intel-pti')
28-
if files is not None:
29-
for f in files:
30-
if f.name == 'libpti_view.so':
31-
os.environ["TRITON_XPUPTI_LIB_PATH"] = str(pathlib.Path(f.locate()).parent.resolve())
32-
break
27+
try:
28+
if files := importlib.metadata.files('intel-pti') is not None:
29+
for f in files:
30+
if f.name == 'libpti_view.so':
31+
os.environ["TRITON_XPUPTI_LIB_PATH"] = str(pathlib.Path(f.locate()).parent.resolve())
32+
break
33+
except importlib.metadata.PackageNotFoundError:
34+
pass
3335
return "xpupti"
3436
else:
3537
raise ValueError("No backend is available for the current target.")

0 commit comments

Comments
 (0)