P4 to Git Change 1791677 by vsytchen@vsytchen-remote-ocl-win10 on 2019/06/04 13:42:04

SWDEV-79445 - OCL generic changes and code clean-up

	1. Add a flag to amd::memory::create() to force the allocation on all available devices.

	ReviewBoardURL = http://ocltc.amd.com/reviews/r/17466/diff/

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#137 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#110 edit
This commit is contained in:
foreman
2019-06-04 15:50:38 -04:00
parent 35e5cd5614
commit 322b50e683
2 changed files with 9 additions and 3 deletions
+7 -2
View File
@@ -227,9 +227,12 @@ bool Memory::allocHostMemory(void* initFrom, bool allocHostMem, bool forceCopy)
return true;
}
bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc) {
bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc, bool forceAlloc) {
static const bool forceAllocHostMem = false;
// Sanity checks (can't defer and force allocations at the same time)
assert(!(skipAlloc && forceAlloc));
initDeviceMemory();
// Check if it's a subbuffer allocation
@@ -260,7 +263,9 @@ bool Memory::create(void* initFrom, bool sysMemAlloc, bool skipAlloc) {
deviceMemories_[i].ref_ = devices[i];
deviceMemories_[i].value_ = NULL;
if (!skipAlloc && ((devices.size() == 1) || DISABLE_DEFERRED_ALLOC)) {
if (forceAlloc ||
(!skipAlloc &&
((devices.size() == 1) || DISABLE_DEFERRED_ALLOC))) {
device::Memory* mem = getDeviceMemory(*devices[i]);
if (NULL == mem) {
LogPrintfError("Can't allocate memory size - 0x%08X bytes!", getSize());
+2 -1
View File
@@ -239,7 +239,8 @@ class Memory : public amd::RuntimeObject {
//! Creates and initializes device (cache) memory for all devices
virtual bool create(void* initFrom = NULL, //!< Pointer to the initialization data
bool sysMemAlloc = false, //!< Allocate device memory in system memory
bool skipAlloc = false //!< Skip device memory allocation
bool skipAlloc = false, //!< Skip device memory allocation
bool forceAlloc = false //!< Force device memory allocation
);
//! Allocates device (cache) memory for a specific device