P4 to Git Change 1095130 by xcui@merged_opencl_jxcwin on 2014/11/07 18:09:55
EPR #408459 - changed the implementation of svmAlloc, so that the first device can create amd::Memory object, and the rest of devices only added gpu memory to it. This is part of changes for mgpu support for svmalloc code review: http://ocltc.amd.com/reviews/r/6245/ precheckin testing results: http://ocltc.amd.com:8111/viewModification.html?modId=43136&personal=true&buildTypeId=&tab=vcsModificationTests Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/cpu/cpudevice.hpp#88 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#233 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.cpp#479 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpudevice.hpp#133 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.cpp#87 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa/hsadevice.hpp#44 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.cpp#19 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/hsa_foundation/hsadevice.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/context.cpp#34 edit
이 커밋은 다음에 포함됨:
@@ -2467,7 +2467,7 @@ Device::hostFree(void* ptr, size_t size) const
|
||||
}
|
||||
|
||||
void*
|
||||
Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_mem_flags flags) const
|
||||
Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_mem_flags flags, void* svmPtr) const
|
||||
{
|
||||
alignment = std::max(alignment, static_cast<size_t>(info_.memBaseAddrAlign_));
|
||||
|
||||
@@ -2476,25 +2476,34 @@ Device::svmAlloc(amd::Context& context, size_t size, size_t alignment, cl_svm_me
|
||||
alignment = (alignment < vmBigK) ? vmBigK : alignment;
|
||||
|
||||
size = amd::alignUp(size, alignment);
|
||||
amd::Memory* mem = NULL;
|
||||
if (NULL == svmPtr) {
|
||||
//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) {
|
||||
LogError("failed to create a svm mem object!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!mem->create(NULL, false)) {
|
||||
LogError("failed to create a svm hidden buffer!");
|
||||
mem->release();
|
||||
return NULL;
|
||||
}
|
||||
gpu::Memory* gpuMem = getGpuMemory(mem);
|
||||
//add the information to context so that we can use it later.
|
||||
amd::SvmManager::AddSvmBuffer(mem->getSvmPtr(), mem);
|
||||
|
||||
//create a hidden buffer, which will allocated on the device later
|
||||
amd::Memory* mem = new (context) amd::Buffer(context, flags, size, reinterpret_cast<void*>(1));
|
||||
if (mem == NULL) {
|
||||
LogError("failed to create a svm mem object!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!mem->create(NULL, false)) {
|
||||
LogError("failed to create a svm hidden buffer!");
|
||||
mem->release();
|
||||
return NULL;
|
||||
else {
|
||||
//find the existing amd::mem object
|
||||
mem = amd::SvmManager::FindSvmBuffer(svmPtr);
|
||||
if (NULL == mem) {
|
||||
return NULL;
|
||||
}
|
||||
gpu::Memory* gpuMem = getGpuMemory(mem);
|
||||
}
|
||||
|
||||
gpu::Memory* gpuMem = getGpuMemory(mem);
|
||||
|
||||
//add the information to context so that we can use it later.
|
||||
amd::SvmManager::AddSvmBuffer(mem->getSvmPtr(), mem);
|
||||
|
||||
return mem->getSvmPtr();
|
||||
}
|
||||
|
||||
|
||||
새 이슈에서 참조
사용자 차단