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: 7ad6787328]
This commit is contained in:
@@ -1814,14 +1814,14 @@ void Kernel::InitPrintf(const std::vector<std::string>& printfInfoStrings) {
|
|||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
#if defined(WITH_COMPILER_LIB)
|
#if defined(WITH_COMPILER_LIB)
|
||||||
void Kernel::InitPrintf(const aclPrintfFmt* aclPrintf) {
|
void Kernel::InitPrintf(const aclPrintfFmt* aclPrintf) {
|
||||||
PrintfInfo info;
|
|
||||||
uint index = 0;
|
uint index = 0;
|
||||||
for (; aclPrintf->struct_size != 0; aclPrintf++) {
|
for (; aclPrintf->struct_size != 0; aclPrintf++) {
|
||||||
index = aclPrintf->ID;
|
index = aclPrintf->ID;
|
||||||
if (printf_.size() <= index) {
|
if (printf_.size() <= index) {
|
||||||
printf_.resize(index + 1);
|
printf_.resize(index + 1);
|
||||||
}
|
}
|
||||||
std::string pfmt = aclPrintf->fmtStr;
|
PrintfInfo& info = printf_[index];
|
||||||
|
const std::string& pfmt = aclPrintf->fmtStr;
|
||||||
bool need_nl = true;
|
bool need_nl = true;
|
||||||
for (size_t pos = 0; pos < pfmt.size(); ++pos) {
|
for (size_t pos = 0; pos < pfmt.size(); ++pos) {
|
||||||
char symbol = pfmt[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++) {
|
for (uint i = 0; i < aclPrintf->numSizes; i++, tmp_ptr++) {
|
||||||
info.arguments_.push_back(*tmp_ptr);
|
info.arguments_.push_back(*tmp_ptr);
|
||||||
}
|
}
|
||||||
printf_[index] = info;
|
|
||||||
info.arguments_.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // defined(WITH_COMPILER_LIB)
|
#endif // defined(WITH_COMPILER_LIB)
|
||||||
|
|||||||
Reference in New Issue
Block a user