Bring naming on par with the spec (hsa-runtime)
Change-Id: Ie1903c90a195cf95b186eb5552131a20af408adf
Cette révision appartient à :
révisé par
Konstantin Zhuravlyov
Parent
0d9e71a63a
révision
7ef70f7eaa
@@ -106,18 +106,30 @@ class Isa final: public amd::hsa::common::Signed<0xB13594F2BD8F212D> {
|
||||
const Version &version() const {
|
||||
return version_;
|
||||
}
|
||||
/// @returns True if this Isa has xnack enabled, false otherwise.
|
||||
const bool &xnackEnabled() const {
|
||||
return xnackEnabled_;
|
||||
}
|
||||
/// @returns This Isa's supported wavefront.
|
||||
const Wavefront &wavefront() const {
|
||||
return wavefront_;
|
||||
}
|
||||
|
||||
/// @returns This Isa's vendor.
|
||||
std::string GetVendor() const {
|
||||
return "AMD";
|
||||
}
|
||||
/// @returns This Isa's architecture.
|
||||
std::string GetArchitecture() const {
|
||||
return "AMDGPU";
|
||||
return "amdgcn";
|
||||
}
|
||||
/// @returns This Isa's vendor.
|
||||
std::string GetVendor() const {
|
||||
return "amd";
|
||||
}
|
||||
/// @returns This Isa's OS.
|
||||
std::string GetOS() const {
|
||||
return "amdhsa";
|
||||
}
|
||||
/// @returns This Isa's environment.
|
||||
std::string GetEnvironment() const {
|
||||
return "";
|
||||
}
|
||||
/// @returns This Isa's major version.
|
||||
int32_t GetMajorVersion() const {
|
||||
@@ -140,7 +152,8 @@ class Isa final: public amd::hsa::common::Signed<0xB13594F2BD8F212D> {
|
||||
/// otherwise.
|
||||
bool IsCompatible(const Isa *isa_object) const {
|
||||
assert(isa_object);
|
||||
return version_ == isa_object->version_;
|
||||
return version_ == isa_object->version_ &&
|
||||
xnackEnabled_ == isa_object->xnackEnabled_;
|
||||
}
|
||||
/// @returns True if this Isa is compatible with @p isa_handle, false
|
||||
/// otherwise.
|
||||
|
||||
@@ -1821,6 +1821,71 @@ hsa_status_t hsa_code_object_destroy(
|
||||
CATCH;
|
||||
}
|
||||
|
||||
static std::string ConvertOldTargetNameToNew(
|
||||
const std::string &OldName, bool IsFinalizer, uint32_t EFlags) {
|
||||
std::string NewName = "";
|
||||
|
||||
// FIXME #1: Should 9:0:3 be completely (loader, sc, etc.) removed?
|
||||
// FIXME #2: What does PAL do with respect to boltzmann/usual fiji/tonga?
|
||||
if (OldName == "AMD:AMDGPU:7:0:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx700";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:1")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx701";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:2")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx702";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:3")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx703";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:4")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx704";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx800";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:1")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx801";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:2")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx802";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:3")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx803";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:4")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx804";
|
||||
else if (OldName == "AMD:AMDGPU:8:1:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx810";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx900";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:1")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx900";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:2")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx902";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:3")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx902";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:4")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx904";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:6")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx906";
|
||||
else
|
||||
assert(false && "Unhandled target");
|
||||
|
||||
if (IsFinalizer && (EFlags & EF_AMDGPU_XNACK)) {
|
||||
NewName = NewName + "+xnack";
|
||||
} else {
|
||||
if (EFlags != 0 && (EFlags & EF_AMDGPU_XNACK_LC)) {
|
||||
NewName = NewName + "+xnack";
|
||||
} else {
|
||||
if (OldName == "AMD:AMDGPU:8:0:1")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:8:1:0")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:1")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:2")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:3")
|
||||
NewName = NewName + "+xnack";
|
||||
}
|
||||
}
|
||||
|
||||
return NewName;
|
||||
}
|
||||
|
||||
/* deprecated */
|
||||
hsa_status_t hsa_code_object_get_info(
|
||||
hsa_code_object_t code_object,
|
||||
@@ -1857,27 +1922,12 @@ hsa_status_t hsa_code_object_get_info(
|
||||
// Only finalizer generated the "HSAIL" note.
|
||||
IsFinalizer = false;
|
||||
}
|
||||
if (IsFinalizer && (code->EFlags() & EF_AMDGPU_XNACK)) {
|
||||
isa_name_str = isa_name_str + "-xnack";
|
||||
} else {
|
||||
if (code->EFlags() != 0 && (code->EFlags() & EF_AMDGPU_XNACK_LC)) {
|
||||
isa_name_str = isa_name_str + "-xnack";
|
||||
} else {
|
||||
if (isa_name_str == "AMD:AMDGPU:8:0:1")
|
||||
isa_name_str = isa_name_str + "-xnack";
|
||||
else if (isa_name_str == "AMD:AMDGPU:8:1:0")
|
||||
isa_name_str = isa_name_str + "-xnack";
|
||||
else if (isa_name_str == "AMD:AMDGPU:9:0:1")
|
||||
isa_name_str = isa_name_str + "-xnack";
|
||||
else if (isa_name_str == "AMD:AMDGPU:9:0:2")
|
||||
isa_name_str = isa_name_str + "-xnack";
|
||||
else if (isa_name_str == "AMD:AMDGPU:9:0:3")
|
||||
isa_name_str = isa_name_str + "-xnack";
|
||||
}
|
||||
}
|
||||
|
||||
std::string new_isa_name_str =
|
||||
ConvertOldTargetNameToNew(isa_name_str, IsFinalizer, code->EFlags());
|
||||
|
||||
hsa_isa_t isa_handle = {0};
|
||||
status = HSA::hsa_isa_from_name(isa_name_str.c_str(), &isa_handle);
|
||||
status = HSA::hsa_isa_from_name(new_isa_name_str.c_str(), &isa_handle);
|
||||
if (status != HSA_STATUS_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -67,13 +67,12 @@ bool Wavefront::GetInfo(
|
||||
|
||||
std::string Isa::GetFullName() const {
|
||||
std::stringstream full_name;
|
||||
full_name << GetVendor() << ":" << GetArchitecture() << ":"
|
||||
<< GetMajorVersion() << ":" << GetMinorVersion() << ":"
|
||||
<< GetStepping();
|
||||
full_name << GetArchitecture() << "-" << GetVendor() << "-" << GetOS() << "-"
|
||||
<< GetEnvironment() << "-gfx" << GetMajorVersion()
|
||||
<< GetMinorVersion() << GetStepping();
|
||||
|
||||
if (xnackEnabled_) {
|
||||
full_name << "-xnack";
|
||||
}
|
||||
if (xnackEnabled_)
|
||||
full_name << "+xnack";
|
||||
|
||||
return full_name.str();
|
||||
}
|
||||
@@ -206,14 +205,11 @@ const IsaRegistry::IsaMap IsaRegistry::GetSupportedIsas() {
|
||||
ISAREG_ENTRY_GEN(8, 0, 1, true)
|
||||
ISAREG_ENTRY_GEN(8, 0, 2, false)
|
||||
ISAREG_ENTRY_GEN(8, 0, 3, false)
|
||||
ISAREG_ENTRY_GEN(8, 1, 0, true)
|
||||
ISAREG_ENTRY_GEN(9, 0, 0, false)
|
||||
ISAREG_ENTRY_GEN(9, 0, 1, false)
|
||||
ISAREG_ENTRY_GEN(9, 0, 2, true)
|
||||
ISAREG_ENTRY_GEN(9, 0, 3, false)
|
||||
ISAREG_ENTRY_GEN(9, 0, 4, false)
|
||||
ISAREG_ENTRY_GEN(9, 0, 5, false)
|
||||
ISAREG_ENTRY_GEN(9, 0, 6, false)
|
||||
ISAREG_ENTRY_GEN(9, 0, 7, false)
|
||||
|
||||
return supported_isas;
|
||||
}
|
||||
|
||||
@@ -1016,6 +1016,71 @@ static uint32_t NextCodeObjectNum()
|
||||
return dumpN++;
|
||||
}
|
||||
|
||||
static std::string ConvertOldTargetNameToNew(
|
||||
const std::string &OldName, bool IsFinalizer, uint32_t EFlags) {
|
||||
std::string NewName = "";
|
||||
|
||||
// FIXME #1: Should 9:0:3 be completely (loader, sc, etc.) removed?
|
||||
// FIXME #2: What does PAL do with respect to boltzmann/usual fiji/tonga?
|
||||
if (OldName == "AMD:AMDGPU:7:0:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx700";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:1")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx701";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:2")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx702";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:3")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx703";
|
||||
else if (OldName == "AMD:AMDGPU:7:0:4")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx704";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx800";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:1")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx801";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:2")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx802";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:3")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx803";
|
||||
else if (OldName == "AMD:AMDGPU:8:0:4")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx804";
|
||||
else if (OldName == "AMD:AMDGPU:8:1:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx810";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:0")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx900";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:1")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx900";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:2")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx902";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:3")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx902";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:4")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx904";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:6")
|
||||
NewName = "amdgcn-amd-amdhsa--gfx906";
|
||||
else
|
||||
assert(false && "Unhandled target");
|
||||
|
||||
if (IsFinalizer && (EFlags & EF_AMDGPU_XNACK)) {
|
||||
NewName = NewName + "+xnack";
|
||||
} else {
|
||||
if (EFlags != 0 && (EFlags & EF_AMDGPU_XNACK_LC)) {
|
||||
NewName = NewName + "+xnack";
|
||||
} else {
|
||||
if (OldName == "AMD:AMDGPU:8:0:1")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:8:1:0")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:1")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:2")
|
||||
NewName = NewName + "+xnack";
|
||||
else if (OldName == "AMD:AMDGPU:9:0:3")
|
||||
NewName = NewName + "+xnack";
|
||||
}
|
||||
}
|
||||
|
||||
return NewName;
|
||||
}
|
||||
|
||||
hsa_status_t ExecutableImpl::LoadCodeObject(
|
||||
hsa_agent_t agent,
|
||||
hsa_code_object_t code_object,
|
||||
@@ -1118,26 +1183,29 @@ hsa_status_t ExecutableImpl::LoadCodeObject(
|
||||
if (majorVersion != 1 && majorVersion != 2) { return HSA_STATUS_ERROR_INVALID_CODE_OBJECT; }
|
||||
if (agent.handle == 0 && majorVersion == 1) { return HSA_STATUS_ERROR_INVALID_AGENT; }
|
||||
|
||||
if (majorVersion == 2 && (code->EFlags() & EF_AMDGPU_XNACK_LC))
|
||||
codeIsa = codeIsa + "-xnack";
|
||||
|
||||
hsa_isa_t objectsIsa = context_->IsaFromName(codeIsa.c_str());
|
||||
if (!objectsIsa.handle) { return HSA_STATUS_ERROR_INVALID_ISA_NAME; }
|
||||
|
||||
if (agent.handle != 0 && !context_->IsaSupportedByAgent(agent, objectsIsa)) { return HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS; }
|
||||
|
||||
bool IsFinalizer = true;
|
||||
uint32_t codeHsailMajor;
|
||||
uint32_t codeHsailMinor;
|
||||
hsa_profile_t codeProfile;
|
||||
hsa_machine_model_t codeMachineModel;
|
||||
hsa_default_float_rounding_mode_t codeRoundingMode;
|
||||
if (!code->GetNoteHsail(&codeHsailMajor, &codeHsailMinor, &codeProfile, &codeMachineModel, &codeRoundingMode)) {
|
||||
// Only finalizer generated the "HSAIL" note.
|
||||
IsFinalizer = false;
|
||||
codeProfile = HSA_PROFILE_FULL;
|
||||
}
|
||||
if (profile_ != codeProfile) {
|
||||
return HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS;
|
||||
}
|
||||
|
||||
codeIsa = ConvertOldTargetNameToNew(codeIsa, IsFinalizer, code->EFlags());
|
||||
hsa_isa_t objectsIsa = context_->IsaFromName(codeIsa.c_str());
|
||||
if (!objectsIsa.handle) { return HSA_STATUS_ERROR_INVALID_ISA_NAME; }
|
||||
|
||||
if (agent.handle != 0 && !context_->IsaSupportedByAgent(agent, objectsIsa)) {
|
||||
return HSA_STATUS_ERROR_INCOMPATIBLE_ARGUMENTS;
|
||||
}
|
||||
|
||||
hsa_status_t status;
|
||||
|
||||
objects.push_back(new LoadedCodeObjectImpl(this, agent, code->ElfData(), code->ElfSize()));
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur