Pass renderCompressed information to GMM for 64kb allocations

Change-Id: I56302055c028e919bceeb3333557cab7451e1d09
This commit is contained in:
Dunajski, Bartosz
2018-07-22 19:27:33 +02:00
committed by sys_ocldev
parent 8537c7f42f
commit 512978768e
19 changed files with 91 additions and 49 deletions

View File

@@ -68,6 +68,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
enum class AllocationType {
UNKNOWN = 0,
BUFFER_COMPRESSED,
BUFFER,
IMAGE,
TAG_BUFFER,

View File

@@ -20,19 +20,19 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/event/event.h"
#include "runtime/event/hw_timestamps.h"
#include "runtime/event/perf_counter.h"
#include "runtime/gmm_helper/gmm.h"
#include "runtime/gmm_helper/resource_info.h"
#include "runtime/memory_manager/deferred_deleter.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/event/event.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/basic_math.h"
#include "runtime/helpers/options.h"
#include "runtime/command_stream/command_stream_receiver.h"
#include "runtime/memory_manager/deferred_deleter.h"
#include "runtime/utilities/stackvec.h"
#include "runtime/utilities/tag_allocator.h"
#include "runtime/event/hw_timestamps.h"
#include "runtime/event/perf_counter.h"
#include <algorithm>
@@ -114,7 +114,7 @@ void *MemoryManager::allocateSystemMemory(size_t size, size_t alignment) {
GraphicsAllocation *MemoryManager::allocateGraphicsMemoryForSVM(size_t size, bool coherent) {
GraphicsAllocation *graphicsAllocation = nullptr;
if (peek64kbPagesEnabled()) {
graphicsAllocation = allocateGraphicsMemory64kb(size, MemoryConstants::pageSize64k, false);
graphicsAllocation = allocateGraphicsMemory64kb(size, MemoryConstants::pageSize64k, false, false);
} else {
graphicsAllocation = allocateGraphicsMemory(size);
}
@@ -375,6 +375,7 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, bool mustB
switch (type) {
case GraphicsAllocation::AllocationType::BUFFER:
case GraphicsAllocation::AllocationType::BUFFER_COMPRESSED:
case GraphicsAllocation::AllocationType::PIPE:
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
@@ -432,7 +433,8 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData &
return allocateGraphicsMemory(allocationData.size, allocationData.hostPtr, allocationData.flags.forcePin);
}
if (peek64kbPagesEnabled() && allocationData.flags.allow64kbPages) {
return allocateGraphicsMemory64kb(allocationData.size, MemoryConstants::pageSize64k, allocationData.flags.forcePin);
bool preferRenderCompressed = (allocationData.type == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
return allocateGraphicsMemory64kb(allocationData.size, MemoryConstants::pageSize64k, allocationData.flags.forcePin, preferRenderCompressed);
}
return allocateGraphicsMemory(allocationData.size, MemoryConstants::pageSize, allocationData.flags.forcePin, allocationData.flags.uncacheable);
}

View File

@@ -21,15 +21,15 @@
*/
#pragma once
#include "runtime/helpers/aligned_memory.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/memory_manager/host_ptr_defines.h"
#include "runtime/memory_manager/host_ptr_manager.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/os_interface/32bit_memory.h"
#include "runtime/helpers/aligned_memory.h"
#include <cstdint>
#include <vector>
#include <mutex>
#include <vector>
namespace OCLRT {
class Device;
@@ -121,7 +121,7 @@ class MemoryManager {
virtual GraphicsAllocation *allocateGraphicsMemory(size_t size, size_t alignment, bool forcePin, bool uncacheable) = 0;
virtual GraphicsAllocation *allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin) = 0;
virtual GraphicsAllocation *allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin, bool preferRenderCompressed) = 0;
virtual GraphicsAllocation *allocateGraphicsMemory(size_t size, const void *ptr) {
return MemoryManager::allocateGraphicsMemory(size, ptr, false);

View File

@@ -20,11 +20,11 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/helpers/basic_math.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
#include "runtime/gmm_helper/gmm.h"
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/basic_math.h"
#include "runtime/helpers/options.h"
#include "runtime/helpers/ptr_math.h"
#include "runtime/helpers/surface_formats.h"
@@ -63,7 +63,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory(size_t size,
return memoryAllocation;
}
GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin) {
GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin, bool preferRenderCompressed) {
auto memoryAllocation = allocateGraphicsMemory(alignUp(size, MemoryConstants::pageSize64k), MemoryConstants::pageSize64k, forcePin, false);
if (memoryAllocation) {
reinterpret_cast<MemoryAllocation *>(memoryAllocation)->overrideMemoryPool(MemoryPool::System64KBPages);

View File

@@ -21,8 +21,8 @@
*/
#pragma once
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/helpers/basic_math.h"
#include "runtime/memory_manager/memory_manager.h"
#include <map>
namespace OCLRT {
@@ -63,7 +63,7 @@ class OsAgnosticMemoryManager : public MemoryManager {
};
~OsAgnosticMemoryManager() override;
GraphicsAllocation *allocateGraphicsMemory(size_t size, size_t alignment, bool forcePin, bool uncacheable) override;
GraphicsAllocation *allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin) override;
GraphicsAllocation *allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin, bool preferRenderCompressed) override;
GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, const void *ptr, AllocationOrigin allocationOrigin) override;
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, bool requireSpecificBitness, bool reuseBO) override;
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle) override { return nullptr; }