diff --git a/sycl/tools/pi-trace/pi_trace.cpp b/sycl/tools/pi-trace/pi_trace.cpp index 3fee6fd9f13e3..062d5dc07808b 100644 --- a/sycl/tools/pi-trace/pi_trace.cpp +++ b/sycl/tools/pi-trace/pi_trace.cpp @@ -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, @@ -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( @@ -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(TraceType); if (Type == xpti::trace_point_type_t::function_with_args_end) { // Lock while we print information