fix: initial support for single temporary allocations list

Related-To: NEO-14641

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-05-21 11:35:07 +00:00
committed by Compute-Runtime-Automation
parent f25fa0ad27
commit 91940d2a79
14 changed files with 562 additions and 77 deletions

View File

@@ -30,6 +30,7 @@ namespace NEO {
using SubDeviceIdsVec = StackVec<uint32_t, 4>;
class AllocationsList;
class MultiGraphicsAllocation;
class CpuPageFaultManager;
class GfxPartition;
@@ -205,7 +206,7 @@ class MemoryManager {
void waitForDeletions();
MOCKABLE_VIRTUAL void waitForEnginesCompletion(GraphicsAllocation &graphicsAllocation);
MOCKABLE_VIRTUAL bool allocInUse(GraphicsAllocation &graphicsAllocation);
MOCKABLE_VIRTUAL bool allocInUse(GraphicsAllocation &graphicsAllocation) const;
void cleanTemporaryAllocationListOnAllEngines(bool waitForCompletion);
bool isAsyncDeleterEnabled() const;
@@ -355,6 +356,12 @@ class MemoryManager {
std::optional<std::reference_wrapper<CustomHeapAllocatorConfig>> getCustomHeapAllocatorConfig(AllocationType allocationType, bool isFrontWindowPool);
void removeCustomHeapAllocatorConfig(AllocationType allocationType, bool isFrontWindowPool);
void storeTemporaryAllocation(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t osContextId, TaskCountType taskCount);
void cleanTemporaryAllocations(const CommandStreamReceiver &csr, TaskCountType waitTaskCount);
std::unique_ptr<GraphicsAllocation> obtainTemporaryAllocationWithPtr(CommandStreamReceiver *csr, size_t requiredSize, const void *requiredPtr, AllocationType allocationType);
bool isSingleTemporaryAllocationsListEnabled() const { return singleTemporaryAllocationsList; }
AllocationsList &getTemporaryAllocationsList() const { return *temporaryAllocations; }
protected:
bool getAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const void *hostPtr, const StorageInfo &storageInfo);
static void overrideAllocationData(AllocationData &allocationData, const AllocationProperties &properties);
@@ -396,6 +403,7 @@ class MemoryManager {
bool initialized = false;
bool forceNonSvmForExternalHostPtr = false;
bool force32bitAllocations = false;
bool singleTemporaryAllocationsList = false;
std::unique_ptr<DeferredDeleter> deferredDeleter;
bool asyncDeleterEnabled = false;
std::vector<bool> enable64kbpages;
@@ -406,6 +414,7 @@ class MemoryManager {
MultiDeviceEngineControlContainer allRegisteredEngines;
MultiDeviceEngineControlContainer secondaryEngines;
std::unique_ptr<HostPtrManager> hostPtrManager;
std::unique_ptr<AllocationsList> temporaryAllocations;
uint32_t latestContextId = std::numeric_limits<uint32_t>::max();
std::map<uint32_t, uint32_t> rootDeviceIndexToContextId; // This map will contain initial value of latestContextId for each rootDeviceIndex
std::unique_ptr<DeferredDeleter> multiContextResourceDestructor;