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
120 changes: 22 additions & 98 deletions sycl/test-e2e/XPTI/Inputs/memory_info_collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,116 +30,40 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int MajorVersion,
std::cout << "xptiTraceInit: Stream Name = " << StreamName << "\n";
std::string_view NameView{StreamName};

using type = xpti::trace_point_type_t;
if (NameView == "sycl.experimental.mem_alloc") {
uint8_t StreamID = xptiRegisterStream(StreamName);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::mem_alloc_begin),
memCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::mem_alloc_end),
memCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::mem_release_begin),
memCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::mem_release_end),
memCallback);
for (type t : std::initializer_list<type>{
type::mem_alloc_begin, type::mem_alloc_end,
type::mem_release_begin, type::mem_release_end})
xptiRegisterCallback(StreamID, static_cast<uint16_t>(t), memCallback);
}

auto buffer_image_traces = std::initializer_list<type>{
type::offload_alloc_memory_object_construct,
type::offload_alloc_memory_object_associate,
type::offload_alloc_memory_object_release,
type::offload_alloc_memory_object_destruct, type::offload_alloc_accessor};
if (NameView == "sycl.experimental.buffer") {
uint8_t StreamID = xptiRegisterStream(StreamName);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_construct),
syclBufferCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_associate),
syclBufferCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_release),
syclBufferCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_destruct),
syclBufferCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::offload_alloc_accessor),
syclBufferCallback);
for (type t : buffer_image_traces)
xptiRegisterCallback(StreamID, static_cast<uint16_t>(t),
syclBufferCallback);
}
if (NameView == "sycl.experimental.image") {
uint8_t StreamID = xptiRegisterStream(StreamName);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_construct),
syclImageCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_associate),
syclImageCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_release),
syclImageCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(
xpti::trace_point_type_t::offload_alloc_memory_object_destruct),
syclImageCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::offload_alloc_accessor),
syclImageCallback);
for (type t : buffer_image_traces)
xptiRegisterCallback(StreamID, static_cast<uint16_t>(t),
syclImageCallback);
}
if (NameView == "sycl") {
uint8_t StreamID = xptiRegisterStream(StreamName);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::graph_create),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::node_create),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::edge_create),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::task_begin),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::task_end),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::signal),
syclCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::barrier_begin),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::barrier_end),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::wait_begin),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::wait_end),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::signal),
syclCallback);
for (type t : std::initializer_list<type>{
type::graph_create, type::node_create, type::edge_create,
type::task_begin, type::task_end, type::signal, type::wait_begin,
type::wait_end, type::barrier_begin, type::barrier_end,
type::diagnostics})
xptiRegisterCallback(StreamID, static_cast<uint16_t>(t), syclCallback);
}
}

Expand Down
53 changes: 11 additions & 42 deletions sycl/test-e2e/XPTI/Inputs/test_collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,54 +19,23 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int MajorVersion,
const char *StreamName) {
std::cout << "xptiTraceInit: Stream Name = " << StreamName << "\n";
std::string_view NameView{StreamName};
using type = xpti::trace_point_type_t;

if (NameView == "sycl.pi") {
uint8_t StreamID = xptiRegisterStream(StreamName);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::function_begin),
syclPiCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::function_with_args_end),
syclPiCallback);
for (type t : std::initializer_list<type>{type::function_begin,
type::function_with_args_end})
xptiRegisterCallback(StreamID, static_cast<uint16_t>(t), syclPiCallback);
}
if (NameView == "sycl") {
uint8_t StreamID = xptiRegisterStream(StreamName);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::graph_create),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::node_create),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::edge_create),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::task_begin),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::task_end),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::signal),
syclCallback);
xptiRegisterCallback(
StreamID,
static_cast<uint16_t>(xpti::trace_point_type_t::barrier_begin),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::barrier_end),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::wait_begin),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::wait_end),
syclCallback);
xptiRegisterCallback(
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::signal),
syclCallback);

for (type t : std::initializer_list<type>{
type::graph_create, type::node_create, type::edge_create,
type::task_begin, type::task_end, type::signal,
type::barrier_begin, type::barrier_end, type::wait_begin,
type::wait_end})
xptiRegisterCallback(StreamID, static_cast<uint16_t>(t), syclCallback);
}
}

Expand Down