From 6577ecf5d3ceed24bdba4dccd6615fe408615187 Mon Sep 17 00:00:00 2001
From: foreman
Date: Thu, 22 Aug 2019 13:26:57 -0400
Subject: [PATCH] P4 to Git Change 1987582 by cpaquot@cpaquot-ocl-lc-lnx on
2019/08/22 13:20:28
SWDEV-185742 - [HIP] Add a svm path to avoid analyzing the mem objs
and just memcpy the kernel args
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#36 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.cpp#82 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocvirtual.hpp#25 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#96 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#94 edit
---
api/hip/hip_module.cpp | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/api/hip/hip_module.cpp b/api/hip/hip_module.cpp
index 3d73891ca3..f1659d496d 100644
--- a/api/hip/hip_module.cpp
+++ b/api/hip/hip_module.cpp
@@ -253,8 +253,6 @@ 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,
@@ -264,19 +262,17 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
extra[2] != HIP_LAUNCH_PARAM_BUFFER_SIZE || extra[4] != HIP_LAUNCH_PARAM_END) {
return hipErrorNotInitialized;
}
- kernargs = reinterpret_cast(extra[1]);
+ address kernargs = reinterpret_cast(extra[1]);
+ ::memcpy(kernel->parameters().values(), kernargs, *(size_t*)(extra[3]));
+// assert(kernel->signature().paramsSize()>=reinterpret_cast(extra[3]));
}
- 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 {
+ 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);
assert(extra == nullptr);
- kernel->parameters().set(i, desc.size_, kernelParams[i], desc.type_ == T_POINTER/*svmBound*/);
+ kernel->parameters().set(i, desc.size_, kernelParams[i], desc.type_ == T_POINTER);
}
}
@@ -287,7 +283,7 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
}
amd::NDRangeKernelCommand* command = new amd::NDRangeKernelCommand(
- *queue, waitList, *kernel, ndrange, sharedMemBytes, params);
+ *queue, waitList, *kernel, ndrange, sharedMemBytes, params, true);
if (!command) {
return hipErrorOutOfMemory;
}