Skip to content

Commit 03c3035

Browse files
authored
Revert "[SYCL][XPTI] Enable PI calls notifications with arguments (#3973)"
This reverts commit e239fdf.
1 parent ea4b8a9 commit 03c3035

File tree

14 files changed

+1
-407
lines changed

14 files changed

+1
-407
lines changed

sycl/include/CL/sycl/detail/common.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ namespace detail {
3131
constexpr const char *SYCL_STREAM_NAME = "sycl";
3232
// Stream name being used for traces generated from the SYCL plugin layer
3333
constexpr const char *SYCL_PICALL_STREAM_NAME = "sycl.pi";
34-
// Stream name being used for traces generated from PI calls. This stream
35-
// contains information about function arguments.
36-
constexpr const char *SYCL_PIDEBUGCALL_STREAM_NAME = "sycl.pi.debug";
3734
// Data structure that captures the user code location information using the
3835
// builtin capabilities of the compiler
3936
struct code_location {

sycl/include/CL/sycl/detail/pi.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
// This is for convinience of doing same thing for all interfaces, e.g.
1515
// declare, define, initialize.
1616
//
17-
// This list is used to define PiApiKind enum, which is part of external
18-
// interface. To avoid ABI breakage, please, add new entries to the end of the
19-
// list.
20-
//
2117
// Platform
2218
_PI_API(piPlatformsGet)
2319
_PI_API(piPlatformGetInfo)

sycl/include/CL/sycl/detail/pi.hpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -184,26 +184,6 @@ uint64_t emitFunctionBeginTrace(const char *FName);
184184
/// \param FName The name of the PI API call
185185
void emitFunctionEndTrace(uint64_t CorrelationID, const char *FName);
186186

187-
/// Notifies XPTI subscribers about PI function calls and packs call arguments.
188-
///
189-
/// \param FuncID is the API hash ID from PiApiID type trait.
190-
/// \param FName The name of the PI API call.
191-
/// \param ArgsData is a pointer to packed function call arguments.
192-
uint64_t emitFunctionWithArgsBeginTrace(uint32_t FuncID, const char *FName,
193-
unsigned char *ArgsData);
194-
195-
/// Notifies XPTI subscribers about PI function call result.
196-
///
197-
/// \param CorrelationID The correlation ID for the API call generated by the
198-
/// emitFunctionWithArgsBeginTrace() call.
199-
/// \param FuncID is the API hash ID from PiApiID type trait.
200-
/// \param FName The name of the PI API call.
201-
/// \param ArgsData is a pointer to packed function call arguments.
202-
/// \param Result is function call result value.
203-
void emitFunctionWithArgsEndTrace(uint64_t CorrelationID, uint32_t FuncID,
204-
const char *FName, unsigned char *ArgsData,
205-
pi_result Result);
206-
207187
// A wrapper for passing around byte array properties
208188
class ByteArray {
209189
public:
@@ -415,5 +395,3 @@ namespace RT = cl::sycl::detail::pi;
415395

416396
} // namespace sycl
417397
} // __SYCL_INLINE_NAMESPACE(cl)
418-
419-
#undef _PI_API

sycl/include/CL/sycl/detail/type_traits.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <CL/sycl/detail/type_list.hpp>
1515

1616
#include <array>
17-
#include <tuple>
1817
#include <type_traits>
1918

2019
__SYCL_INLINE_NAMESPACE(cl) {
@@ -351,12 +350,6 @@ template <access::address_space AS, class DataT>
351350
using const_if_const_AS = DataT;
352351
#endif
353352

354-
template <typename T> struct function_traits {};
355-
356-
template <typename Ret, typename... Args> struct function_traits<Ret(Args...)> {
357-
using ret_type = Ret;
358-
using args_type = std::tuple<Args...>;
359-
};
360353

361354
} // namespace detail
362355
} // namespace sycl

