P4 to Git Change 1336110 by gandryey@gera-w8 on 2016/11/03 15:21:09
SWDEV-86035 - Add PAL backend to OpenCL - Update printf initialization to match the GSL backend Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#22 edit
This commit is contained in:
@@ -544,52 +544,56 @@ HSAILKernel::initPrintf(const aclPrintfFmt* aclPrintf)
|
||||
std::string pfmt = aclPrintf->fmtStr;
|
||||
info.fmtString_.clear();
|
||||
size_t pos = 0;
|
||||
for (size_t i = 0; i < pfmt.size(); ++i) {
|
||||
char symbol = pfmt[pos++];
|
||||
if (symbol == '\\') {
|
||||
// Rest of the C escape sequences (e.g. \') are handled correctly
|
||||
// by the MDParser, we are not sure exactly how!
|
||||
switch (pfmt[pos]) {
|
||||
case 'a':
|
||||
pos++;
|
||||
symbol = '\a';
|
||||
break;
|
||||
case 'b':
|
||||
pos++;
|
||||
symbol = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
pos++;
|
||||
symbol = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
pos++;
|
||||
symbol = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
pos++;
|
||||
symbol = '\r';
|
||||
break;
|
||||
case 'v':
|
||||
pos++;
|
||||
symbol = '\v';
|
||||
break;
|
||||
case '7':
|
||||
if (pfmt[++pos] == '2') {
|
||||
pos++;
|
||||
i++;
|
||||
symbol = '\72';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
bool need_nl = true;
|
||||
for (size_t pos = 0; pos < pfmt.size(); ++pos) {
|
||||
char symbol = pfmt[pos];
|
||||
need_nl = true;
|
||||
if (symbol == '\\') {
|
||||
// Rest of the C escape sequences (e.g. \') are handled correctly
|
||||
// by the MDParser, we are not sure exactly how!
|
||||
switch (pfmt[pos + 1]) {
|
||||
case 'a':
|
||||
pos++;
|
||||
symbol = '\a';
|
||||
break;
|
||||
case 'b':
|
||||
pos++;
|
||||
symbol = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
pos++;
|
||||
symbol = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
pos++;
|
||||
symbol = '\n';
|
||||
need_nl = false;
|
||||
break;
|
||||
case 'r':
|
||||
pos++;
|
||||
symbol = '\r';
|
||||
break;
|
||||
case 'v':
|
||||
pos++;
|
||||
symbol = '\v';
|
||||
break;
|
||||
case '7':
|
||||
if (pfmt[pos + 2] == '2') {
|
||||
pos += 2;
|
||||
symbol = '\72';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
info.fmtString_.push_back(symbol);
|
||||
info.fmtString_.push_back(symbol);
|
||||
}
|
||||
if (need_nl) {
|
||||
info.fmtString_ += "\n";
|
||||
}
|
||||
info.fmtString_ += "\n";
|
||||
uint32_t *tmp_ptr = const_cast<uint32_t*>(aclPrintf->argSizes);
|
||||
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);
|
||||
}
|
||||
printf_[index] = info;
|
||||
|
||||
Referens i nytt ärende
Block a user