Skip to content

[XPTI][SYCL] Fix Windows build issue #4143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
24 changes: 15 additions & 9 deletions sycl/tools/pi-trace/pi_trace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ std::mutex GIOMutex;

sycl::xpti_helpers::PiArgumentsHandler ArgHandler;

#if defined(_WIN64) || defined(_WIN32) /* Windows */
#define PI_TRACE_CALLBACK_API XPTI_CALLBACK_API inline
#else /* Not Windows */
#define PI_TRACE_CALLBACK_API XPTI_CALLBACK_API
#endif

// The lone callback function we are going to use to demonstrate how to attach
// the collector to the running executable
XPTI_CALLBACK_API void tpCallback(uint16_t trace_type,
Expand All @@ -37,10 +43,10 @@ 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,
const char *stream_name) {
PI_TRACE_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") {
GStreamID = xptiRegisterStream(stream_name);
xptiRegisterCallback(
Expand All @@ -62,14 +68,14 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version,
}
}

XPTI_CALLBACK_API void xptiTraceFinish(const char *stream_name) {
PI_TRACE_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) {
PI_TRACE_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) {
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