File tree Expand file tree Collapse file tree 3 files changed +17
-12
lines changed
third_party/proton/proton Expand file tree Collapse file tree 3 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,15 @@ else()
1414endif ()
1515
1616if (DEFINED ENV{LEVELZERO_INCLUDE_DIR})
17- set (LevelZero_INCLUDE_DIR "$ENV{LEVELZERO_INCLUDE_DIR} " )
17+ set (LevelZero_INCLUDE_DIR "$ENV{LEVELZERO_INCLUDE_DIR} " CACHE PATH "Path to Level Zero includes" )
18+ message (STATUS "Using Level Zero from ENV: ${LevelZero_INCLUDE_DIR} " )
1819else ()
1920 message (STATUS "LEVELZERO_INCLUDE_DIR env var not defined; try to use system version" )
2021endif ()
2122
2223if (DEFINED ENV{LEVELZERO_LIBRARY})
23- set (LevelZero_LIBRARY "$ENV{LEVELZERO_LIBRARY} " )
24+ set (LevelZero_LIBRARY "$ENV{LEVELZERO_LIBRARY} " CACHE PATH "Path to Level Zero library" )
25+ message (STATUS "Using Level Zero from ENV: ${LevelZero_LIBRARY} " )
2426else ()
2527 message (STATUS "LEVELZERO_LIBRARY env var not defined; try to use system version" )
2628endif ()
Original file line number Diff line number Diff line change @@ -51,11 +51,12 @@ function build_level_zero {
5151 echo " ${LEVEL_ZERO_VERSION} " | awk -F. ' {print $3}' > VERSION_PATCH
5252 mkdir build
5353 cd build
54- cmake .. -DCMAKE_BUILD_TYPE=Release
54+ L0_INSTALL_PATH=" $LEVEL_ZERO_PROJ /level-zero-${LEVEL_ZERO_VERSION} /install"
55+ cmake .. -DCMAKE_INSTALL_PREFIX=" $L0_INSTALL_PATH " -DCMAKE_BUILD_TYPE=Release
5556 cmake --build . --config Release --parallel " $( nproc) "
56- # cmake --build . --config Release --target install
57- export LEVELZERO_INCLUDE_DIR=" $LEVEL_ZERO_PROJ /level-zero- ${LEVEL_ZERO_VERSION} "
58- export LEVELZERO_LIBRARY=" $LEVEL_ZERO_PROJ /level-zero- ${LEVEL_ZERO_VERSION} /build /lib/libze_loader.so"
57+ cmake --build . --config Release --target install
58+ export LEVELZERO_INCLUDE_DIR=" $L0_INSTALL_PATH /include "
59+ export LEVELZERO_LIBRARY=" $L0_INSTALL_PATH /lib/libze_loader.so"
5960}
6061
6162function build_pti {
Original file line number Diff line number Diff 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." )
You can’t perform that action at this time.
0 commit comments