From 8c5bc4a9cae8af04eb79e9dc8fd660539ccb4dc7 Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 16 Sep 2014 11:54:47 -0400 Subject: [PATCH] P4 to Git Change 1077336 by emankov@em-hsa-amd on 2014/09/16 11:13:20 ECR #333753 - Compiler Lib/RT: Fix RT_DEVICE_ENQUEUE & RT_KERNEL_INDEX querying tests: pre check-in, compiler ocl conformance tests Reviewer: German Andryeyev, Vinay Madhusudan Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/common/v0_8/if_acl.cpp#48 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#263 edit [ROCm/clr commit: 09fb6c961b4290fe6c0544b65c381a08e58d54ec] --- .../compiler/lib/backends/common/v0_8/if_acl.cpp | 12 ++++++------ projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) 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; }