P4 to Git Change 1193228 by xcui@merged_opencl_jxcwin on 2015/09/22 18:52:47

SWDEV-59579 - resubmit the changelist 1193161. refactory the Coare-grained SVM and  fine grain buffer  SVM code path, so that if the device SVM running on supports fine grain system, then the SVM API operation will be on system memory, no need to go through GPU backend. In addition, added support for PX system with CZ on windows 10, which  supports SVM fine grain system.

	code review:
	http://ocltc.amd.com/reviews/r/8530/
	precheckin:
	http://ocltc.amd.com:8111/viewModification.html?modId=58913&personal=true&buildTypeId=&tab=vcsModificationBuilds&show_all_builds=true

Affected files ...

... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#15 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#527 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#152 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#382 edit
Cette révision appartient à :
foreman
2015-09-22 18:59:36 -04:00
Parent 9604ede937
révision a3074a2a8f
3 fichiers modifiés avec 117 ajouts et 75 suppressions
+28 -9
Voir le fichier
@@ -2198,7 +2198,13 @@ Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_me
size = amd::alignUp(size, alignment);
amd::Memory* mem = NULL;
freeCPUMem_ = false;
if (NULL == svmPtr) {
if (isFineGrainedSystem()) {
freeCPUMem_ = true;
return amd::Os::alignedMalloc(size, alignment);
}
//create a hidden buffer, which will allocated on the device later
mem = new (context)amd::Buffer(context, flags, size, reinterpret_cast<void*>(1));
if (mem == NULL) {
@@ -2211,10 +2217,12 @@ Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_me
mem->release();
return NULL;
}
//if the device supports SVM FGS, return the committed CPU address directly.
gpu::Memory* gpuMem = getGpuMemory(mem);
//add the information to context so that we can use it later.
amd::SvmManager::AddSvmBuffer(mem->getSvmPtr(), mem);
svmPtr = mem->getSvmPtr();
}
else {
//find the existing amd::mem object
@@ -2222,20 +2230,31 @@ Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_me
if (NULL == mem) {
return NULL;
}
gpu::Memory* gpuMem = getGpuMemory(mem);
//commit the CPU memory for FGS device.
if (isFineGrainedSystem()) {
mem->commitSvmMemory();
}
else {
gpu::Memory* gpuMem = getGpuMemory(mem);
}
svmPtr = mem->getSvmPtr();
}
return mem->getSvmPtr();
return svmPtr;
}
void
Device::svmFree(void *ptr) const
{
amd::Memory * svmMem = NULL;
svmMem = amd::SvmManager::FindSvmBuffer(ptr);
if (NULL != svmMem) {
svmMem->release();
amd::SvmManager::RemoveSvmBuffer(ptr);
if (freeCPUMem_) {
amd::Os::alignedFree(ptr);
}
else {
amd::Memory * svmMem = NULL;
svmMem = amd::SvmManager::FindSvmBuffer(ptr);
if (NULL != svmMem) {
svmMem->release();
amd::SvmManager::RemoveSvmBuffer(ptr);
}
}
}