Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 4 additions & 1 deletion sycl/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
add_subdirectory(sycl-ls)
add_subdirectory(pi-trace)

if (SYCL_ENABLE_XPTI_TRACING)
add_subdirectory(pi-trace)
endif()

# TODO: move each tool in its own sub-directory
add_executable(get_device_count_by_type get_device_count_by_type.cpp)
Expand Down
20 changes: 10 additions & 10 deletions sycl/tools/pi-trace/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
add_library(pi_trace SHARED pi_trace.cpp)
target_compile_definitions(pi_trace PRIVATE XPTI_CALLBACK_API_EXPORTS)
target_link_libraries(pi_trace PRIVATE xptifw)
target_include_directories(pi_trace PRIVATE "${XPTI_SOURCE_DIR}/include")
target_include_directories(pi_trace PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../xpti_helpers/")
target_include_directories(pi_trace PRIVATE "${sycl_inc_dir}")
target_include_directories(pi_trace PRIVATE "${sycl_src_dir}")

if(UNIX)
target_link_libraries(pi_trace PRIVATE dl)
if (TARGET OpenCL-Headers)
target_link_libraries(pi_trace PRIVATE OpenCL-Headers)
endif()

if (XPTI_ENABLE_TBB)
target_link_libraries(pi_trace PRIVATE tbb)
endif()
target_include_directories(pi_trace PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../xpti_helpers/"
"${sycl_inc_dir}"
"${sycl_src_dir}"
)

add_dependencies(sycl-toolchain pi_trace)
16 changes: 8 additions & 8 deletions sycl/tools/pi-trace/pi_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ XPTI_CALLBACK_API void tpCallback(uint16_t trace_type,
// Based on the documentation, every subscriber MUST implement the
// xptiTraceInit() and xptiTraceFinish() APIs for their subscriber collector to
// be loaded successfully.
XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
unsigned int minor_version,
const char *version_str,
XPTI_CALLBACK_API void xptiTraceInit(unsigned int /*major_version*/,
unsigned int /*minor_version*/,
const char * /*version_str*/,
const char *stream_name) {
if (std::string_view(stream_name) == "sycl.pi.arg") {
if (std::string_view(stream_name) == "sycl.pi.debug") {
GStreamID = xptiRegisterStream(stream_name);
xptiRegisterCallback(
GStreamID, (uint16_t)xpti::trace_point_type_t::function_with_args_begin,
Expand All @@ -62,14 +62,14 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
}
}

XPTI_CALLBACK_API void xptiTraceFinish(const char *stream_name) {
XPTI_CALLBACK_API void xptiTraceFinish(const char * /*stream_name*/) {
// NOP
}

XPTI_CALLBACK_API void tpCallback(uint16_t TraceType,
xpti::trace_event_data_t *Parent,
xpti::trace_event_data_t *Event,
uint64_t Instance, const void *UserData) {
xpti::trace_event_data_t * /*Parent*/,
xpti::trace_event_data_t * /*Event*/,
uint64_t /*Instance*/, const void *UserData) {
auto Type = static_cast<xpti::trace_point_type_t>(TraceType);
if (Type == xpti::trace_point_type_t::function_with_args_end) {
// Lock while we print information
Expand Down
14 changes: 8 additions & 6 deletions xptifw/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
file(GLOB SOURCES *.cpp)
include_directories(${XPTIFW_DIR}/include)
include_directories(${XPTI_DIR}/include)

remove_definitions(-DXPTI_STATIC_LIBRARY)
add_definitions(-DXPTI_API_EXPORTS)
add_library(xptifw SHARED ${SOURCES})
if(UNIX)
target_link_libraries(xptifw PRIVATE dl)
endif()

target_include_directories(xptifw PUBLIC
$<BUILD_INTERFACE:${XPTIFW_DIR}/include>
$<BUILD_INTERFACE:${XPTI_DIR}/include>
)

target_link_libraries(xptifw PUBLIC ${CMAKE_DL_LIBS})

if (XPTI_ENABLE_TBB)
add_dependencies(xptifw tbb)
target_compile_definitions(xptifw PRIVATE XPTI_USE_TBB)
target_link_libraries(xptifw PRIVATE tbb)
target_link_libraries(xptifw PUBLIC $<BUILD_INTERFACE:tbb>)
endif()

if (SYCL_USE_LIBCXX)
Expand Down