From 12c490ff1d0399e1c2096dcdfdc4170eaffdd1f2 Mon Sep 17 00:00:00 2001
From: foreman
Date: Mon, 30 Apr 2018 20:17:46 -0400
Subject: [PATCH] P4 to Git Change 1548038 by lmoriche@lmoriche_opencl_dev2 on
2018/04/30 15:55:18
SWDEV-145570 - [HIP] Fix kernel disptach for HCC compiled programs.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#6 edit
---
hipamd/api/hip/hip_module.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/hipamd/api/hip/hip_module.cpp b/hipamd/api/hip/hip_module.cpp
index 268b92284b..f17d5ae719 100644
--- a/hipamd/api/hip/hip_module.cpp
+++ b/hipamd/api/hip/hip_module.cpp
@@ -156,12 +156,22 @@ hipError_t hipModuleLaunchKernel(hipFunction_t f,
amd::NDRangeContainer ndrange(3, globalWorkOffset, globalWorkSize, localWorkSize);
amd::Command::EventWaitList waitList;
+ // 'extra' is a struct that contains the following info: {
+ // HIP_LAUNCH_PARAM_BUFFER_POINTER, kernargs,
+ // HIP_LAUNCH_PARAM_BUFFER_SIZE, &kernargs_size,
+ // HIP_LAUNCH_PARAM_END }
+ if (extra[0] != HIP_LAUNCH_PARAM_BUFFER_POINTER ||
+ extra[2] != HIP_LAUNCH_PARAM_BUFFER_SIZE || extra[4] != HIP_LAUNCH_PARAM_END) {
+ return hipErrorNotInitialized;
+ }
+ address kernargs = reinterpret_cast(extra[1]);
+
const amd::KernelSignature& signature = kernel->signature();
for (size_t i = 0; i < signature.numParameters(); ++i) {
const amd::KernelParameterDescriptor& desc = signature.at(i);
if (kernelParams == nullptr) {
assert(extra);
- kernel->parameters().set(i, desc.size_, reinterpret_cast(extra[1]) + desc.offset_,
+ kernel->parameters().set(i, desc.size_, kernargs + desc.offset_,
desc.type_ == T_POINTER/*svmBound*/);
} else {
assert(!extra);