mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
Fix concatenation of FE/BE compilation log strings
Due to the mixed usage of `std::string` objects and C-strings, null terminator characters sometimes propagate into possible `program::updateBuildLog()` inputs. In particular, `TranslationOutput::frontendCompilerLog` and `::backendCompilerLog` get set this way within the `CompilerInterface::build()` API implementation. This becomes an issue whenever each of CL -> IR and IR -> ISA compilation steps emits their warnings and/or errors: `clGetProgramBuildInfo(..., CL_PROGRAM_BUILD_LOG, ...)` also relies on `std::string` to C-string conversion, so the output is trimmed at the first null terminator, i.e. the BE part of the build log simply gets lost. The change handles possible null terminators within `program::updateBuildLog()` and adds relevant regression tests. Related-To: IGC-6509 Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6ebdc51fae
commit
6f3503af38
@@ -278,7 +278,8 @@ cl_int Program::getSource(std::string &binary) const {
|
||||
|
||||
void Program::updateBuildLog(uint32_t rootDeviceIndex, const char *pErrorString,
|
||||
size_t errorStringSize) {
|
||||
ConstStringRef errorString(pErrorString, errorStringSize);
|
||||
auto isTerminator = [](char c) { return c == '\0'; };
|
||||
auto errorString = ConstStringRef(pErrorString, errorStringSize).trimEnd(isTerminator);
|
||||
if (errorString.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user