P4 to Git Change 1599194 by gandryey@gera-w8 on 2018/08/28 18:38:33
SWDEV-79445 - OCL generic changes and code clean-up - Move printf setup in the kernels to the abstraction layer Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.cpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devkernel.hpp#2 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#329 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#131 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprintf.cpp#47 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprintf.hpp#16 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.cpp#238 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuprogram.hpp#71 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.cpp#62 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palkernel.hpp#21 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.cpp#10 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palprintf.hpp#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.cpp#41 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rockernel.hpp#25 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.cpp#11 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocprintf.hpp#6 edit
This commit is contained in:
@@ -3045,74 +3045,6 @@ void HSAILKernel::initHsailArgs(const aclArgData* aclArg) {
|
||||
}
|
||||
}
|
||||
|
||||
void HSAILKernel::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;
|
||||
info.fmtString_.clear();
|
||||
size_t pos = 0;
|
||||
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);
|
||||
}
|
||||
if (need_nl) {
|
||||
info.fmtString_ += "\n";
|
||||
}
|
||||
uint32_t* tmp_ptr = const_cast<uint32_t*>(aclPrintf->argSizes);
|
||||
for (uint i = 0; i < aclPrintf->numSizes; i++, tmp_ptr++) {
|
||||
info.arguments_.push_back(*tmp_ptr);
|
||||
}
|
||||
printf_[index] = info;
|
||||
info.arguments_.clear();
|
||||
}
|
||||
}
|
||||
|
||||
HSAILKernel::HSAILKernel(std::string name, HSAILProgram* prog, std::string compileOptions,
|
||||
uint extraArgsNum)
|
||||
: device::Kernel(name),
|
||||
@@ -3233,7 +3165,7 @@ bool HSAILKernel::init(amd::hsa::loader::Symbol* sym, bool finalize) {
|
||||
}
|
||||
|
||||
// Set the PrintfList
|
||||
initPrintf(reinterpret_cast<aclPrintfFmt*>(aclPrintfList));
|
||||
InitPrintf(reinterpret_cast<aclPrintfFmt*>(aclPrintfList));
|
||||
delete[] aclPrintfList;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user