From d50fa706e36c026e3a4fb2d845c2c7c117724faf Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 22 Sep 2014 08:24:39 -0400
Subject: [PATCH] P4 to Git Change 1079216 by emankov@em-hsa-amd on 2014/09/22
08:18:24
ECR #333753 - Compiler Lib/RT: Metadata related code refactor, annotation, minor fixes & additional checks
+ refactor if_aclQueryInfo() in order to simplify code and to avoid direct usage of aclMetadata struct members types
+ annotation on why we need to use deserializeCLMetadata on "serialized" (to NULL) pointers
+ erroneously forgotten RT_KERNEL_NAME was added to aclQueryType enum
+ OCLRTGetInfo, CLEnumCheck tests from ocltst oclcomplib was updated to use RT_KERNEL_NAME
+ testing of printf is added to OCLRTGetInfo
+ minor fixes and additional checks
tests: pre check-in, ocltst -m oclcomplib
Reviewers: Artem Tamazov, Brian Sumner, German Andryeyev
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#49 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclEnums.h#12 edit
... //depot/stg/opencl/drivers/opencl/compiler/lib/include/v0_8/aclStructs.h#12 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#265 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/CLEnumCheck.cpp#36 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/clSourceShaders.h#5 edit
... //depot/stg/opencl/drivers/opencl/tests/ocltst/module/complib/oclrtGetInfo.cpp#14 edit
---
.../lib/backends/common/v0_8/if_acl.cpp | 424 +++++++++---------
rocclr/compiler/lib/include/v0_8/aclEnums.h | 3 +-
rocclr/compiler/lib/include/v0_8/aclStructs.h | 24 +-
rocclr/runtime/device/gpu/gpukernel.cpp | 17 +-
4 files changed, 247 insertions(+), 221 deletions(-)
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 eac19a5169..cedb3bb7c7 100644
--- a/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
+++ b/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp
@@ -2256,6 +2256,8 @@ if_aclQueryInfo(aclCompiler *cl,
void *ptr,
size_t *size)
{
+ if (!size)
+ return ACL_ERROR;
const oclBIFSymbolStruct* sym = findBIF30SymStruct(symOpenclMeta);
assert(sym && "symbol not found");
std::string symbol = sym->str[PRE] + std::string(kernel) + sym->str[POST];
@@ -2267,217 +2269,237 @@ if_aclQueryInfo(aclCompiler *cl,
if (roSec == NULL || roSize == 0) {
return ACL_ELF_ERROR;
}
- bool success = true;
+ const aclMetadata *md = reinterpret_cast(roSec);
+ bool success = false;
switch (query) {
default: break;
case RT_CPU_BARRIER_NAMES:
- if (size != NULL && ptr == NULL) {
- (*size) = 0;
- } else if (ptr != NULL && size != NULL) {
- assert(!"Not implemented!");
- success = false;
- } else {
- success = false;
- }
- break;
- case RT_ABI_VERSION:
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(uint32_t) * 3;
- } else if (ptr != NULL && (*size) >= (sizeof(uint32_t) * 3)) {
- uint32_t *tmp = reinterpret_cast(ptr);
- const aclMetadata *md = reinterpret_cast(roSec);
- tmp[0] = md->major;
- tmp[1] = md->minor;
- tmp[2] = md->revision;
- } else {
- success = false;
- }
- break;
+ if (!ptr) {
+ *size = 0;
+ success = true;
+ } else {
+ assert(!"Not implemented");
+ }
+ break;
+ case RT_ABI_VERSION: {
+ size_t majorSize = sizeof(md->major);
+ size_t minorSize = sizeof(md->minor);
+ size_t revisionSize = sizeof(md->revision);
+ size_t verSize = majorSize + minorSize + revisionSize;
+ if (!ptr) {
+ *size = verSize;
+ success = true;
+ } else if (*size >= verSize) {
+ char *tmp = reinterpret_cast(ptr);
+ memcpy(tmp, &md->major, majorSize);
+ tmp += majorSize;
+ memcpy(tmp, &md->minor, minorSize);
+ tmp += minorSize;
+ memcpy(tmp, &md->revision, revisionSize);
+ success = true;
+ }
+ break;
+ }
case RT_DEVICE_NAME:
- if (size != NULL && ptr == NULL) {
- const aclMetadata *md = reinterpret_cast(roSec);
- (*size) = md->deviceNameSize;
- } else if (ptr != NULL) {
- const aclMetadata *md = reinterpret_cast(roSec);
- success = false;
- if ((*size) >= md->deviceNameSize) {
- strncpy(reinterpret_cast(ptr), reinterpret_cast(roSec)
- + md->struct_size + md->kernelNameSize + 1, md->deviceNameSize);
- success = true;
- }
- } else {
- success = false;
- }
- break;
- case RT_MEM_SIZES:
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(size_t) * RT_MEM_LAST;
- } else if (ptr != NULL && (*size) >= (sizeof(size_t) * RT_MEM_LAST)) {
- size_t *tmp = reinterpret_cast(ptr);
- const aclMetadata *md = reinterpret_cast(roSec);
- memcpy(tmp, md->mem, sizeof(size_t) * RT_MEM_LAST);
- } else {
- success = false;
- }
- break;
- case RT_GPU_FUNC_CAPS:
- if (binary->target.arch_id == aclX86) success = false;
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(uint32_t);
- } else if (ptr != NULL && (*size) >= sizeof(uint32_t)) {
- const aclMetadata *md = reinterpret_cast(roSec);
- (*reinterpret_cast(ptr)) = md->gpuCaps;
- } else {
- success = false;
- }
- break;
- case RT_GPU_FUNC_ID:
- if (binary->target.arch_id == aclX86) success = false;
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(uint32_t);
- } else if (ptr != NULL && (*size) >= sizeof(uint32_t)) {
- const aclMetadata *md = reinterpret_cast(roSec);
- (*reinterpret_cast(ptr)) = md->funcID;
- } else {
- success = false;
- }
- break;
- case RT_GPU_DEFAULT_ID:
- if (binary->target.arch_id == aclX86) success = false;
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(uint32_t) * RT_RES_LAST;
- } else if (ptr != NULL && (*size) >= (sizeof(uint32_t) * RT_RES_LAST)) {
- uint32_t *tmp = reinterpret_cast(ptr);
- const aclMetadata *md = reinterpret_cast(roSec);
- memcpy(tmp, md->gpuRes, sizeof(uint32_t) * RT_RES_LAST);
- } else {
- success = false;
- }
- break;
- case RT_WORK_GROUP_SIZE:
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(size_t) * 3;
- } else if (ptr != NULL && (*size) >= (sizeof(size_t) * 3)) {
- size_t *tmp = reinterpret_cast(ptr);
- const aclMetadata *md = reinterpret_cast(roSec);
- memcpy(tmp, md->wgs, 3 * sizeof(size_t));
- } else {
- success = false;
- }
- break;
- case RT_WORK_REGION_SIZE:
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(uint32_t) * 3;
- } else if (ptr != NULL && (*size) >= (sizeof(uint32_t) * 3)) {
- uint32_t *tmp = reinterpret_cast(ptr);
- const aclMetadata *md = reinterpret_cast(roSec);
- memcpy(tmp, md->wrs, 3 * sizeof(uint32_t));
- } else {
- success = false;
- }
- break;
+ if (!ptr) {
+ *size = md->deviceNameSize;
+ success = true;
+ } else if (*size >= md->deviceNameSize) {
+ // deviceName 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->deviceName && deserializedMd->deviceNameSize == md->deviceNameSize) {
+ strncpy(reinterpret_cast(ptr), deserializedMd->deviceName, deserializedMd->deviceNameSize);
+ success = true;
+ }
+ }
+ break;
+ case RT_KERNEL_NAME:
+ if (!ptr) {
+ *size = md->kernelNameSize;
+ success = true;
+ } else if (*size >= md->kernelNameSize) {
+ // kernelName 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->kernelName && deserializedMd->kernelNameSize == md->kernelNameSize) {
+ strncpy(reinterpret_cast(ptr), deserializedMd->kernelName, deserializedMd->kernelNameSize);
+ success = true;
+ }
+ }
+ break;
+ case RT_MEM_SIZES: {
+ size_t memSize = sizeof(md->mem);
+ if (!ptr) {
+ *size = memSize;
+ success = true;
+ } else if (*size >= memSize) {
+ memcpy(ptr, md->mem, memSize);
+ success = true;
+ }
+ break;
+ }
+ case RT_GPU_FUNC_CAPS: {
+ if (binary->target.arch_id == aclX86) {
+ break;
+ }
+ size_t gpuCapsSize = sizeof(md->gpuCaps);
+ if (!ptr) {
+ *size = gpuCapsSize;
+ success = true;
+ } else if (*size >= gpuCapsSize) {
+ memcpy(ptr, &md->gpuCaps, gpuCapsSize);
+ success = true;
+ }
+ break;
+ }
+ case RT_GPU_FUNC_ID: {
+ if (binary->target.arch_id == aclX86) {
+ break;
+ }
+ size_t funcIDSize = sizeof(md->funcID);
+ if (!ptr) {
+ *size = funcIDSize;
+ success = true;
+ } else if (*size >= funcIDSize) {
+ memcpy(ptr, &md->funcID, funcIDSize);
+ success = true;
+ }
+ break;
+ }
+ case RT_GPU_DEFAULT_ID: {
+ if (binary->target.arch_id == aclX86) {
+ break;
+ }
+ size_t gpuResSize = sizeof(md->gpuRes);
+ if (!ptr) {
+ *size = gpuResSize;
+ success = true;
+ } else if (*size >= gpuResSize) {
+ memcpy(ptr, &md->gpuRes, gpuResSize);
+ success = true;
+ }
+ break;
+ }
+ case RT_WORK_GROUP_SIZE: {
+ size_t wgsSize = sizeof(md->wgs);
+ if (!ptr) {
+ *size = wgsSize;
+ success = true;
+ } else if (md->wgs && *size >= wgsSize) {
+ memcpy(ptr, md->wgs, wgsSize);
+ success = true;
+ }
+ break;
+ }
+ case RT_WORK_REGION_SIZE: {
+ size_t wrsSize = sizeof(md->wrs);
+ if (!ptr) {
+ *size = wrsSize;
+ success = true;
+ } else if (md->wrs && *size >= wrsSize) {
+ memcpy(ptr, md->wrs, wrsSize);
+ success = true;
+ }
+ break;
+ }
case RT_ARGUMENT_ARRAY: {
- aclMetadata *md = static_cast(malloc(roSize));
- if (size != NULL && ptr == NULL) {
- deserializeCLMetadata(reinterpret_cast(roSec), md, roSize);
- (*size) = sizeof(aclArgData) * (md->numArgs + 1);
- for (unsigned x = 0; x < md->numArgs; ++x) {
- (*size) += md->args[x].typeStrSize + md->args[x].argNameSize + 2;
- }
- } else if (ptr) {
- deserializeCLMetadata(reinterpret_cast(roSec), md, roSize);
- unsigned totSize = sizeof(aclArgData) * (md->numArgs + 1);
- for (unsigned x = 0; x < md->numArgs; ++x) {
- totSize += md->args[x].typeStrSize + md->args[x].argNameSize + 2;
- }
- if ((*size) >= totSize) {
- char *tmp = reinterpret_cast(ptr);
- memset(ptr, 0, (*size));
- memcpy(ptr, md->args, sizeof(aclArgData) * (md->numArgs + 1));
- tmp += (sizeof(aclArgData) * (md->numArgs + 1));
- for (unsigned x = 0; x < md->numArgs; ++x) {
- memcpy(tmp, md->args[x].argStr, md->args[x].argNameSize);
- reinterpret_cast(ptr)[x].argStr = tmp;
- tmp += md->args[x].argNameSize + 1;
- tmp[-1] = '\0';
- memcpy(tmp, md->args[x].typeStr, md->args[x].typeStrSize);
- reinterpret_cast(ptr)[x].typeStr = tmp;
- tmp += md->args[x].typeStrSize + 1;
- tmp[-1] = '\0';
- }
- } else {
- success = false;
- }
- } else {
- success = false;
- }
- free(md);
- break;
- }
+ // args 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);
+ size_t totSize = sizeof(aclArgData) * (deserializedMd->numArgs + 1);
+ for (unsigned x = 0; x < deserializedMd->numArgs; ++x) {
+ totSize += deserializedMd->args[x].typeStrSize + deserializedMd->args[x].argNameSize + 2;
+ }
+ if (!ptr) {
+ *size = totSize;
+ success = true;
+ } else if (*size >= totSize) {
+ char *tmp = reinterpret_cast(ptr);
+ memset(ptr, 0, *size);
+ size_t sizeToCopy = sizeof(aclArgData) * (deserializedMd->numArgs + 1);
+ memcpy(ptr, deserializedMd->args, sizeToCopy);
+ tmp += sizeToCopy;
+ for (unsigned x = 0; x < deserializedMd->numArgs; ++x) {
+ sizeToCopy = deserializedMd->args[x].argNameSize;
+ memcpy(tmp, deserializedMd->args[x].argStr, sizeToCopy);
+ reinterpret_cast(ptr)[x].argStr = tmp;
+ tmp += sizeToCopy;
+ *(tmp++) = '\0';
+ sizeToCopy = deserializedMd->args[x].typeStrSize;
+ memcpy(tmp, deserializedMd->args[x].typeStr, sizeToCopy);
+ reinterpret_cast(ptr)[x].typeStr = tmp;
+ tmp += sizeToCopy;
+ *(tmp++) = '\0';
+ success = true;
+ }
+ }
+ break;
+ }
case RT_GPU_PRINTF_ARRAY: {
- aclMetadata *md = static_cast(malloc(roSize));
- if (size != NULL && ptr == NULL) {
- deserializeCLMetadata(reinterpret_cast(roSec), md, roSize);
- (*size) = 0;
- if (md->numPrintf > 0) {
- (*size) = sizeof(aclPrintfFmt) * (md->numPrintf + 1);
- for (unsigned x = 0; x < md->numPrintf; ++x) {
- (*size) += sizeof(uint32_t) * md->printf[x].numSizes;
- (*size) += md->printf[x].fmtStrSize + 1;
- }
- }
- } else if (ptr != NULL) {
- deserializeCLMetadata(reinterpret_cast(roSec), md, roSize);
- unsigned totSize = sizeof(aclPrintfFmt) * (md->numPrintf + 1);
- for (unsigned x = 0; x < md->numPrintf; ++ x) {
- totSize += sizeof(uint32_t) + md->printf[x].fmtStrSize + 1;
- }
- if ((*size) >= totSize) {
- char *tmp = reinterpret_cast(ptr);
- memcpy(ptr, md->printf, sizeof(aclPrintfFmt) * (md->numPrintf + 1));
- tmp += (sizeof(aclPrintfFmt) * (md->numPrintf + 1));
- for (unsigned x = 0; x < md->numPrintf; ++x) {
- memcpy(tmp, md->printf[x].argSizes, sizeof(uint32_t) * md->printf[x].numSizes);
- reinterpret_cast(ptr)[x].argSizes = reinterpret_cast(tmp);
- tmp += sizeof(uint32_t) * md->printf[x].numSizes;
- memcpy(tmp, md->printf[x].fmtStr, md->printf[x].fmtStrSize);
- reinterpret_cast(ptr)[x].fmtStr = tmp;
- tmp += md->printf[x].fmtStrSize + 1;
- tmp[-1] = '\0';
- }
- } else {
- success = false;
- }
- } else {
- success = false;
- }
- free(md);
- break;
- }
+ // Printf 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);
+ size_t totSize = 0;
+ if (deserializedMd->numPrintf > 0) {
+ totSize = sizeof(aclPrintfFmt) * (deserializedMd->numPrintf + 1);
+ for (unsigned x = 0; x < deserializedMd->numPrintf; ++x) {
+ totSize += sizeof(*aclPrintfFmt().argSizes) * deserializedMd->printf[x].numSizes;
+ totSize += deserializedMd->printf[x].fmtStrSize + 1;
+ }
+ }
+ if (!ptr) {
+ *size = totSize;
+ success = true;
+ } else if (*size >= totSize) {
+ char *tmp = reinterpret_cast(ptr);
+ size_t sizeToCopy = sizeof(aclPrintfFmt) * (deserializedMd->numPrintf + 1);
+ memcpy(ptr, deserializedMd->printf, sizeToCopy);
+ tmp += sizeToCopy;
+ for (unsigned x = 0; x < deserializedMd->numPrintf; ++x) {
+ sizeToCopy = sizeof(*aclPrintfFmt().argSizes) * deserializedMd->printf[x].numSizes;
+ memcpy(tmp, deserializedMd->printf[x].argSizes, sizeToCopy);
+ memcpy(reinterpret_cast(ptr)[x].argSizes, tmp, sizeof(*aclPrintfFmt().argSizes));
+ // reinterpret_cast(ptr)[x].argSizes = reinterpret_cast(tmp);
+ tmp += sizeToCopy;
+ sizeToCopy = deserializedMd->printf[x].fmtStrSize;
+ memcpy(tmp, deserializedMd->printf[x].fmtStr, sizeToCopy);
+ reinterpret_cast(ptr)[x].fmtStr = tmp;
+ tmp += sizeToCopy;
+ *(tmp++) = '\0';
+ }
+ success = true;
+ }
+ break;
+ }
case RT_DEVICE_ENQUEUE: {
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(aclMetadata().enqueue_kernel);
- } else if (ptr != NULL && (*size) >= (sizeof(aclMetadata().enqueue_kernel))) {
- const aclMetadata *md = reinterpret_cast(roSec);
- memcpy(ptr, &md->enqueue_kernel, sizeof(md->enqueue_kernel));
- } else {
- success = false;
- }
- break;
- }
+ size_t enqueue_kernelSize = sizeof(md->enqueue_kernel);
+ if (!ptr) {
+ *size = enqueue_kernelSize;
+ success = true;
+ } else if (*size >= enqueue_kernelSize) {
+ memcpy(ptr, &md->enqueue_kernel, enqueue_kernelSize);
+ success = true;
+ }
+ break;
+ }
// Temporary approach till the "ldk" instruction is supported.
case RT_KERNEL_INDEX: {
- if (size != NULL && ptr == NULL) {
- (*size) = sizeof(aclMetadata().kernel_index);
- } else if (ptr != NULL && (*size) >= (sizeof(aclMetadata().kernel_index))) {
- const aclMetadata *md = reinterpret_cast(roSec);
- memcpy(ptr, &md->kernel_index, sizeof(md->kernel_index));
- } else {
- success = false;
- }
- break;
- }
+ size_t kernel_indexSize = sizeof(md->kernel_index);
+ if (!ptr) {
+ *size = kernel_indexSize;
+ success = true;
+ } else if (*size >= kernel_indexSize) {
+ memcpy(ptr, &md->kernel_index, kernel_indexSize);
+ success = true;
+ }
+ break;
+ }
}
return (success) ? ACL_SUCCESS : ACL_ERROR;
}
diff --git a/rocclr/compiler/lib/include/v0_8/aclEnums.h b/rocclr/compiler/lib/include/v0_8/aclEnums.h
index 96174fa7e7..91058b871b 100644
--- a/rocclr/compiler/lib/include/v0_8/aclEnums.h
+++ b/rocclr/compiler/lib/include/v0_8/aclEnums.h
@@ -200,7 +200,8 @@ typedef enum _rt_query_types_enum_0_8 {
RT_CPU_BARRIER_NAMES= 10,
RT_DEVICE_ENQUEUE = 11,
RT_KERNEL_INDEX = 12,
- RT_LAST_TYPE = 13
+ RT_KERNEL_NAME = 13,
+ RT_LAST_TYPE = 14
} 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 eee00b1e86..8dab9ac448 100644
--- a/rocclr/compiler/lib/include/v0_8/aclStructs.h
+++ b/rocclr/compiler/lib/include/v0_8/aclStructs.h
@@ -101,22 +101,24 @@ typedef struct _acl_md_printf_fmt_0_8 {
typedef struct _acl_metadata_0_8 {
ACL_STRUCT_HEADER; // This holds the size of the structure itself for versioning.
size_t data_size; // This holds the size of all the memory allocated for this structure.
- uint32_t major, minor, revision, gpuCaps, funcID;
- uint32_t gpuRes[5];
- size_t wgs[3];
- uint32_t wrs[3];
+ uint32_t major, minor, revision; // RT_ABI_VERSION
+ uint32_t gpuCaps; // RT_GPU_FUNC_CAPS
+ uint32_t funcID; // RT_GPU_FUNC_ID
+ uint32_t gpuRes[5]; // RT_GPU_DEFAULT_ID
+ size_t wgs[3]; // RT_WORK_GROUP_SIZE
+ uint32_t wrs[3]; // RT_WORK_REGION_SIZE
size_t kernelNameSize;
size_t deviceNameSize;
- size_t mem[6];
+ size_t mem[6]; // RT_MEM_SIZES
size_t numArgs;
size_t numPrintf;
- aclArgData_0_8 *args;
- aclPrintfFmt_0_8 *printf;
- const char *kernelName;
- const char *deviceName;
- bool enqueue_kernel;
- uint32_t kernel_index;
+ aclArgData_0_8 *args; // RT_ARGUMENT_ARRAY
+ aclPrintfFmt_0_8 *printf; // RT_GPU_PRINTF_ARRAY
+ const char *kernelName; // RT_KERNEL_NAME
+ const char *deviceName; // RT_DEVICE_NAME
+ bool enqueue_kernel; // RT_DEVICE_ENQUEUE
+ uint32_t kernel_index; // RT_KERNEL_INDEX
} aclMetadata_0_8;
//! An structure that holds information on the capabilities of the bif device.
diff --git a/rocclr/runtime/device/gpu/gpukernel.cpp b/rocclr/runtime/device/gpu/gpukernel.cpp
index 7151082db9..61614d9045 100644
--- a/rocclr/runtime/device/gpu/gpukernel.cpp
+++ b/rocclr/runtime/device/gpu/gpukernel.cpp
@@ -3612,25 +3612,26 @@ HSAILKernel::init(bool finalize)
delete [] aclPrintfList;
}
- bool hasKernelEnqueue = false;
- size_t sizeOfDeviceEnqueue = sizeof(hasKernelEnqueue);
+ aclMetadata md;
+ md.enqueue_kernel = false;
+ size_t sizeOfDeviceEnqueue = sizeof(md.enqueue_kernel);
error = aclQueryInfo(dev().hsaCompiler(), prog().binaryElf(),
RT_DEVICE_ENQUEUE, openClKernelName.c_str(),
- &hasKernelEnqueue, &sizeOfDeviceEnqueue);
+ &md.enqueue_kernel, &sizeOfDeviceEnqueue);
if (error != ACL_SUCCESS) {
return false;
}
- flags_.dynamicParallelism_ = hasKernelEnqueue;
+ flags_.dynamicParallelism_ = md.enqueue_kernel;
- int index = -1;
- size_t sizeOfIndex = sizeof(index);
+ md.kernel_index = -1;
+ size_t sizeOfIndex = sizeof(md.kernel_index);
error = aclQueryInfo(dev().hsaCompiler(), prog().binaryElf(),
RT_KERNEL_INDEX, openClKernelName.c_str(),
- &index, &sizeOfIndex);
+ &md.kernel_index, &sizeOfIndex);
if (error != ACL_SUCCESS) {
return false;
}
- index_ = static_cast(index);
+ index_ = md.kernel_index;
return true;
}