diff --git a/projects/clr/hipamd/include/hip/hcc_detail/code_object_bundle.hpp b/projects/clr/hipamd/include/hip/hcc_detail/code_object_bundle.hpp index 89b341afa7..173a915409 100644 --- a/projects/clr/hipamd/include/hip/hcc_detail/code_object_bundle.hpp +++ b/projects/clr/hipamd/include/hip/hcc_detail/code_object_bundle.hpp @@ -31,6 +31,8 @@ THE SOFTWARE. #include #include #include +#include +#include "elfio/elfio.hpp" namespace hip_impl { @@ -124,6 +126,18 @@ class Bundled_code_header { std::copy_n(f + y.header.offset, y.header.bundle_sz, std::back_inserter(y.blob)); + // we need to read the blob (ELF) for this bundle to get the feature flags + std::stringstream tmp{std::string{y.blob.cbegin(), y.blob.cend()}}; + ELFIO::elfio reader; + if (reader.load(tmp)) { + unsigned int xnack_enabled = reader.get_flags() & 0x100; + unsigned int sram_ecc_enabled = reader.get_flags() & 0x200; + if (xnack_enabled) + y.triple.append("+xnack"); + if (sram_ecc_enabled) + y.triple.append("+sram-ecc"); + } + it += y.header.triple_sz; x.bundled_code_size = std::max(x.bundled_code_size,