Skip to content

Commit 30db15f

Browse files
[SYCL] Fix argument printing in PI trace (#2961)
Fix an issue where PI call arguments were printed after the call has been made, which led to incorrect values reported for out pointer arguments. Fixes SYCL/Tracing/pi_tracing_test.cpp from llvm-test-suite.
1 parent 006d080 commit 30db15f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sycl/source/detail/plugin.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,19 @@ class plugin {
7676
std::string PIFnName = PiCallInfo.getFuncName();
7777
uint64_t CorrelationID = pi::emitFunctionBeginTrace(PIFnName.c_str());
7878
#endif
79-
RT::PiResult R = PiCallInfo.getFuncPtr(MPlugin)(Args...);
79+
RT::PiResult R;
8080
if (pi::trace(pi::TraceLevel::PI_TRACE_CALLS)) {
8181
std::lock_guard<std::mutex> Guard(*TracingMutex);
8282
std::string FnName = PiCallInfo.getFuncName();
8383
std::cout << "---> " << FnName << "(" << std::endl;
8484
RT::printArgs(Args...);
85+
R = PiCallInfo.getFuncPtr(MPlugin)(Args...);
8586
std::cout << ") ---> ";
8687
RT::printArgs(R);
8788
RT::printOuts(Args...);
8889
std::cout << std::endl;
90+
} else {
91+
R = PiCallInfo.getFuncPtr(MPlugin)(Args...);
8992
}
9093
#ifdef XPTI_ENABLE_INSTRUMENTATION
9194
// Close the function begin with a call to function end

0 commit comments

Comments
 (0)