P4 to Git Change 1598666 by cpaquot@cpaquot-ocl-lc-lnx on 2018/08/27 18:36:44

SWDEV-145570 - [HIP] - Multithreading issues
	Add a lock per function so kernel parameters don't get overwritten
	Make execStack_ thread local and remove global lock use for it:
	The compiler uses the same thread to set it up and launch the function

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/hip/hip_internal.hpp#16 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_module.cpp#18 edit
... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#19 edit
This commit is contained in:
foreman
2018-08-27 18:46:34 -04:00
parent efd28cf092
commit 556ef9c0d1
3 changed files with 36 additions and 17 deletions
+6 -2
View File
@@ -126,7 +126,8 @@ hipError_t hipModuleGetFunction(hipFunction_t *hfunc, hipModule_t hmod, const ch
HIP_RETURN(hipErrorOutOfMemory);
}
*hfunc = reinterpret_cast<hipFunction_t>(as_cl(kernel));
hip::Function* f = new hip::Function(kernel);
*hfunc = f->asHipFunction();
HIP_RETURN(hipSuccess);
}
@@ -151,9 +152,12 @@ hipError_t ihipModuleLaunchKernel(hipFunction_t f,
sharedMemBytes, hStream,
kernelParams, extra, startEvent, stopEvent);
amd::Kernel* kernel = as_amd(reinterpret_cast<cl_kernel>(f));
hip::Function* function = hip::Function::asFunction(f);
amd::Kernel* kernel = function->function_;
amd::Device* device = hip::getCurrentContext()->devices()[0];
amd::ScopedLock lock(function->lock_);
hip::Event* eStart = reinterpret_cast<hip::Event*>(startEvent);
hip::Event* eStop = reinterpret_cast<hip::Event*>(stopEvent);
amd::HostQueue* queue;