P4 to Git Change 1333973 by rili@rili-opencl-pal-stg on 2016/10/31 10:41:30
SWDEV-95903 - Implement SVM on PAL feature. 1. Implement SVM Coarse Grain 2. Implement SVM Fine Grain Buffer Review:http://ocltc.amd.com/reviews/r/11706/ Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#30 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#17 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.hpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palsettings.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palvirtual.cpp#36 edit ... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#259 edit
Tá an tiomantas seo le fáil i:
@@ -80,6 +80,32 @@ GpuMemoryReference::Create(
|
||||
return memRef;
|
||||
}
|
||||
|
||||
GpuMemoryReference*
|
||||
GpuMemoryReference::Create(
|
||||
const Device& dev,
|
||||
const Pal::SvmGpuMemoryCreateInfo& createInfo)
|
||||
{
|
||||
Pal::Result result;
|
||||
size_t gpuMemSize = dev.iDev()->GetSvmGpuMemorySize(createInfo, &result);
|
||||
if (result != Pal::Result::Success) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GpuMemoryReference* memRef = new (gpuMemSize) GpuMemoryReference();
|
||||
if (memRef != nullptr) {
|
||||
result = dev.iDev()->CreateSvmGpuMemory(createInfo,
|
||||
&memRef[1], &memRef->gpuMem_);
|
||||
if (result != Pal::Result::Success) {
|
||||
memRef->release();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
// Update free memory size counters
|
||||
const_cast<Device&>(dev).updateFreeMemory(
|
||||
Pal::GpuHeap::GpuHeapGartCacheable, createInfo.size, false);
|
||||
return memRef;
|
||||
}
|
||||
|
||||
GpuMemoryReference*
|
||||
GpuMemoryReference::Create(
|
||||
const Device& dev,
|
||||
@@ -997,6 +1023,36 @@ Resource::create(MemoryType memType, CreateParams* params)
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((nullptr != params) &&
|
||||
(nullptr != params->owner_) &&
|
||||
(nullptr != params->owner_->getSvmPtr())) {
|
||||
// @todo 64K alignment is too big
|
||||
uint allocSize = amd::alignUp(desc().width_ * elementSize_, MaxGpuAlignment);
|
||||
if (memoryType() == Remote) {
|
||||
Pal::SvmGpuMemoryCreateInfo createInfo = {};
|
||||
createInfo.size = allocSize;
|
||||
createInfo.alignment = MaxGpuAlignment;
|
||||
memRef_ = GpuMemoryReference::Create(dev(), createInfo);
|
||||
}
|
||||
else {
|
||||
Pal::GpuMemoryCreateInfo createInfo = {};
|
||||
createInfo.size = allocSize;
|
||||
createInfo.alignment = MaxGpuAlignment;
|
||||
createInfo.vaRange = Pal::VaRange::Svm;
|
||||
createInfo.priority = Pal::GpuMemPriority::Normal;
|
||||
memTypeToHeap(&createInfo);
|
||||
memRef_ = GpuMemoryReference::Create(dev(), createInfo);
|
||||
}
|
||||
if (nullptr == memRef_) {
|
||||
LogError("Failed PAL memory allocation!");
|
||||
return false;
|
||||
}
|
||||
desc_.cardMemory_ = false;
|
||||
desc_.SVMRes_ = true;
|
||||
params->owner_->setSvmPtr(reinterpret_cast<void*>(memRef_->iMem()->Desc().gpuVirtAddr));
|
||||
return true;
|
||||
}
|
||||
|
||||
Pal::GpuMemoryCreateInfo createInfo = {};
|
||||
createInfo.size = desc().width_ * elementSize_;
|
||||
// @todo 64K alignment is too big
|
||||
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir