diff --git a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index 98b080787e..49ba01f7fb 100644 --- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -2356,6 +2356,10 @@ void deserializeCLMetadata(const char* ptr, aclMetadata * const md, const size_t md->deviceName = tmp_ptr; tmp_ptr += md->deviceNameSize + 1; + // de-serialize the vec type hint + md->vth = tmp_ptr; + tmp_ptr += md->vecTypeHintSize + 1; + // de-serailize the arguments md->args = reinterpret_cast(tmp_ptr); tmp_ptr += (md->numArgs + 1) * sizeof(aclArgData); @@ -2825,7 +2829,34 @@ if_aclQueryInfo(aclCompiler *cl, } break; } - } + case RT_WORK_GROUP_SIZE_HINT: { + size_t work_group_size_hint_size = sizeof(md->wsh); + if (!ptr) { + *size = work_group_size_hint_size; + success = true; + } else if (*size >= work_group_size_hint_size) { + memcpy(ptr, md->wsh, work_group_size_hint_size); + success = true; + } + break; + } + case RT_VEC_TYPE_HINT: { + if (!ptr) { + *size = md->vecTypeHintSize; + success = true; + } else if (*size >= md->vecTypeHintSize) { + // vecTypeHint is a pointer, which is serialized by serializeMetadata() to NULL + // in binary; to get the data deserializeCLMetadata() is needed + aclMetadata *deserializedMd = static_cast(alloca(roSize)); + deserializeCLMetadata(reinterpret_cast(roSec), deserializedMd, roSize); + if (deserializedMd->vth && deserializedMd->vecTypeHintSize == md->vecTypeHintSize) { + strncpy(reinterpret_cast(ptr), deserializedMd->vth, deserializedMd->vecTypeHintSize); + success = true; + } + } + break; + } + } return (success) ? ACL_SUCCESS : ACL_ERROR; } static unsigned getSize(aclArgDataType data) diff --git a/rocclr/compiler/lib/include/v0_8/aclEnums.h b/rocclr/compiler/lib/include/v0_8/aclEnums.h index 25264ada80..928cd048fc 100644 --- a/rocclr/compiler/lib/include/v0_8/aclEnums.h +++ b/rocclr/compiler/lib/include/v0_8/aclEnums.h @@ -218,7 +218,9 @@ typedef enum _rt_query_types_enum_0_8 { RT_NUM_KERNEL_HIDDEN_ARGS = 22, RT_CONTAINS_SPIRV = 23, RT_WAVES_PER_SIMD_HINT = 24, - RT_LAST_TYPE = 25 + RT_WORK_GROUP_SIZE_HINT = 25, + RT_VEC_TYPE_HINT = 26, + RT_LAST_TYPE = 27 } aclQueryType_0_8; //! An enumeration for the various GPU capabilities diff --git a/rocclr/compiler/lib/include/v0_8/aclStructs.h b/rocclr/compiler/lib/include/v0_8/aclStructs.h index 0e648669b9..42206cb1fd 100644 --- a/rocclr/compiler/lib/include/v0_8/aclStructs.h +++ b/rocclr/compiler/lib/include/v0_8/aclStructs.h @@ -121,6 +121,9 @@ typedef struct _acl_metadata_0_8 { uint32_t kernel_index; // RT_KERNEL_INDEX uint32_t numHiddenKernelArgs; // RT_NUM_KERNEL_HIDDEN_ARGS uint32_t wavesPerSimdHint; // RT_WAVES_PER_SIMD_HINT + uint32_t wsh[3]; // RT_WORK_GROUP_SIZE_HINT + size_t vecTypeHintSize; + const char *vth; // RT_VEC_TYPE_HINT } aclMetadata_0_8; //! An structure that holds information on the capabilities of the bif device.