diff --git a/runtime/hsa-runtime/inc/hsa.h b/runtime/hsa-runtime/inc/hsa.h index 9520bd870c..148c693be7 100644 --- a/runtime/hsa-runtime/inc/hsa.h +++ b/runtime/hsa-runtime/inc/hsa.h @@ -5656,7 +5656,12 @@ typedef enum { * undefined if the symbol is not an indirect function. The type of this * attribute is uint32_t. */ - HSA_CODE_SYMBOL_INFO_INDIRECT_FUNCTION_CALL_CONVENTION = 16 + HSA_CODE_SYMBOL_INFO_INDIRECT_FUNCTION_CALL_CONVENTION = 16, + /** + * Wavefront size used by the kernel. The value of this attribute is either + * 32 or 64. The type of this attribute is uint32_t. + */ + HSA_CODE_SYMBOL_INFO_KERNEL_WAVEFRONT_SIZE = 19 } hsa_code_symbol_info_t; /** diff --git a/runtime/hsa-runtime/loader/executable.cpp b/runtime/hsa-runtime/loader/executable.cpp index 2a3b96f243..cfdb6cebea 100644 --- a/runtime/hsa-runtime/loader/executable.cpp +++ b/runtime/hsa-runtime/loader/executable.cpp @@ -522,6 +522,10 @@ bool KernelSymbol::GetInfo(hsa_symbol_info32_t symbol_info, void *value) { *((bool*)value) = is_dynamic_callstack; break; } + case HSA_CODE_SYMBOL_INFO_KERNEL_WAVEFRONT_SIZE: { + *((uint32_t*)value) = wavefront_size; + break; + } case HSA_EXT_EXECUTABLE_SYMBOL_INFO_KERNEL_OBJECT_SIZE: { *((uint32_t*)value) = size; break; @@ -1434,6 +1438,7 @@ hsa_status_t ExecutableImpl::LoadDefinitionSymbol(hsa_agent_t agent, uint32_t group_segment_size = kd.group_segment_fixed_size; uint32_t private_segment_size = kd.private_segment_fixed_size; bool is_dynamic_callstack = AMDHSA_BITS_GET(kd.kernel_code_properties, rocr::llvm::amdhsa::KERNEL_CODE_PROPERTY_USES_DYNAMIC_STACK); + bool uses_wave32 = AMDHSA_BITS_GET( kd.kernel_code_properties, rocr::llvm::amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32); uint64_t size = sym->Size(); @@ -1449,6 +1454,7 @@ hsa_status_t ExecutableImpl::LoadDefinitionSymbol(hsa_agent_t agent, is_dynamic_callstack, size, 64, + uses_wave32 ? 32 : 64, address); symbol = kernel_symbol; } else if (sym->IsVariableSymbol()) { @@ -1478,6 +1484,7 @@ hsa_status_t ExecutableImpl::LoadDefinitionSymbol(hsa_agent_t agent, uint32_t(akc.workitem_private_segment_byte_size); bool is_dynamic_callstack = AMD_HSA_BITS_GET(akc.kernel_code_properties, AMD_KERNEL_CODE_PROPERTIES_IS_DYNAMIC_CALLSTACK) ? true : false; + bool uses_wave32 = akc.wavefront_size == AMD_POWERTWO_32; uint64_t size = sym->Size(); @@ -1498,6 +1505,7 @@ hsa_status_t ExecutableImpl::LoadDefinitionSymbol(hsa_agent_t agent, is_dynamic_callstack, size, 256, + uses_wave32 ? 32 : 64, address); kernel_symbol->debug_info.elf_raw = code->ElfData(); kernel_symbol->debug_info.elf_size = code->ElfSize(); diff --git a/runtime/hsa-runtime/loader/executable.hpp b/runtime/hsa-runtime/loader/executable.hpp index c360df3488..cb985ca3e1 100644 --- a/runtime/hsa-runtime/loader/executable.hpp +++ b/runtime/hsa-runtime/loader/executable.hpp @@ -144,6 +144,7 @@ public: const bool &_is_dynamic_callstack, const uint32_t &_size, const uint32_t &_alignment, + const uint32_t &_wavefront_size, const uint64_t &_address = 0) : SymbolImpl(_is_loaded, HSA_SYMBOL_KIND_KERNEL, @@ -159,7 +160,8 @@ public: , private_segment_size(_private_segment_size) , is_dynamic_callstack(_is_dynamic_callstack) , size(_size) - , alignment(_alignment) {} + , alignment(_alignment) + , wavefront_size(_wavefront_size) {} ~KernelSymbol() {} @@ -173,6 +175,7 @@ public: bool is_dynamic_callstack; uint32_t size; uint32_t alignment; + uint32_t wavefront_size; amd_runtime_loader_debug_info_t debug_info; private: