From 074deb4bde944df9a2dd88cabce91b95ae40d6b0 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 22 Sep 2015 16:26:19 -0400
Subject: [PATCH] P4 to Git Change 1193161 by xcui@merged_opencl_jxcwin on
2015/09/22 16:16:10
SWDEV-59579 - temporary Back out changelist 1193093
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#14 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#257 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#526 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#151 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#381 edit
[ROCm/clr commit: 48e9d66576fa16d57e33e571cc51a3103880d3bc]
---
.../clr/opencl/api/opencl/amdocl/cl_svm.cpp | 89 +++++++++----------
1 file changed, 41 insertions(+), 48 deletions(-)
diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_svm.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_svm.cpp
index acc1a346be..3fa9fbb403 100644
--- a/projects/clr/opencl/api/opencl/amdocl/cl_svm.cpp
+++ b/projects/clr/opencl/api/opencl/amdocl/cl_svm.cpp
@@ -746,46 +746,41 @@ RUNTIME_ENTRY(cl_int, clEnqueueSVMMap, (
}
amd::HostQueue& hostQueue = *queue;
size_t offset = 0;
- amd::Memory * svmMem = NULL;
- if ((queue->device()).isFineGrainedSystem()) {
- //leave blank on purpose for FGS no op
- }
- else {
- svmMem = amd::SvmManager::FindSvmBuffer(svm_ptr);
- if (NULL != svmMem) {
- //make sure the context is the same as the context of creation of svm space
- if (hostQueue.context() != svmMem->getContext()) {
- LogWarning("different contexts");
- return CL_INVALID_CONTEXT;
- }
- offset = static_cast(svm_ptr) - static_cast(svmMem->getSvmPtr());
- if (offset < 0 || offset + size > svmMem->getSize()) {
- LogWarning("wrong svm address ");
+ //make sure the context is the same as the context of creation of svm space
+ amd::Memory * svmMem = amd::SvmManager::FindSvmBuffer(svm_ptr);
+ if (NULL != svmMem) {
+ if (hostQueue.context() != svmMem->getContext()) {
+ LogWarning("different contexts");
+ return CL_INVALID_CONTEXT;
+ }
+
+ offset = static_cast(svm_ptr) - static_cast(svmMem->getSvmPtr());
+ if (offset < 0 || offset + size > svmMem->getSize()) {
+ LogWarning("wrong svm address ");
+ return CL_INVALID_VALUE;
+ }
+ amd::Buffer* srcBuffer = svmMem->asBuffer();
+
+ amd::Coord3D srcSize(size);
+ amd::Coord3D srcOffset(offset);
+ if (NULL != srcBuffer) {
+ if (!srcBuffer->validateRegion(srcOffset, srcSize)) {
return CL_INVALID_VALUE;
}
- amd::Buffer* srcBuffer = svmMem->asBuffer();
+ }
- amd::Coord3D srcSize(size);
- amd::Coord3D srcOffset(offset);
- if (NULL != srcBuffer) {
- if (!srcBuffer->validateRegion(srcOffset, srcSize)) {
- return CL_INVALID_VALUE;
- }
- }
-
- // Make sure we have memory for the command execution
- device::Memory* mem = svmMem->getDeviceMemory(queue->device());
- if (NULL == mem) {
- LogPrintfError("Can't allocate memory size - 0x%08X bytes!",
- svmMem->getSize());
- return CL_OUT_OF_RESOURCES;
- }
- // Attempt to allocate the map target now (whether blocking or non-blocking)
- void* mapPtr = (queue->device()).allocMapTarget(*svmMem, srcOffset, srcSize, map_flags);
- if (NULL == mapPtr || mapPtr != svm_ptr) {
- return CL_OUT_OF_RESOURCES;
- }
+ // Make sure we have memory for the command execution
+ device::Memory* mem = svmMem->getDeviceMemory(queue->device());
+ if (NULL == mem) {
+ LogPrintfError("Can't allocate memory size - 0x%08X bytes!",
+ svmMem->getSize());
+ return CL_OUT_OF_RESOURCES;
+ }
+ // Attempt to allocate the map target now (whether blocking or non-blocking)
+ void* mapPtr = (queue->device()).allocMapTarget(*svmMem, srcOffset, srcSize, map_flags);
+ if (NULL == mapPtr || mapPtr != svm_ptr) {
+ return CL_OUT_OF_RESOURCES;
}
}
@@ -886,19 +881,17 @@ RUNTIME_ENTRY(cl_int, clEnqueueSVMUnmap, (
return CL_INVALID_COMMAND_QUEUE;
}
amd::HostQueue& hostQueue = *queue;
- amd::Memory * svmMem = NULL;
- if (!(queue->device()).isFineGrainedSystem()) {
- //check if the ptr is in the svm space
- svmMem = amd::SvmManager::FindSvmBuffer(svm_ptr);
+
+ //check if the ptr is in the svm space
+ amd::Memory * svmMem = amd::SvmManager::FindSvmBuffer(svm_ptr);
+ // Make sure we have memory for the command execution
+ if (NULL != svmMem) {
// Make sure we have memory for the command execution
- if (NULL != svmMem) {
- // Make sure we have memory for the command execution
- device::Memory* mem = svmMem->getDeviceMemory(queue->device());
- if (NULL == mem) {
- LogPrintfError("Can't allocate memory size - 0x%08X bytes!",
- svmMem->getSize());
- return CL_INVALID_VALUE;
- }
+ device::Memory* mem = svmMem->getDeviceMemory(queue->device());
+ if (NULL == mem) {
+ LogPrintfError("Can't allocate memory size - 0x%08X bytes!",
+ svmMem->getSize());
+ return CL_INVALID_VALUE;
}
}