From 62c0a6f23ea6db591e956673eeba230937467fa2 Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 1 Jul 2019 16:23:41 -0400
Subject: [PATCH] P4 to Git Change 1928320 by slinder1@slinder1-fiji-ocllc on
2019/07/01 16:20:37
SWDEV-161424 - Always enable and collect Comgr logging
Restore changelist 1853517, which was backed out in changelist 1861649
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#49 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.hpp#29 edit
---
rocclr/runtime/device/devprogram.cpp | 55 +++++++++++-----------------
rocclr/runtime/device/devprogram.hpp | 4 +-
2 files changed, 23 insertions(+), 36 deletions(-)
diff --git a/rocclr/runtime/device/devprogram.cpp b/rocclr/runtime/device/devprogram.cpp
index b4d43d6406..bb91aa3892 100644
--- a/rocclr/runtime/device/devprogram.cpp
+++ b/rocclr/runtime/device/devprogram.cpp
@@ -200,19 +200,17 @@ std::unique_ptr Program::newCompilerInstance() {
// If buildLog is not null, and dataSet contains a log object, extract the
// first log data object from dataSet and process it with
// extractByteCodeBinary.
-void Program::extractBuildLog(const char* buildLog, amd_comgr_data_set_t dataSet) {
+void Program::extractBuildLog(amd_comgr_data_set_t dataSet) {
amd_comgr_status_t status = AMD_COMGR_STATUS_SUCCESS;
- if (buildLog != nullptr) {
- size_t count;
- status = amd::Comgr::action_data_count(dataSet, AMD_COMGR_DATA_KIND_LOG, &count);
+ size_t count;
+ status = amd::Comgr::action_data_count(dataSet, AMD_COMGR_DATA_KIND_LOG, &count);
- if (status == AMD_COMGR_STATUS_SUCCESS && count > 0) {
- char* logData = nullptr;
- size_t logSize;
- status = extractByteCodeBinary(dataSet, AMD_COMGR_DATA_KIND_LOG, "", &logData, &logSize);
- buildLog_ += logData;
- free(logData);
- }
+ if (status == AMD_COMGR_STATUS_SUCCESS && count > 0) {
+ char* logData = nullptr;
+ size_t logSize;
+ status = extractByteCodeBinary(dataSet, AMD_COMGR_DATA_KIND_LOG, "", &logData, &logSize);
+ buildLog_ += logData;
+ free(logData);
}
if (status != AMD_COMGR_STATUS_SUCCESS) {
buildLog_ += "Warning: extracting build log failed.\n";
@@ -377,6 +375,10 @@ amd_comgr_status_t Program::createAction(const amd_comgr_language_t oclver,
status = amd::Comgr::action_info_set_option_list(*action, optionsArgv.data(), optionsArgv.size());
}
+ if (status == AMD_COMGR_STATUS_SUCCESS) {
+ status = amd::Comgr::action_info_set_logging(*action, true);
+ }
+
return status;
}
@@ -401,11 +403,6 @@ bool Program::linkLLVMBitcode(const amd_comgr_data_set_t inputs,
amd_comgr_status_t status = createAction(oclver, targetIdent, options, &action, &hasAction);
- const char* buildLog = amdOptions->oVariables->BuildLog;
- if (status == AMD_COMGR_STATUS_SUCCESS && buildLog != nullptr) {
- status = amd::Comgr::action_info_set_logging(action, true);
- }
-
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::create_data_set(&dataSetDevLibs);
}
@@ -414,12 +411,12 @@ bool Program::linkLLVMBitcode(const amd_comgr_data_set_t inputs,
hasDataSetDevLibs = true;
status = amd::Comgr::do_action(AMD_COMGR_ACTION_ADD_DEVICE_LIBRARIES, action, inputs,
dataSetDevLibs);
- extractBuildLog(buildLog, dataSetDevLibs);
+ extractBuildLog(dataSetDevLibs);
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::do_action(AMD_COMGR_ACTION_LINK_BC_TO_BC, action, dataSetDevLibs, *output);
- extractBuildLog(buildLog, *output);
+ extractBuildLog(*output);
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
@@ -465,11 +462,6 @@ bool Program::compileToLLVMBitcode(const amd_comgr_data_set_t inputs,
amd_comgr_status_t status = createAction(oclver, targetIdent, options, &action, &hasAction);
- const char* buildLog = amdOptions->oVariables->BuildLog;
- if (status == AMD_COMGR_STATUS_SUCCESS && buildLog != nullptr) {
- status = amd::Comgr::action_info_set_logging(action, true);
- }
-
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::create_data_set(&output);
}
@@ -497,7 +489,7 @@ bool Program::compileToLLVMBitcode(const amd_comgr_data_set_t inputs,
hasDataSetPreprocessor = true;
status = amd::Comgr::do_action(AMD_COMGR_ACTION_SOURCE_TO_PREPROCESSOR,
action, inputs, dataSetPreprocessor);
- extractBuildLog(buildLog, dataSetPreprocessor);
+ extractBuildLog(dataSetPreprocessor);
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
@@ -515,14 +507,14 @@ bool Program::compileToLLVMBitcode(const amd_comgr_data_set_t inputs,
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::do_action(AMD_COMGR_ACTION_ADD_PRECOMPILED_HEADERS,
action, inputs, dataSetPCH);
- extractBuildLog(buildLog, dataSetPCH);
+ extractBuildLog(dataSetPCH);
}
// Compiling the source codes with precompiled headers
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::do_action(AMD_COMGR_ACTION_COMPILE_SOURCE_TO_BC,
action, dataSetPCH, output);
- extractBuildLog(buildLog, output);
+ extractBuildLog(output);
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
@@ -571,11 +563,6 @@ bool Program::compileAndLinkExecutable(const amd_comgr_data_set_t inputs,
amd_comgr_status_t status = createAction(AMD_COMGR_LANGUAGE_NONE, targetIdent, options,
&action, &hasAction);
- const char* buildLog = amdOptions->oVariables->BuildLog;
- if (status == AMD_COMGR_STATUS_SUCCESS && buildLog != nullptr) {
- status = amd::Comgr::action_info_set_logging(action, true);
- }
-
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::create_data_set(&output);
}
@@ -593,7 +580,7 @@ bool Program::compileAndLinkExecutable(const amd_comgr_data_set_t inputs,
hasAssemblyData = true;
status = amd::Comgr::do_action(AMD_COMGR_ACTION_CODEGEN_BC_TO_ASSEMBLY,
action, inputs, assemblyData);
- extractBuildLog(buildLog, assemblyData);
+ extractBuildLog(assemblyData);
}
// dump the ISA
@@ -617,7 +604,7 @@ bool Program::compileAndLinkExecutable(const amd_comgr_data_set_t inputs,
hasRelocatableData = true;
status = amd::Comgr::do_action(AMD_COMGR_ACTION_CODEGEN_BC_TO_RELOCATABLE,
action, inputs, relocatableData);
- extractBuildLog(buildLog, relocatableData);
+ extractBuildLog(relocatableData);
}
// Create executable from the relocatable data set
@@ -625,7 +612,7 @@ bool Program::compileAndLinkExecutable(const amd_comgr_data_set_t inputs,
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::do_action(AMD_COMGR_ACTION_LINK_RELOCATABLE_TO_EXECUTABLE,
action, relocatableData, output);
- extractBuildLog(buildLog, output);
+ extractBuildLog(output);
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
diff --git a/rocclr/runtime/device/devprogram.hpp b/rocclr/runtime/device/devprogram.hpp
index f5479136a7..68de7babb1 100644
--- a/rocclr/runtime/device/devprogram.hpp
+++ b/rocclr/runtime/device/devprogram.hpp
@@ -340,8 +340,8 @@ class Program : public amd::HeapObject {
bool linkImplHSAIL(amd::option::Options* options);
#if defined(USE_COMGR_LIBRARY)
- //! Dump the log data object to the build log, if both are present
- void extractBuildLog(const char* buildLog, amd_comgr_data_set_t dataSet);
+ //! Dump the log data object to the build log, if a log data object is present
+ void extractBuildLog(amd_comgr_data_set_t dataSet);
//! Dump the code object data
amd_comgr_status_t extractByteCodeBinary(const amd_comgr_data_set_t inDataSet,
const amd_comgr_data_kind_t dataKind, const std::string& outFileName,