SWDEV-386102 - Handle code object v5
Change-Id: I47b840f484d90ca7815fb9c8af959ceaac62cf70
This commit is contained in:
1 parent
8028d327e9
commit
9b84e05427
3 files changed
+31
-26
No files matched your search
@@ -243,8 +243,7 @@ static bool getProcName(uint32_t EFlags, std::string& proc_name, bool& xnackSupp
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool getTripleTargetIDFromCodeObject(const void* code_object, std::string& target_id,
|
||||
unsigned& co_version) {
|
||||
static bool getTripleTargetIDFromCodeObject(const void* code_object, std::string& target_id) {
|
||||
if (!code_object) return false;
|
||||
const Elf64_Ehdr* ehdr = reinterpret_cast<const Elf64_Ehdr*>(code_object);
|
||||
if (ehdr->e_machine != EM_AMDGPU) return false;
|
||||
@@ -258,12 +257,12 @@ static bool getTripleTargetIDFromCodeObject(const void* code_object, std::string
|
||||
|
||||
switch (ehdr->e_ident[EI_ABIVERSION]) {
|
||||
case ELFABIVERSION_AMDGPU_HSA_V2: {
|
||||
co_version = 2;
|
||||
LogPrintfInfo("[Code Object V2, target id:%s]", target_id.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
case ELFABIVERSION_AMDGPU_HSA_V3: {
|
||||
co_version = 3;
|
||||
LogPrintfInfo("[Code Object V3, target id:%s]", target_id.c_str());
|
||||
if (isSramEccSupported) {
|
||||
if (ehdr->e_flags & EF_AMDGPU_FEATURE_SRAMECC_V3)
|
||||
target_id += ":sramecc+";
|
||||
@@ -279,8 +278,13 @@ static bool getTripleTargetIDFromCodeObject(const void* code_object, std::string
|
||||
break;
|
||||
}
|
||||
|
||||
case ELFABIVERSION_AMDGPU_HSA_V4: {
|
||||
co_version = 4;
|
||||
case ELFABIVERSION_AMDGPU_HSA_V4:
|
||||
case ELFABIVERSION_AMDGPU_HSA_V5: {
|
||||
if (ehdr->e_ident[EI_ABIVERSION] & ELFABIVERSION_AMDGPU_HSA_V4) {
|
||||
LogPrintfInfo("[Code Object V4, target id:%s]", target_id.c_str());
|
||||
} else {
|
||||
LogPrintfInfo("[Code Object V5, target id:%s]", target_id.c_str());
|
||||
}
|
||||
unsigned co_sram_value = (ehdr->e_flags) & EF_AMDGPU_FEATURE_SRAMECC_V4;
|
||||
if (co_sram_value == EF_AMDGPU_FEATURE_SRAMECC_OFF_V4)
|
||||
target_id += ":sramecc-";
|
||||
@@ -348,18 +352,17 @@ static bool getTargetIDValue(std::string& input, std::string& processor, char& s
|
||||
}
|
||||
|
||||
static bool getTripleTargetID(std::string bundled_co_entry_id, const void* code_object,
|
||||
std::string& co_triple_target_id, unsigned& co_version) {
|
||||
std::string& co_triple_target_id) {
|
||||
std::string offload_kind = trimName(bundled_co_entry_id, '-');
|
||||
if (offload_kind != OFFLOAD_KIND_HIPV4 && offload_kind != OFFLOAD_KIND_HIP &&
|
||||
offload_kind != OFFLOAD_KIND_HCC)
|
||||
return false;
|
||||
|
||||
if (offload_kind != OFFLOAD_KIND_HIPV4)
|
||||
return getTripleTargetIDFromCodeObject(code_object, co_triple_target_id, co_version);
|
||||
return getTripleTargetIDFromCodeObject(code_object, co_triple_target_id);
|
||||
|
||||
// For code object V4 onwards the bundled code object entry ID correctly
|
||||
// specifies the target tripple.
|
||||
co_version = 4;
|
||||
// specifies the target triple.
|
||||
co_triple_target_id = bundled_co_entry_id.substr(1);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user