sycl/source/detail/pi.cpp

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ namespace detail {
4646
xpti_td *GSYCLGraphEvent = nullptr;
4747
/// Event to be used by PI layer related activities
4848
xpti_td *GPICallEvent = nullptr;
49-
/// Event to be used by PI layer calls with arguments
50-
xpti_td *GPIArgCallEvent = nullptr;
5149
/// Constants being used as placeholder until one is able to reliably get the
5250
/// version of the SYCL runtime
5351
constexpr uint32_t GMajVer = 1;
@@ -137,42 +135,6 @@ void emitFunctionEndTrace(uint64_t CorrelationID, const char *FName) {
137135
#endif // XPTI_ENABLE_INSTRUMENTATION
138136
}
139137

140-
uint64_t emitFunctionWithArgsBeginTrace(uint32_t FuncID, const char *FuncName,
141-
unsigned char *ArgsData) {
142-
uint64_t CorrelationID = 0;
143-
#ifdef XPTI_ENABLE_INSTRUMENTATION
144-
if (xptiTraceEnabled()) {
145-
uint8_t StreamID = xptiRegisterStream(SYCL_PIDEBUGCALL_STREAM_NAME);
146-
CorrelationID = xptiGetUniqueId();
147-
148-
xpti::function_with_args_t Payload{FuncID, FuncName, ArgsData, nullptr,
149-
nullptr};
150-
151-
xptiNotifySubscribers(
152-
StreamID, (uint16_t)xpti::trace_point_type_t::function_with_args_begin,
153-
GPIArgCallEvent, nullptr, CorrelationID, &Payload);
154-
}
155-
#endif
156-
return CorrelationID;
157-
}
158-
159-
void emitFunctionWithArgsEndTrace(uint64_t CorrelationID, uint32_t FuncID,
160-
const char *FuncName, unsigned char *ArgsData,
161-
pi_result Result) {
162-
#ifdef XPTI_ENABLE_INSTRUMENTATION
163-
if (xptiTraceEnabled()) {
164-
uint8_t StreamID = xptiRegisterStream(SYCL_PIDEBUGCALL_STREAM_NAME);
165-
166-
xpti::function_with_args_t Payload{FuncID, FuncName, ArgsData, &Result,
167-
nullptr};
168-
169-
xptiNotifySubscribers(
170-
StreamID, (uint16_t)xpti::trace_point_type_t::function_with_args_end,
171-
GPIArgCallEvent, nullptr, CorrelationID, &Payload);
172-
}
173-
#endif
174-
}
175-
176138
void contextSetExtendedDeleter(const cl::sycl::context &context,
177139
pi_context_extended_deleter func,
178140
void *user_data) {
@@ -481,14 +443,6 @@ static void initializePlugins(std::vector<plugin> *Plugins) {
481443
GPICallEvent =
482444
xptiMakeEvent("PI Layer", &PIPayload, xpti::trace_algorithm_event,
483445
xpti_at::active, &PiInstanceNo);
484-
485-
xptiInitialize(SYCL_PIDEBUGCALL_STREAM_NAME, GMajVer, GMinVer, GVerStr);
486-
xpti::payload_t PIArgPayload(
487-
"Plugin Interface Layer (with function arguments)");
488-
uint64_t PiArgInstanceNo;
489-
GPIArgCallEvent = xptiMakeEvent("PI Layer with arguments", &PIArgPayload,
490-
xpti::trace_algorithm_event, xpti_at::active,
491-
&PiArgInstanceNo);
492446
#endif
493447
}
494448

sycl/source/detail/plugin.hpp

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <CL/sycl/backend_types.hpp>
1111
#include <CL/sycl/detail/common.hpp>
1212
#include <CL/sycl/detail/pi.hpp>
13-
#include <CL/sycl/detail/type_traits.hpp>
1413
#include <CL/sycl/stl.hpp>
1514
#include <detail/plugin_printers.hpp>
1615
#include <memory>
@@ -26,62 +25,7 @@ namespace sycl {
2625
namespace detail {
2726
#ifdef XPTI_ENABLE_INSTRUMENTATION
2827
extern xpti::trace_event_data_t *GPICallEvent;
29-
extern xpti::trace_event_data_t *GPIArgCallEvent;
3028
#endif
31-
32-
template <PiApiKind Kind, size_t Idx, typename... Args>
33-
struct array_fill_helper;
34-
35-
template <PiApiKind Kind> struct PiApiArgTuple;
36-
37-
#define _PI_API(api) \
38-
template <> struct PiApiArgTuple<PiApiKind::api> { \
39-
using type = typename function_traits<decltype(api)>::args_type; \
40-
};
41-
42-
#include <CL/sycl/detail/pi.def>
43-
#undef _PI_API
44-
45-
template <PiApiKind Kind, size_t Idx, typename T>
46-
struct array_fill_helper<Kind, Idx, T> {
47-
static void fill(unsigned char *Dst, T &&Arg) {
48-
using ArgsTuple = typename PiApiArgTuple<Kind>::type;
49-
// C-style cast is required here.
50-
auto RealArg = (std::tuple_element_t<Idx, ArgsTuple>)(Arg);
51-
*(std::remove_cv_t<std::tuple_element_t<Idx, ArgsTuple>> *)Dst = RealArg;
52-
}
53-
};
54-
55-
template <PiApiKind Kind, size_t Idx, typename T, typename... Args>
56-
struct array_fill_helper<Kind, Idx, T, Args...> {
57-
static void fill(unsigned char *Dst, const T &&Arg, Args &&... Rest) {
58-
using ArgsTuple = typename PiApiArgTuple<Kind>::type;
59-
// C-style cast is required here.
60-
auto RealArg = (std::tuple_element_t<Idx, ArgsTuple>)(Arg);
61-
*(std::remove_cv_t<std::tuple_element_t<Idx, ArgsTuple>> *)Dst = RealArg;
62-
array_fill_helper<Kind, Idx + 1, Args...>::fill(
63-
Dst + sizeof(decltype(RealArg)), std::forward<Args>(Rest)...);
64-
}
65-
};
66-
67-
template <typename... Ts>
68-
constexpr size_t totalSize(const std::tuple<Ts...> &) {
69-
return (sizeof(Ts) + ...);
70-
}
71-
72-
template <PiApiKind Kind, typename... ArgsT>
73-
auto packCallArguments(ArgsT &&... Args) {
74-
using ArgsTuple = typename PiApiArgTuple<Kind>::type;
75-
76-
constexpr size_t TotalSize = totalSize(ArgsTuple{});
77-
78-
std::array<unsigned char, TotalSize> ArgsData;
79-
array_fill_helper<Kind, 0, ArgsT...>::fill(ArgsData.data(),
80-
std::forward<ArgsT>(Args)...);
81-
82-
return ArgsData;
83-
}
84-
8529
/// The plugin class provides a unified interface to the underlying low-level
8630
/// runtimes for the device-agnostic SYCL runtime.
8731
///
@@ -141,10 +85,6 @@ class plugin {
14185
// the per_instance_user_data field.
14286
const char *PIFnName = PiCallInfo.getFuncName();
14387
uint64_t CorrelationID = pi::emitFunctionBeginTrace(PIFnName);
144-
auto ArgsData =
145-
packCallArguments<PiApiOffset>(std::forward<ArgsT>(Args)...);
146-
uint64_t CorrelationIDWithArgs = pi::emitFunctionWithArgsBeginTrace(
147-
static_cast<uint32_t>(PiApiOffset), PIFnName, ArgsData.data());
14888
#endif
14989
RT::PiResult R;
15090
if (pi::trace(pi::TraceLevel::PI_TRACE_CALLS)) {
@@ -163,9 +103,6 @@ class plugin {
163103
#ifdef XPTI_ENABLE_INSTRUMENTATION
164104
// Close the function begin with a call to function end
165105
pi::emitFunctionEndTrace(CorrelationID, PIFnName);
166-
pi::emitFunctionWithArgsEndTrace(CorrelationIDWithArgs,
167-
static_cast<uint32_t>(PiApiOffset),
168-
PIFnName, ArgsData.data(), R);
169106
#endif
170107
return R;
171108
}

sycl/tools/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
add_subdirectory(sycl-ls)
2-
add_subdirectory(pi-trace)
32

43
# TODO: move each tool in its own sub-directory
54
add_executable(get_device_count_by_type get_device_count_by_type.cpp)

sycl/tools/pi-trace/CMakeLists.txt

Lines changed: 0 additions & 14 deletions
This file was deleted.

sycl/tools/pi-trace/pi_trace.cpp

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)