P4 to Git Change 1359979 by skudchad@skudchad_test_win_opencl2 on 2017/01/09 18:53:16
SWDEV-107271 - [OpenCL][GFXIP9 Bring up] add support for Raven(gfx901) - Fix USWC memory calculations - Try USWC allocations if local are unsuccessful ReviewBoardURL = http://ocltc.amd.com/reviews/r/12116/diff/ Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/paldevice.cpp#40 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palmemory.cpp#9 edit
This commit is contained in:
1 parent
9461bd5db9
commit
d535a9fbf4
2 files changed
+41
-6
No files matched your search
@@ -276,9 +276,11 @@ void NullDevice::fillDeviceInfo(
|
|||||||
(static_cast<cl_ulong>(std::min(GPU_MAX_HEAP_SIZE, 100u)) *
|
(static_cast<cl_ulong>(std::min(GPU_MAX_HEAP_SIZE, 100u)) *
|
||||||
static_cast<cl_ulong>(localRAM) / 100u);
|
static_cast<cl_ulong>(localRAM) / 100u);
|
||||||
|
|
||||||
|
uint uswcPercentAvailable = ((static_cast<cl_ulong>(heaps[Pal::GpuHeapGartUswc].heapSize) / Mi) > 1536 && IS_WINDOWS)
|
||||||
|
? 75 : 50;
|
||||||
if (settings().apuSystem_) {
|
if (settings().apuSystem_) {
|
||||||
info_.globalMemSize_ +=
|
info_.globalMemSize_ +=
|
||||||
(static_cast<cl_ulong>(heaps[Pal::GpuHeapGartUswc].heapSize) * Mi * 75)/100;
|
(static_cast<cl_ulong>(heaps[Pal::GpuHeapGartUswc].heapSize) * uswcPercentAvailable) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the largest heap form FB memory
|
// Find the largest heap form FB memory
|
||||||
@@ -289,7 +291,7 @@ void NullDevice::fillDeviceInfo(
|
|||||||
#if defined(ATI_OS_WIN)
|
#if defined(ATI_OS_WIN)
|
||||||
if (settings().apuSystem_) {
|
if (settings().apuSystem_) {
|
||||||
info_.maxMemAllocSize_ = std::max(
|
info_.maxMemAllocSize_ = std::max(
|
||||||
(static_cast<cl_ulong>(heaps[Pal::GpuHeapGartUswc].heapSize) * Mi * 75)/100,
|
(static_cast<cl_ulong>(heaps[Pal::GpuHeapGartUswc].heapSize) * uswcPercentAvailable)/100,
|
||||||
info_.maxMemAllocSize_);
|
info_.maxMemAllocSize_);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -124,12 +124,45 @@ Memory::create(
|
|||||||
Resource::CreateParams* params)
|
Resource::CreateParams* params)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
|
uint allocAttempt = 0;
|
||||||
// Reset the flag in case we reallocate the heap in local/remote
|
// Reset the flag in case we reallocate the heap in local/remote
|
||||||
flags_ &= ~HostMemoryDirectAccess;
|
flags_ &= ~HostMemoryDirectAccess;
|
||||||
|
|
||||||
// Create a resource in CAL
|
do {
|
||||||
result = Resource::create(memType, params);
|
// Create a resource in CAL
|
||||||
|
result = Resource::create(memType, params);
|
||||||
|
if (!result) {
|
||||||
|
size_t freeMemory[2];
|
||||||
|
// if requested memory is greater than available then exit the loop
|
||||||
|
dev().globalFreeMemory(freeMemory);
|
||||||
|
|
||||||
|
// Local to Persistent
|
||||||
|
if (memoryType() == Local) {
|
||||||
|
// For dgpu freeMemory[0] reports a sum of visible+invisible fb
|
||||||
|
if (owner()->getSize() > (freeMemory[0] * Ki)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
memType = Persistent;
|
||||||
|
}
|
||||||
|
// Don't switch to USWC if persistent memory was explicitly asked
|
||||||
|
else if ((allocAttempt > 0) && (memoryType() == Persistent)) {
|
||||||
|
memType = RemoteUSWC;
|
||||||
|
}
|
||||||
|
// Remote cacheable to uncacheable
|
||||||
|
else if (memoryType() == Remote) {
|
||||||
|
memType = RemoteUSWC;
|
||||||
|
}
|
||||||
|
else if (dev().settings().apuSystem_ && memoryType() == RemoteUSWC) {
|
||||||
|
if (owner()->getSize() > (freeMemory[0] * Ki)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
allocAttempt++;
|
||||||
|
}
|
||||||
|
} while (!result);
|
||||||
|
|
||||||
// Check if CAL created a resource
|
// Check if CAL created a resource
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|||||||
Reference in new issue
Block a user