mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Pass renderCompressed information to GMM for 64kb allocations
Change-Id: I56302055c028e919bceeb3333557cab7451e1d09
This commit is contained in:
committed by
sys_ocldev
parent
8537c7f42f
commit
512978768e
@@ -25,12 +25,14 @@
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/debug_helpers.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/ptr_math.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
|
||||
namespace OCLRT {
|
||||
Gmm::Gmm(const void *alignedPtr, size_t alignedSize, bool uncacheable) {
|
||||
Gmm::Gmm(const void *alignedPtr, size_t alignedSize, bool uncacheable) : Gmm(alignedPtr, alignedSize, uncacheable, false) {}
|
||||
|
||||
Gmm::Gmm(const void *alignedPtr, size_t alignedSize, bool uncacheable, bool preferRenderCompressed) {
|
||||
resourceParams.Type = RESOURCE_BUFFER;
|
||||
resourceParams.Format = GMM_FORMAT_GENERIC_8BIT;
|
||||
resourceParams.BaseWidth = static_cast<uint32_t>(alignedSize);
|
||||
@@ -55,7 +57,7 @@ Gmm::Gmm(const void *alignedPtr, size_t alignedSize, bool uncacheable) {
|
||||
resourceParams.Flags.Gpu.NoRestriction = 1;
|
||||
}
|
||||
|
||||
applyAuxFlagsForBuffer(false);
|
||||
applyAuxFlagsForBuffer(preferRenderCompressed);
|
||||
|
||||
gmmResourceInfo.reset(GmmResourceInfo::create(&resourceParams));
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/api/cl_types.h"
|
||||
#include "runtime/gmm_helper/gmm_lib.h"
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include "runtime/gmm_helper/gmm_lib.h"
|
||||
#include "runtime/api/cl_types.h"
|
||||
|
||||
namespace OCLRT {
|
||||
enum class OCLPlane;
|
||||
@@ -39,6 +39,7 @@ class Gmm {
|
||||
Gmm() = delete;
|
||||
Gmm(ImageInfo &inputOutputImgInfo);
|
||||
Gmm(const void *alignedPtr, size_t alignedSize, bool uncacheable);
|
||||
Gmm(const void *alignedPtr, size_t alignedSize, bool uncacheable, bool preferRenderCompressed);
|
||||
Gmm(GMM_RESOURCE_INFO *inputGmm);
|
||||
|
||||
void queryImageParams(ImageInfo &inputOutputImgInfo);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
|
||||
enum class AllocationType {
|
||||
UNKNOWN = 0,
|
||||
BUFFER_COMPRESSED,
|
||||
BUFFER,
|
||||
IMAGE,
|
||||
TAG_BUFFER,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -204,7 +204,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemory(size_t size, const void
|
||||
return res;
|
||||
}
|
||||
|
||||
DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin) {
|
||||
DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin, bool preferRenderCompressed) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class DrmMemoryManager : public MemoryManager {
|
||||
void removeAllocationFromHostPtrManager(GraphicsAllocation *gfxAllocation) override;
|
||||
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override;
|
||||
DrmAllocation *allocateGraphicsMemory(size_t size, size_t alignment, bool forcePin, bool uncacheable) override;
|
||||
DrmAllocation *allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin) override;
|
||||
DrmAllocation *allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin, bool preferRenderCompressed) override;
|
||||
DrmAllocation *allocateGraphicsMemory(size_t size, const void *ptr) override {
|
||||
return allocateGraphicsMemory(size, ptr, false);
|
||||
}
|
||||
|
||||
@@ -75,13 +75,13 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo
|
||||
return allocation;
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin) {
|
||||
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(size_t size, size_t alignment, bool forcePin, bool preferRenderCompressed) {
|
||||
size_t sizeAligned = alignUp(size, MemoryConstants::pageSize64k);
|
||||
Gmm *gmm = nullptr;
|
||||
|
||||
auto wddmAllocation = new WddmAllocation(nullptr, sizeAligned, nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages);
|
||||
|
||||
gmm = new Gmm(nullptr, sizeAligned, false);
|
||||
gmm = new Gmm(nullptr, sizeAligned, false, preferRenderCompressed);
|
||||
wddmAllocation->gmm = gmm;
|
||||
|
||||
if (!wddm->createAllocation64k(wddmAllocation)) {
|
||||
|
||||
@@ -46,7 +46,7 @@ class WddmMemoryManager : public MemoryManager {
|
||||
WddmMemoryManager &operator=(const WddmMemoryManager &) = delete;
|
||||
|
||||
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) 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 *allocateGraphicsMemory(size_t size, size_t alignment, bool forcePin, bool uncacheable) override;
|
||||
GraphicsAllocation *allocateGraphicsMemory(size_t size, const void *ptr) override;
|
||||
GraphicsAllocation *allocate32BitGraphicsMemory(size_t size, const void *ptr, AllocationOrigin allocationOrigin) override;
|
||||
|
||||
Reference in New Issue
Block a user