Skip to content

Commit 510cf55

Browse files
authored
[PROTON][XPU] Always build XpuPti profiler (#5373)
The profiler now depends only on PTI headers (which are included in the Triton source code) at build time, so it should be safe enough to build at all times and in any environment. Signed-off-by: Anatoly Myachev <[email protected]>
1 parent f674b76 commit 510cf55

File tree

7 files changed

+14
-43
lines changed

7 files changed

+14
-43
lines changed

.github/workflows/build-test-reusable.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ jobs:
118118
ref: ${{ inputs.pytorch_ref }}
119119
mode: ${{ inputs.pytorch_mode }}
120120

121-
- name: Build Proton with XPU support
122-
run: |
123-
echo TRITON_BUILD_PROTON_XPU=1 | tee -a $GITHUB_ENV
124-
125121
- name: Build Triton
126122
uses: ./.github/actions/setup-triton
127123
with:

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,6 @@ def build_extension(self, ext):
519519
# environment variables we will pass through to cmake
520520
passthrough_args = [
521521
"TRITON_BUILD_PROTON",
522-
"TRITON_BUILD_PROTON_XPU",
523522
"TRITON_BUILD_WITH_CCACHE",
524523
"TRITON_PARALLEL_LINK_JOBS",
525524
]

third_party/proton/CMakeLists.txt

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

6-
option(TRITON_BUILD_PROTON_XPU "Build Proton with XPU support" OFF)
7-
if(TRITON_BUILD_PROTON_XPU)
8-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTRITON_BUILD_PROTON_XPU")
9-
endif()
10-
116
# ============ Check for includes =============
127
if(NOT CUPTI_INCLUDE_DIR)
138
message(FATAL_ERROR "CUPTI include directory not defined")
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
set(SOURCE_FILES
1+
add_proton_library(ProtonDriver
22
Device.cpp
33
GPU/CudaApi.cpp
44
GPU/CuptiApi.cpp
55
GPU/HipApi.cpp
66
GPU/HsaApi.cpp
77
GPU/RoctracerApi.cpp
88
GPU/NvtxApi.cpp
9+
GPU/XpuApi.cpp
10+
GPU/XpuptiApi.cpp
911
)
10-
11-
if(TRITON_BUILD_PROTON_XPU)
12-
list(APPEND SOURCE_FILES GPU/XpuApi.cpp)
13-
list(APPEND SOURCE_FILES GPU/XpuptiApi.cpp)
14-
endif()
15-
16-
add_proton_library(ProtonDriver ${SOURCE_FILES})

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

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

86
#include "Utility/Errors.h"
97

@@ -16,11 +14,9 @@ Device getDevice(DeviceType type, uint64_t index) {
1614
if (type == DeviceType::HIP) {
1715
return hip::getDevice(index);
1816
}
19-
#ifdef TRITON_BUILD_PROTON_XPU
2017
if (type == DeviceType::XPU) {
2118
return xpu::getDevice(index);
2219
}
23-
#endif
2420
throw std::runtime_error("DeviceType not supported");
2521
}
2622

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
set(SOURCE_FILES
2-
Cupti/CuptiPCSampling.cpp
3-
Cupti/CuptiProfiler.cpp
4-
RocTracer/RoctracerProfiler.cpp
5-
Instrumentation/InstrumentationProfiler.cpp
6-
Instrumentation/CudaRuntime.cpp
7-
Instrumentation/HipRuntime.cpp
8-
Instrumentation/Metadata.cpp
1+
add_proton_library(ProtonProfiler
2+
Cupti/CuptiPCSampling.cpp
3+
Cupti/CuptiProfiler.cpp
4+
RocTracer/RoctracerProfiler.cpp
5+
Xpupti/XpuptiProfiler.cpp
6+
Instrumentation/InstrumentationProfiler.cpp
7+
Instrumentation/CudaRuntime.cpp
8+
Instrumentation/HipRuntime.cpp
9+
Instrumentation/Metadata.cpp
910
)
10-
11-
if(TRITON_BUILD_PROTON_XPU)
12-
list(APPEND SOURCE_FILES Xpupti/XpuptiProfiler.cpp)
13-
endif()
14-
15-
add_proton_library(ProtonProfiler ${SOURCE_FILES})

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
#include "Context/Shadow.h"
44
#include "Data/TraceData.h"
55
#include "Data/TreeData.h"
6+
#include "Driver/GPU/XpuApi.h"
67
#include "Profiler/Cupti/CuptiProfiler.h"
78
#include "Profiler/Instrumentation/InstrumentationProfiler.h"
89
#include "Profiler/Roctracer/RoctracerProfiler.h"
9-
#ifdef TRITON_BUILD_PROTON_XPU
10-
#include "Driver/GPU/XpuApi.h"
1110
#include "Profiler/Xpupti/XpuptiProfiler.h"
12-
#endif
1311
#include "Utility/String.h"
1412

1513
namespace proton {
@@ -24,13 +22,10 @@ Profiler *makeProfiler(const std::string &name, void *sycl_queue = nullptr,
2422
return &RoctracerProfiler::instance();
2523
} else if (proton::toLower(name) == "instrumentation") {
2624
return &InstrumentationProfiler::instance();
27-
}
28-
#ifdef TRITON_BUILD_PROTON_XPU
29-
if (proton::toLower(name) == "xpupti") {
25+
} else if (proton::toLower(name) == "xpupti") {
3026
xpu::PROTON_UTILS = utils_cache_path;
3127
return &XpuptiProfiler::instance().setSyclQueue(sycl_queue);
3228
}
33-
#endif
3429
throw std::runtime_error("Unknown profiler: " + name);
3530
}
3631

0 commit comments

Comments
 (0)