From 4cffcd39978bc3e281309593683178bc7c172e88 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 19 May 2015 12:40:37 -0400
Subject: [PATCH] P4 to Git Change 1152294 by nhaustov@spb-hlc-tonga2_hsa on
2015/05/19 12:34:06
ECR #333756 - HSA Finalizer: Make sure size of kernarg segment, alignment of kernarg, private and group segments are multiple of 16. Update ORCA runtime assert. [ OpenCL integration of CL 1151953]
Change by Nikolay Haustov
Testing: http://ocltc:8111/viewModification.html?modId=51851&personal=true&init=1&tab=vcsModificationBuilds
Also fix uncovered problem in test.
Testing: pre-checkin
Reviewed by: German
Affected files ...
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc/HSAIL/hsail-fin/HSAILFinalizer.cpp#16 integrate
... //depot/stg/opencl/drivers/opencl/compiler/lib/backends/gpu/sc/HSAIL/tests/src/finalizer/features/structural_analysis/short_circuit/short_circuit06.hsail#4 integrate
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#284 edit
---
rocclr/runtime/device/gpu/gpukernel.cpp | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/rocclr/runtime/device/gpu/gpukernel.cpp b/rocclr/runtime/device/gpu/gpukernel.cpp
index 29c5b7f30a..08abeaab31 100644
--- a/rocclr/runtime/device/gpu/gpukernel.cpp
+++ b/rocclr/runtime/device/gpu/gpukernel.cpp
@@ -4089,13 +4089,12 @@ HSAILKernel::loadArguments(
return NULL;
}
+ // HSAIL kernarg segment size is rounded up to multiple of 16.
+ aqlArgBuf = amd::alignUp(aqlArgBuf, 16);
assert((aqlArgBuf == (gpu.cb(0)->sysMemCopy() + argsBufferSize())) &&
"Size and the number of arguments don't match!");
- uint argBufSize = amd::alignUp(
- static_cast(argsBufferSize()), sizeof(uint32_t));
hsa_kernel_dispatch_packet_t* hsaDisp =
- reinterpret_cast(
- gpu.cb(0)->sysMemCopy() + argBufSize);
+ reinterpret_cast(aqlArgBuf);
amd::NDRange local(sizes.local());
const amd::NDRange& global = sizes.global();
@@ -4121,7 +4120,7 @@ HSAILKernel::loadArguments(
hsaDisp->kernel_object = gpuAqlCode()->vmAddress();
ConstBuffer* cb = gpu.constBufs_[0];
- cb->uploadDataToHw(argBufSize + sizeof(hsa_kernel_dispatch_packet_t));
+ cb->uploadDataToHw(argsBufferSize() + sizeof(hsa_kernel_dispatch_packet_t));
uint64_t argList = cb->vmAddress() + cb->wrtOffset();
hsaDisp->kernarg_address = reinterpret_cast(argList);