Update code object handling for GSL, PAL and ROCm

- Correct GSL path to report targets using the TargetID syntax.

- Correct GSL path to check compatibility of code objects when
  loading.

- Add concept of an device isa and create a registery used by ROCm,
  PAL and GSL.

- Support XNACK and SRAMECC target features consistently for PAL and ROCm.

- Correct logic for NullDevices and asserts to avoid memory coruption.

- Allow all NullDevices to be created for HIP.

- Numerous other code improvements.

Change-Id: I40abf3d2b22249c1492d1af5919665f8184f4e0e
Bu işleme şunda yer alıyor:
Tony Tye
2021-01-10 12:17:06 +00:00
ebeveyn 4c16051f6d
işleme c7e8d91e14
30 değiştirilmiş dosya ile 1020 ekleme ve 969 silme
+26 -15
Dosyayı Görüntüle
@@ -82,7 +82,6 @@ Program::Program(amd::Device& device, amd::Program& owner)
lastBuildOptionsArg_(),
buildStatus_(CL_BUILD_NONE),
buildError_(CL_SUCCESS),
machineTarget_(nullptr),
globalVariableTotalSize_(0),
programOptions_(nullptr)
{
@@ -286,7 +285,7 @@ amd_comgr_status_t Program::createAction(const amd_comgr_language_t oclver,
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
status = amd::Comgr::action_info_set_isa_name(*action, device().info().targetId_);
status = amd::Comgr::action_info_set_isa_name(*action, device().isa().isaName().c_str());
}
if (status == AMD_COMGR_STATUS_SUCCESS) {
@@ -719,8 +718,14 @@ bool Program::compileImplHSAIL(const std::string& sourceCode,
acl_error errorCode;
aclTargetInfo target;
std::string arch = LP64_SWITCH("hsail", "hsail64");
target = aclGetTargetInfo(arch.c_str(), machineTarget_, &errorCode);
const char* arch = LP64_SWITCH("hsail", "hsail64");
const char* hsailName = device().isa().hsailName();
if (!hsailName) {
// HSAIL compiler does not support device's ISA.
LogPrintfError("HSAIL compiler does not support %s", device().isa().targetId());
return false;
}
target = aclGetTargetInfo(arch, hsailName, &errorCode);
// end if asic info is ready
// We dump the source code for each program (param: headers)
@@ -1107,7 +1112,7 @@ bool Program::linkImplLC(amd::option::Options* options) {
linkOptions.push_back("correctly_rounded_sqrt");
}
if (options->oVariables->DenormsAreZero || AMD_GPU_FORCE_SINGLE_FP_DENORM == 0 ||
(device().info().gfxipMajor_ < 9 && AMD_GPU_FORCE_SINGLE_FP_DENORM < 0)) {
(device().isa().versionMajor() < 9 && AMD_GPU_FORCE_SINGLE_FP_DENORM < 0)) {
linkOptions.push_back("daz_opt");
}
if (options->oVariables->FiniteMathOnly || options->oVariables->FastRelaxedMath) {
@@ -1365,9 +1370,7 @@ bool Program::initBuild(amd::option::Options* options) {
return false;
}
const char* devName = machineTarget_;
options->setPerBuildInfo((devName && (devName[0] != '\0')) ? devName : "gpu",
clBinary()->getEncryptCode(), true);
options->setPerBuildInfo(device().isa().targetId(), clBinary()->getEncryptCode(), true);
// Elf Binary setup
std::string outFileName;
@@ -1703,17 +1706,26 @@ int32_t Program::build(const std::string& sourceCode, const char* origOptions,
// ================================================================================================
std::vector<std::string> Program::ProcessOptions(amd::option::Options* options) {
std::string scratchStr;
std::vector<std::string> optionsVec;
if (!isLC()) {
optionsVec.push_back("-D__AMD__=1");
scratchStr.clear();
optionsVec.push_back(scratchStr.append("-D__").append(machineTarget_).append("__=1"));
std::string processorName = device().isa().processorName();
const char* hsailName = device().isa().hsailName();
const char* amdIlName = device().isa().amdIlName();
scratchStr.clear();
optionsVec.push_back(scratchStr.append("-D__").append(machineTarget_).append("=1"));
optionsVec.push_back(std::string("-D__") + processorName + "__=1");
optionsVec.push_back(std::string("-D__") + processorName + "=1");
if (hsailName && (strcmp(hsailName, processorName.c_str()) != 0)) {
optionsVec.push_back(std::string("-D__") + hsailName + "__=1");
optionsVec.push_back(std::string("-D__") + hsailName + "=1");
}
if (amdIlName && (strcmp(amdIlName, processorName.c_str()) != 0) &&
(!hsailName || strcmp(amdIlName, hsailName) != 0)) {
optionsVec.push_back(std::string("-D__") + amdIlName + "__=1");
optionsVec.push_back(std::string("-D__") + amdIlName + "=1");
}
// Set options for the standard device specific options
// All our devices support these options now
@@ -1785,8 +1797,7 @@ std::vector<std::string> Program::ProcessOptions(amd::option::Options* options)
}
} else {
for (auto e : extensions) {
scratchStr.clear();
optionsVec.push_back(scratchStr.append("-D").append(e).append("=1"));
optionsVec.push_back(std::string("-D") + e + "=1");
}
}
}