Update code object V3 kernarg queries

Code object V2 had the ability to support the following queries:

- HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_SIZE
- HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_SIZE
- HSA_CODE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_ALIGNMENT
- HSA_EXECUTABLE_SYMBOL_INFO_KERNEL_KERNARG_SEGMENT_ALIGNMENT

However code object V3 onwards cannot support these as the kernel
descriptor changed. These queries need to be deprecated.

Until then return more reasonable values:

- For kernarg alignment return 16 which is the minimum alignment
  required by the HSA standard.

- For kernarg size return the field from the kernel descriptor which
  is a hint. If it is 0 then the compiler is not specifying the kernarg
  size, or the kernel has no kernarg.

Change-Id: I19ce6cd0f3658a2bf62277492f39100ea5ab4256


[ROCm/ROCR-Runtime commit: ef755e4c82]
Tá an tiomantas seo le fáil i:
Tony
2020-11-21 01:01:09 +00:00
tiomanta ag Tony Tye
tuismitheoir ce4de85616
tiomantas e1734526fc
D'athraigh 2 comhad le 8 breiseanna agus 4 scriosta
@@ -167,7 +167,8 @@ enum : int32_t {
struct kernel_descriptor_t {
uint32_t group_segment_fixed_size;
uint32_t private_segment_fixed_size;
uint8_t reserved0[8];
uint32_t kernarg_size;
uint8_t reserved0[4];
int64_t kernel_code_entry_byte_offset;
uint8_t reserved1[24];
uint32_t compute_pgm_rsrc1;
@@ -185,8 +186,11 @@ static_assert(
static_assert(
offsetof(kernel_descriptor_t, private_segment_fixed_size) == 4,
"invalid offset for private_segment_fixed_size");
static_assert(
offsetof(kernel_descriptor_t, kernarg_size) == 8,
"invalid offset for kernarg_size");
static_assert(
offsetof(kernel_descriptor_t, reserved0) == 8,
offsetof(kernel_descriptor_t, reserved0) == 12,
"invalid offset for reserved0");
static_assert(
offsetof(kernel_descriptor_t, kernel_code_entry_byte_offset) == 16,
@@ -1422,8 +1422,8 @@ hsa_status_t ExecutableImpl::LoadDefinitionSymbol(hsa_agent_t agent,
llvm::amdhsa::kernel_descriptor_t kd;
sym->GetSection()->getData(sym->SectionOffset(), &kd, sizeof(kd));
uint32_t kernarg_segment_size = 0; // FIXME.
uint32_t kernarg_segment_alignment = 0; // FIXME.
uint32_t kernarg_segment_size = kd.kernarg_size; // FIXME: If 0 then the compiler is not specifying the size.
uint32_t kernarg_segment_alignment = 16; // FIXME: Use the minumum HSA required alignment.
uint32_t group_segment_size = kd.group_segment_fixed_size;
uint32_t private_segment_size = kd.private_segment_fixed_size;
bool is_dynamic_callstack = false;