diff --git a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp index acacac976a..eac19a5169 100644 --- a/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp +++ b/projects/clr/rocclr/compiler/lib/backends/common/v0_8/if_acl.cpp @@ -2457,10 +2457,10 @@ if_aclQueryInfo(aclCompiler *cl, } case RT_DEVICE_ENQUEUE: { if (size != NULL && ptr == NULL) { - (*size) = sizeof(uint32_t); - } else if (ptr != NULL && (*size) >= (sizeof(uint32_t))) { + (*size) = sizeof(aclMetadata().enqueue_kernel); + } else if (ptr != NULL && (*size) >= (sizeof(aclMetadata().enqueue_kernel))) { const aclMetadata *md = reinterpret_cast(roSec); - (*reinterpret_cast(ptr)) = md->enqueue_kernel; + memcpy(ptr, &md->enqueue_kernel, sizeof(md->enqueue_kernel)); } else { success = false; } @@ -2469,10 +2469,10 @@ if_aclQueryInfo(aclCompiler *cl, // Temporary approach till the "ldk" instruction is supported. case RT_KERNEL_INDEX: { if (size != NULL && ptr == NULL) { - (*size) = sizeof(uint32_t); - } else if (ptr != NULL && (*size) >= (sizeof(uint32_t))) { + (*size) = sizeof(aclMetadata().kernel_index); + } else if (ptr != NULL && (*size) >= (sizeof(aclMetadata().kernel_index))) { const aclMetadata *md = reinterpret_cast(roSec); - (*reinterpret_cast(ptr)) = md->kernel_index; + memcpy(ptr, &md->kernel_index, sizeof(md->kernel_index)); } else { success = false; } diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp index 39661c7bf5..669371938b 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp @@ -3612,20 +3612,21 @@ HSAILKernel::init() delete [] aclPrintfList; } - size_t sizeOfDevice; bool hasKernelEnqueue = false; + size_t sizeOfDeviceEnqueue = sizeof(hasKernelEnqueue); error = aclQueryInfo(dev().hsaCompiler(), prog().binaryElf(), RT_DEVICE_ENQUEUE, openClKernelName.c_str(), - &hasKernelEnqueue, &sizeOfDevice); + &hasKernelEnqueue, &sizeOfDeviceEnqueue); if (error != ACL_SUCCESS) { return false; } flags_.dynamicParallelism_ = hasKernelEnqueue; int index = -1; + size_t sizeOfIndex = sizeof(index); error = aclQueryInfo(dev().hsaCompiler(), prog().binaryElf(), RT_KERNEL_INDEX, openClKernelName.c_str(), - &index, &sizeOfDevice); + &index, &sizeOfIndex); if (error != ACL_SUCCESS) { return false; }