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
This commit is contained in:
@@ -1063,8 +1063,12 @@ Device::init()
|
|||||||
info.flags.disableGpuTimeout = true;
|
info.flags.disableGpuTimeout = true;
|
||||||
#ifdef ATI_BITS_32
|
#ifdef ATI_BITS_32
|
||||||
info.flags.force32BitVaSpace = true;
|
info.flags.force32BitVaSpace = true;
|
||||||
|
info.flags.enableSvmMode = false;
|
||||||
|
#else
|
||||||
|
info.flags.enableSvmMode = true;
|
||||||
#endif
|
#endif
|
||||||
info.pSettingsPath = "OCL";
|
info.pSettingsPath = "OCL";
|
||||||
|
info.maxSvmSize = static_cast<Pal::gpusize>(OCL_SET_SVM_SIZE * Mi);
|
||||||
|
|
||||||
// PAL init
|
// PAL init
|
||||||
if (Pal::Result::Success !=
|
if (Pal::Result::Success !=
|
||||||
|
|||||||
@@ -80,6 +80,32 @@ GpuMemoryReference::Create(
|
|||||||
return memRef;
|
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*
|
||||||
GpuMemoryReference::Create(
|
GpuMemoryReference::Create(
|
||||||
const Device& dev,
|
const Device& dev,
|
||||||
@@ -997,6 +1023,36 @@ Resource::create(MemoryType memType, CreateParams* params)
|
|||||||
return true;
|
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 = {};
|
Pal::GpuMemoryCreateInfo createInfo = {};
|
||||||
createInfo.size = desc().width_ * elementSize_;
|
createInfo.size = desc().width_ * elementSize_;
|
||||||
// @todo 64K alignment is too big
|
// @todo 64K alignment is too big
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ public:
|
|||||||
const Device& dev,
|
const Device& dev,
|
||||||
const Pal::PinnedGpuMemoryCreateInfo& createInfo);
|
const Pal::PinnedGpuMemoryCreateInfo& createInfo);
|
||||||
|
|
||||||
|
static GpuMemoryReference* Create(
|
||||||
|
const Device& dev,
|
||||||
|
const Pal::SvmGpuMemoryCreateInfo& createInfo);
|
||||||
|
|
||||||
static GpuMemoryReference* Create(
|
static GpuMemoryReference* Create(
|
||||||
const Device& dev,
|
const Device& dev,
|
||||||
const Pal::ExternalResourceOpenInfo& openInfo);
|
const Pal::ExternalResourceOpenInfo& openInfo);
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ Settings::Settings()
|
|||||||
// GPU device by default
|
// GPU device by default
|
||||||
apuSystem_ = false;
|
apuSystem_ = false;
|
||||||
|
|
||||||
|
// Fine-Grained System is disabled by default
|
||||||
|
svmFineGrainSystem_ = false;
|
||||||
|
|
||||||
// Disable 64 bit pointers support by default
|
// Disable 64 bit pointers support by default
|
||||||
use64BitPtr_ = false;
|
use64BitPtr_ = false;
|
||||||
|
|
||||||
|
|||||||
@@ -3192,8 +3192,7 @@ VirtualGPU::processMemObjectsHSA(
|
|||||||
svmMem = amd::SvmManager::FindSvmBuffer(
|
svmMem = amd::SvmManager::FindSvmBuffer(
|
||||||
*reinterpret_cast<void* const*>(params + desc.offset_));
|
*reinterpret_cast<void* const*>(params + desc.offset_));
|
||||||
if (!svmMem) {
|
if (!svmMem) {
|
||||||
Unimplemented();
|
flushCUCaches();
|
||||||
//flushCUCaches();
|
|
||||||
// Clear memory dependency state
|
// Clear memory dependency state
|
||||||
const static bool All = true;
|
const static bool All = true;
|
||||||
memoryDependency().clear(!All);
|
memoryDependency().clear(!All);
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ release(int, AMD_GPU_FORCE_SINGLE_FP_DENORM, -1, \
|
|||||||
"Force denorm for single precision: -1 - don't force, 0 - disable, 1 - enable") \
|
"Force denorm for single precision: -1 - don't force, 0 - disable, 1 - enable") \
|
||||||
debug(bool, OCL_FORCE_CPU_SVM, false, \
|
debug(bool, OCL_FORCE_CPU_SVM, false, \
|
||||||
"force svm support for CPU") \
|
"force svm support for CPU") \
|
||||||
release(uint, OCL_SET_SVM_SIZE, 4096, \
|
release(uint, OCL_SET_SVM_SIZE, 16384, \
|
||||||
"set SVM space size for discrete GPU") \
|
"set SVM space size for discrete GPU") \
|
||||||
debug(uint, OCL_SYSMEM_REQUIREMENT, 2, \
|
debug(uint, OCL_SYSMEM_REQUIREMENT, 2, \
|
||||||
"Use flag to change the minimum requirement of system memory not to downgrade") \
|
"Use flag to change the minimum requirement of system memory not to downgrade") \
|
||||||
|
|||||||
Reference in New Issue
Block a user