P4 to Git Change 1989679 by gandryey@gera-win10 on 2019/08/27 11:34:19
SWDEV-200422 - Teamcity built OpenCL ignores all options from LC backend - Pass LC argument into parseAllOptions() http://ocltc.amd.com/reviews/r/17884/ Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/api/v0_8/acl.cpp#50 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.cpp#46 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.hpp#22 edit ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/v0_8/libUtils.cpp#42 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/devprogram.cpp#62 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/program.cpp#103 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/program.hpp#47 edit
Этот коммит содержится в:
@@ -636,7 +636,7 @@ getOptionDesc(std::string& options, size_t StartPos, bool IsShortForm,
|
||||
|
||||
bool
|
||||
processOption(int OptDescTableIx, Options& Opts, const std::string& Value,
|
||||
bool IsPrefixOption, bool IsOffFlag)
|
||||
bool IsPrefixOption, bool IsOffFlag, bool IsLC)
|
||||
{
|
||||
OptionVariables* ovars = Opts.oVariables;
|
||||
OptionDescriptor* od = &OptDescTable[OptDescTableIx];
|
||||
@@ -786,9 +786,9 @@ processOption(int OptDescTableIx, Options& Opts, const std::string& Value,
|
||||
|
||||
Opts.clcOptions.append(" -D__FAST_RELAXED_MATH__=1");
|
||||
Opts.clangOptions.push_back("-D__FAST_RELAXED_MATH__=1");
|
||||
#if defined(WITH_LIGHTNING_COMPILER) // w/a for SWDEV-116690
|
||||
Opts.clangOptions.push_back("-cl-fast-relaxed-math");
|
||||
#endif
|
||||
if (IsLC) { // w/a for SWDEV-116690
|
||||
Opts.clangOptions.push_back("-cl-fast-relaxed-math");
|
||||
}
|
||||
|
||||
// fall-through to handle UnsafeMathOpt
|
||||
case OID_UnsafeMathOpt:
|
||||
@@ -912,12 +912,12 @@ processOption(int OptDescTableIx, Options& Opts, const std::string& Value,
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
case OID_OptUseNative:
|
||||
Opts.llvmOptions.append(" -mllvm -amdgpu-use-native=");
|
||||
Opts.llvmOptions.append(sval);
|
||||
if (IsLC) {
|
||||
Opts.llvmOptions.append(" -mllvm -amdgpu-use-native=");
|
||||
Opts.llvmOptions.append(sval);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case OID_WFComma:
|
||||
case OID_WBComma:
|
||||
@@ -940,13 +940,13 @@ processOption(int OptDescTableIx, Options& Opts, const std::string& Value,
|
||||
}
|
||||
else if (((OptionIdentifier)OptDescTableIx) == OID_WBComma) {
|
||||
Opts.llvmOptions.append(" ");
|
||||
#if defined(WITH_LIGHTNING_COMPILER)
|
||||
Opts.llvmOptions.append("-mllvm ");
|
||||
#endif
|
||||
if (IsLC) {
|
||||
Opts.llvmOptions.append("-mllvm ");
|
||||
}
|
||||
Opts.llvmOptions.append(sval);
|
||||
}
|
||||
else if (((OptionIdentifier)OptDescTableIx) == OID_WHComma) {
|
||||
Opts.finalizerOptions.push_back(sval);
|
||||
Opts.finalizerOptions.push_back(sval);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1011,7 +1011,7 @@ namespace amd {
|
||||
namespace option {
|
||||
|
||||
bool
|
||||
parseAllOptions(std::string& options, Options& Opts, bool linkOptsOnly)
|
||||
parseAllOptions(std::string& options, Options& Opts, bool linkOptsOnly, bool isLC)
|
||||
{
|
||||
Opts.origOptionStr = options;
|
||||
OptionVariables* ovars = Opts.oVariables;
|
||||
@@ -1162,7 +1162,7 @@ parseAllOptions(std::string& options, Options& Opts, bool linkOptsOnly)
|
||||
}
|
||||
|
||||
if (!processOption(option_ndx, Opts, value, isPrefix_option,
|
||||
(isPrefix_mno || isPrefix_fno))) {
|
||||
(isPrefix_mno || isPrefix_fno), isLC)) {
|
||||
// Keep the optionsLog set in processOption().
|
||||
std::string tmpStr("Invalid option: ");
|
||||
tmpStr += options.substr(bpos, (pos == std::string::npos)
|
||||
|
||||
@@ -330,9 +330,9 @@ OptionDescriptor* getOptDescTable();
|
||||
bool init();
|
||||
bool teardown();
|
||||
bool parseAllOptions(std::string& options, Options& Opts,
|
||||
bool linkOptsOnly=false);
|
||||
inline bool parseLinkOptions(std::string& options, Options& Opts) {
|
||||
return parseAllOptions(options, Opts, true/*linkOptsOnly*/);
|
||||
bool linkOptsOnly, bool isLC);
|
||||
inline bool parseLinkOptions(std::string& options, Options& Opts, bool isLC) {
|
||||
return parseAllOptions(options, Opts, true/*linkOptsOnly*/, isLC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -827,7 +827,7 @@ cloneOclElfNoBIF(const aclBinary *src) {
|
||||
amd::option::Options *sOpts = reinterpret_cast<amd::option::Options*>(
|
||||
sptr->options);
|
||||
if (sOpts) {
|
||||
parseAllOptions(sOpts->origOptionStr, *Opts);
|
||||
parseAllOptions(sOpts->origOptionStr, *Opts, false, false);
|
||||
}
|
||||
dptr->options = reinterpret_cast<aclOptions*>(Opts);
|
||||
dptr->bin = NULL;
|
||||
@@ -857,7 +857,7 @@ cloneOclElfNoBIF(const aclBinary *src) {
|
||||
amd::option::Options *sOpts = reinterpret_cast<amd::option::Options*>(
|
||||
sptr->options);
|
||||
if (sOpts) {
|
||||
parseAllOptions(sOpts->origOptionStr, *Opts);
|
||||
parseAllOptions(sOpts->origOptionStr, *Opts, false, false);
|
||||
}
|
||||
dptr->options = reinterpret_cast<aclOptions*>(Opts);
|
||||
dptr->bin = NULL;
|
||||
|
||||
@@ -2103,7 +2103,7 @@ cl_int Program::link(const std::vector<Program*>& inputPrograms, const char* ori
|
||||
buildLog_ += "Internal error: Get compile options failed.";
|
||||
}
|
||||
} else {
|
||||
if (!amd::option::parseAllOptions(compileOptions_, options)) {
|
||||
if (!amd::option::parseAllOptions(compileOptions_, options, false, isLC())) {
|
||||
buildStatus_ = CL_BUILD_ERROR;
|
||||
buildLog_ += options.optionsLog();
|
||||
LogError("Parsing compile options failed.");
|
||||
@@ -2392,7 +2392,7 @@ bool Program::getCompileOptionsAtLinking(const std::vector<Program*>& inputProgr
|
||||
|
||||
amd::option::Options compileOptions2;
|
||||
amd::option::Options* thisCompileOptions = i == 0 ? &compileOptions : &compileOptions2;
|
||||
if (!amd::option::parseAllOptions(program->compileOptions_, *thisCompileOptions)) {
|
||||
if (!amd::option::parseAllOptions(program->compileOptions_, *thisCompileOptions, false, isLC())) {
|
||||
buildLog_ += thisCompileOptions->optionsLog();
|
||||
LogError("Parsing compile options failed.");
|
||||
return false;
|
||||
@@ -2409,7 +2409,7 @@ bool Program::getCompileOptionsAtLinking(const std::vector<Program*>& inputProgr
|
||||
linkOptsCanOverwrite = true;
|
||||
} else {
|
||||
amd::option::Options thisLinkOptions;
|
||||
if (!amd::option::parseLinkOptions(program->linkOptions_, thisLinkOptions)) {
|
||||
if (!amd::option::parseLinkOptions(program->linkOptions_, thisLinkOptions, isLC())) {
|
||||
buildLog_ += thisLinkOptions.optionsLog();
|
||||
LogError("Parsing link options failed.");
|
||||
return false;
|
||||
@@ -2622,7 +2622,7 @@ aclType Program::getCompilationStagesFromBinary(std::vector<aclType>& completeSt
|
||||
}
|
||||
std::string sCurOptions = compileOptions_ + linkOptions_;
|
||||
amd::option::Options curOptions;
|
||||
if (!amd::option::parseAllOptions(sCurOptions, curOptions)) {
|
||||
if (!amd::option::parseAllOptions(sCurOptions, curOptions, false, isLC())) {
|
||||
buildLog_ += curOptions.optionsLog();
|
||||
LogError("Parsing compile options failed.");
|
||||
return ACL_TYPE_DEFAULT;
|
||||
@@ -2733,7 +2733,7 @@ aclType Program::getCompilationStagesFromBinary(std::vector<aclType>& completeSt
|
||||
}
|
||||
std::string sCurOptions = compileOptions_ + linkOptions_;
|
||||
amd::option::Options curOptions;
|
||||
if (!amd::option::parseAllOptions(sCurOptions, curOptions)) {
|
||||
if (!amd::option::parseAllOptions(sCurOptions, curOptions, false, isLC())) {
|
||||
buildLog_ += curOptions.optionsLog();
|
||||
LogError("Parsing compile options failed.");
|
||||
return ACL_TYPE_DEFAULT;
|
||||
@@ -2843,12 +2843,12 @@ aclType Program::getNextCompilationStageFromBinary(amd::option::Options* options
|
||||
linkOptions_ = sCurLinkOptions;
|
||||
|
||||
amd::option::Options curOptions, binOptions;
|
||||
if (!amd::option::parseAllOptions(sBinOptions, binOptions)) {
|
||||
if (!amd::option::parseAllOptions(sBinOptions, binOptions, false, isLC())) {
|
||||
buildLog_ += binOptions.optionsLog();
|
||||
LogError("Parsing compile options from binary failed.");
|
||||
return ACL_TYPE_DEFAULT;
|
||||
}
|
||||
if (!amd::option::parseAllOptions(sCurOptions, curOptions)) {
|
||||
if (!amd::option::parseAllOptions(sCurOptions, curOptions, false, isLC())) {
|
||||
buildLog_ += curOptions.optionsLog();
|
||||
LogError("Parsing compile options failed.");
|
||||
return ACL_TYPE_DEFAULT;
|
||||
|
||||
@@ -112,7 +112,7 @@ cl_int Program::addDeviceProgram(Device& device, const void* image, size_t lengt
|
||||
// if we have options from binary and input options was not specified
|
||||
if (opts != NULL && emptyOptions) {
|
||||
std::string sBinOptions = std::string((char*)opts, symSize);
|
||||
if (!amd::option::parseAllOptions(sBinOptions, *options)) {
|
||||
if (!amd::option::parseAllOptions(sBinOptions, *options, false, false)) {
|
||||
programLog_ = options->optionsLog();
|
||||
LogError("Parsing compilation options from binary failed.");
|
||||
return CL_INVALID_COMPILER_OPTIONS;
|
||||
@@ -155,7 +155,7 @@ cl_int Program::addDeviceProgram(Device& device, const void* image, size_t lengt
|
||||
// load the compiler options from the binary if it is not provided
|
||||
std::string sBinOptions = program->compileOptions();
|
||||
if (!sBinOptions.empty() && emptyOptions) {
|
||||
if (!amd::option::parseAllOptions(sBinOptions, *options)) {
|
||||
if (!amd::option::parseAllOptions(sBinOptions, *options, false, isLC())) {
|
||||
programLog_ = options->optionsLog();
|
||||
LogError("Parsing compilation options from binary failed.");
|
||||
return CL_INVALID_COMPILER_OPTIONS;
|
||||
@@ -595,7 +595,7 @@ int Program::GetOclCVersion(const char* clVer) {
|
||||
}
|
||||
|
||||
bool Program::ParseAllOptions(const std::string& options, option::Options& parsedOptions,
|
||||
bool optionChangable, bool linkOptsOnly) {
|
||||
bool optionChangable, bool linkOptsOnly, bool isLC) {
|
||||
std::string allOpts = options;
|
||||
if (optionChangable) {
|
||||
if (linkOptsOnly) {
|
||||
@@ -622,7 +622,7 @@ bool Program::ParseAllOptions(const std::string& options, option::Options& parse
|
||||
}
|
||||
}
|
||||
}
|
||||
return amd::option::parseAllOptions(allOpts, parsedOptions, linkOptsOnly);
|
||||
return amd::option::parseAllOptions(allOpts, parsedOptions, linkOptsOnly, isLC);
|
||||
}
|
||||
|
||||
bool Symbol::setDeviceKernel(const Device& device, const device::Kernel* func) {
|
||||
|
||||
@@ -181,8 +181,8 @@ class Program : public RuntimeObject {
|
||||
|
||||
static int GetOclCVersion(const char* clVer);
|
||||
|
||||
static bool ParseAllOptions(const std::string& options, option::Options& parsedOptions,
|
||||
bool optionChangable = true, bool linkOptsOnly = false);
|
||||
bool static ParseAllOptions(const std::string& options, option::Options& parsedOptions,
|
||||
bool optionChangable = true, bool linkOptsOnly = false, bool isLC = false);
|
||||
|
||||
void setVarInfoCallBack(VarInfoCallback callback) {
|
||||
varcallback = callback;
|
||||
|
||||
Ссылка в новой задаче
Block a user