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: 4 additions & 2 deletions scripts/build_pti_data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ else()
endif()

if(DEFINED ENV{LEVELZERO_INCLUDE_DIR})
set(LevelZero_INCLUDE_DIR "$ENV{LEVELZERO_INCLUDE_DIR}")
set(LevelZero_INCLUDE_DIR "$ENV{LEVELZERO_INCLUDE_DIR}" CACHE PATH "Path to Level Zero includes")
message(STATUS "Using Level Zero from ENV: ${LevelZero_INCLUDE_DIR}")
else()
message(STATUS "LEVELZERO_INCLUDE_DIR env var not defined; try to use system version")
endif()

if(DEFINED ENV{LEVELZERO_LIBRARY})
set(LevelZero_LIBRARY "$ENV{LEVELZERO_LIBRARY}")
set(LevelZero_LIBRARY "$ENV{LEVELZERO_LIBRARY}" CACHE PATH "Path to Level Zero library")
message(STATUS "Using Level Zero from ENV: ${LevelZero_LIBRARY}")
else()
message(STATUS "LEVELZERO_LIBRARY env var not defined; try to use system version")
endif()
Expand Down
9 changes: 5 additions & 4 deletions scripts/install-pti.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ function build_level_zero {
echo "${LEVEL_ZERO_VERSION}" | awk -F. '{print $3}' > VERSION_PATCH
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
L0_INSTALL_PATH="$LEVEL_ZERO_PROJ/level-zero-${LEVEL_ZERO_VERSION}/install"
cmake .. -DCMAKE_INSTALL_PREFIX="$L0_INSTALL_PATH" -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release --parallel "$(nproc)"
# cmake --build . --config Release --target install
export LEVELZERO_INCLUDE_DIR="$LEVEL_ZERO_PROJ/level-zero-${LEVEL_ZERO_VERSION}"
export LEVELZERO_LIBRARY="$LEVEL_ZERO_PROJ/level-zero-${LEVEL_ZERO_VERSION}/build/lib/libze_loader.so"
cmake --build . --config Release --target install
export LEVELZERO_INCLUDE_DIR="$L0_INSTALL_PATH/include"
export LEVELZERO_LIBRARY="$L0_INSTALL_PATH/lib/libze_loader.so"
}

function build_pti {
Expand Down
14 changes: 8 additions & 6 deletions third_party/proton/proton/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ def _select_backend() -> str:
elif backend == "xpu":
global UTILS_CACHE_PATH
UTILS_CACHE_PATH = triton.runtime.driver.active.build_proton_help_lib()
files = importlib.metadata.files('intel-pti')
if files is not None:
for f in files:
if f.name == 'libpti_view.so':
os.environ["TRITON_XPUPTI_LIB_PATH"] = str(pathlib.Path(f.locate()).parent.resolve())
break
try:
if (files := importlib.metadata.files('intel-pti')) is not None:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intel-pti is an optional package

for f in files:
if f.name == 'libpti_view.so':
os.environ["TRITON_XPUPTI_LIB_PATH"] = str(pathlib.Path(f.locate()).parent.resolve())
break
except importlib.metadata.PackageNotFoundError:
pass
return "xpupti"
else:
raise ValueError("No backend is available for the current target.")
Expand Down
Loading