diff --git a/api/hip/hip_module.cpp b/api/hip/hip_module.cpp
index f1659d496d..87106a73e6 100644
--- a/api/hip/hip_module.cpp
+++ b/api/hip/hip_module.cpp
@@ -253,6 +253,8 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
amd::NDRangeContainer ndrange(3, globalWorkOffset, globalWorkSize, localWorkSize);
amd::Command::EventWaitList waitList;
+ address kernargs = nullptr;
+
// 'extra' is a struct that contains the following info: {
// HIP_LAUNCH_PARAM_BUFFER_POINTER, kernargs,
// HIP_LAUNCH_PARAM_BUFFER_SIZE, &kernargs_size,
@@ -262,17 +264,19 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
extra[2] != HIP_LAUNCH_PARAM_BUFFER_SIZE || extra[4] != HIP_LAUNCH_PARAM_END) {
return hipErrorNotInitialized;
}
- address kernargs = reinterpret_cast
(extra[1]);
- ::memcpy(kernel->parameters().values(), kernargs, *(size_t*)(extra[3]));
-// assert(kernel->signature().paramsSize()>=reinterpret_cast(extra[3]));
+ kernargs = reinterpret_cast(extra[1]);
}
- if (kernelParams != nullptr) {
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(kernargs != nullptr);
+ kernel->parameters().set(i, desc.size_, kernargs + desc.offset_,
+ desc.type_ == T_POINTER/*svmBound*/);
+ } else {
assert(extra == nullptr);
- kernel->parameters().set(i, desc.size_, kernelParams[i], desc.type_ == T_POINTER);
+ kernel->parameters().set(i, desc.size_, kernelParams[i], desc.type_ == T_POINTER/*svmBound*/);
}
}
@@ -283,7 +287,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
}
amd::NDRangeKernelCommand* command = new amd::NDRangeKernelCommand(
- *queue, waitList, *kernel, ndrange, sharedMemBytes, params, true);
+ *queue, waitList, *kernel, ndrange, sharedMemBytes, params);
if (!command) {
return hipErrorOutOfMemory;
}