Skip to content

Commit b06a9fe

Browse files
authored
[PROTON] Fix ImportError: libproton.so: undefined symbol: _ZTIN6proton14XpuptiProfilerE (#4035)
Test with pip CI (old): https://github.com/intel/intel-xpu-backend-for-triton/actions/runs/14684390264/job/41211129850 new: https://github.com/intel/intel-xpu-backend-for-triton/actions/runs/14705967044 (passed) The problem started to appear after: #4018 This change is necessary for `import triton.profiler` to work even if the xpu profiler is not built, which happens for example in tutorial 9. --------- Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 94b3473 commit b06a9fe

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

third_party/proton/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ project(Proton LANGUAGES CXX)
33
set(PROTON_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/csrc")
44

55
option(TRITON_BUILD_PROTON_XPU "Build Proton with XPU support" OFF)
6+
if(TRITON_BUILD_PROTON_XPU)
7+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRITON_BUILD_PROTON_XPU")
8+
endif()
69

710
# ============ Check for includes =============
811
if(NOT CUPTI_INCLUDE_DIR)

third_party/proton/csrc/lib/Driver/Device.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "Driver/Device.h"
22
#include "Driver/GPU/CudaApi.h"
33
#include "Driver/GPU/HipApi.h"
4+
#ifdef TRITON_BUILD_PROTON_XPU
45
#include "Driver/GPU/XpuApi.h"
6+
#endif
57

68
#include "Utility/Errors.h"
79

@@ -14,9 +16,11 @@ Device getDevice(DeviceType type, uint64_t index) {
1416
if (type == DeviceType::HIP) {
1517
return hip::getDevice(index);
1618
}
19+
#ifdef TRITON_BUILD_PROTON_XPU
1720
if (type == DeviceType::XPU) {
1821
return xpu::getDevice(index);
1922
}
23+
#endif
2024
throw std::runtime_error("DeviceType not supported");
2125
}
2226

third_party/proton/csrc/lib/Session/Session.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
#include "Data/TreeData.h"
55
#include "Profiler/Cupti/CuptiProfiler.h"
66
#include "Profiler/Roctracer/RoctracerProfiler.h"
7+
#ifdef TRITON_BUILD_PROTON_XPU
78
#include "Profiler/Xpupti/XpuptiProfiler.h"
9+
#endif
810
#include "Utility/String.h"
911

1012
namespace proton {
@@ -19,11 +21,13 @@ Profiler *getProfiler(const std::string &name, const std::string &path,
1921
if (proton::toLower(name) == "cupti_pcsampling") {
2022
return &CuptiProfiler::instance().setLibPath(path).enablePCSampling();
2123
}
24+
#ifdef TRITON_BUILD_PROTON_XPU
2225
if (proton::toLower(name) == "xpupti") {
2326
return &XpuptiProfiler::instance()
2427
.setSyclQueue(sycl_queue)
2528
.setUtilsCachePath(utils_cache_path);
2629
}
30+
#endif
2731
if (proton::toLower(name) == "roctracer") {
2832
return &RoctracerProfiler::instance();
2933
}

0 commit comments

Comments
 (0)