P4 to Git Change 1122235 by xcui@merged_opencl_jxcwin on 2015/02/13 17:28:52
EPR #413091 - move commit svm host memory into allocmaptarget and added hostmemref as the backing store for multiple gpu cases
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_memobj.cpp#73 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#11 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#280 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpumemory.cpp#118 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#115 edit
[ROCm/clr commit: 072a375629]
This commit is contained in:
@@ -3902,6 +3902,9 @@ HSAILKernel::loadArguments(
|
||||
}
|
||||
if (nativeMem) {
|
||||
gpuMem = *reinterpret_cast<Memory* const*>(paramaddr);
|
||||
if (NULL != gpuMem) {
|
||||
mem = gpuMem->owner();
|
||||
}
|
||||
}
|
||||
else {
|
||||
mem = *reinterpret_cast<amd::Memory* const*>(paramaddr);
|
||||
|
||||
@@ -922,8 +922,22 @@ Memory::allocMapTarget(
|
||||
address mapAddress = NULL;
|
||||
size_t offset = origin[0];
|
||||
|
||||
incIndMapCount();
|
||||
//For SVM implementation, we cannot use cached map. if svm space, use the svm host pointer
|
||||
void *initHostPtr = owner()->getSvmPtr();
|
||||
if (NULL != initHostPtr) {
|
||||
owner()->commitSvmMemory();
|
||||
}
|
||||
|
||||
if (owner()->numDevices() > 1) {
|
||||
if ((NULL == initHostPtr) && (owner()->getHostMem() == NULL)) {
|
||||
static const bool forceAllocHostMem = true;
|
||||
if (!owner()->allocHostMemory(NULL, forceAllocHostMem)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
incIndMapCount();
|
||||
// If host memory exists, use it
|
||||
if ((owner()->getHostMem() != NULL) && isDirectMap()) {
|
||||
mapAddress = reinterpret_cast<address>(owner()->getHostMem());
|
||||
@@ -953,8 +967,6 @@ Memory::allocMapTarget(
|
||||
bool failed = false;
|
||||
amd::Memory* memory = NULL;
|
||||
// Search for a possible indirect resource
|
||||
//For SVM implementation, we cannot use cached map. if svm space, use the svm host pointer
|
||||
void *initHostPtr = owner()->getSvmPtr();
|
||||
cl_mem_flags flag = 0;
|
||||
bool canBeCached = true;
|
||||
if (NULL != initHostPtr) {
|
||||
|
||||
@@ -251,7 +251,7 @@ Memory::allocHostMemory(void* initFrom, bool allocHostMem, bool forceCopy)
|
||||
pipe->end_idx = asPipe()->getMaxNumPackets();
|
||||
}
|
||||
|
||||
if (flags_ & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR)) {
|
||||
if ((flags_ & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR)) && (NULL == lastWriter_)) {
|
||||
// Signal write, so coherency mechanism will initialize
|
||||
// memory on all devices
|
||||
signalWrite(NULL);
|
||||
|
||||
Reference in New Issue
Block a user