From 737f07fa24b8d307e91601de9cd2aa7bcefc332b Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 24 Oct 2019 13:30:53 -0400 Subject: [PATCH] P4 to Git Change 2018860 by gandryey@gera-win10 on 2019/10/24 13:29:26 SWDEV-207662 - [EURI][OPENCL][Forum 244452]: Multiple printf statements inside kernel producing strange output on Vega on Windows - Correct the printf arguments parsing logic. Don't use local PrintfInfo info, because it can contain some stale data after the first iteration Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#27 edit [ROCm/clr commit: 7ad67873284c374198af96bbc7d26a234277d2d4] --- projects/clr/rocclr/runtime/device/devkernel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/devkernel.cpp b/projects/clr/rocclr/runtime/device/devkernel.cpp index ad376df33f..0ba8aed4aa 100644 --- a/projects/clr/rocclr/runtime/device/devkernel.cpp +++ b/projects/clr/rocclr/runtime/device/devkernel.cpp @@ -1814,14 +1814,14 @@ void Kernel::InitPrintf(const std::vector& printfInfoStrings) { // ================================================================================================ #if defined(WITH_COMPILER_LIB) void Kernel::InitPrintf(const aclPrintfFmt* aclPrintf) { - PrintfInfo info; uint index = 0; for (; aclPrintf->struct_size != 0; aclPrintf++) { index = aclPrintf->ID; if (printf_.size() <= index) { printf_.resize(index + 1); } - std::string pfmt = aclPrintf->fmtStr; + PrintfInfo& info = printf_[index]; + const std::string& pfmt = aclPrintf->fmtStr; bool need_nl = true; for (size_t pos = 0; pos < pfmt.size(); ++pos) { char symbol = pfmt[pos]; @@ -1872,8 +1872,6 @@ void Kernel::InitPrintf(const aclPrintfFmt* aclPrintf) { for (uint i = 0; i < aclPrintf->numSizes; i++, tmp_ptr++) { info.arguments_.push_back(*tmp_ptr); } - printf_[index] = info; - info.arguments_.clear(); } } #endif // defined(WITH_COMPILER_LIB)