mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Revert "fix: submit dummy exec to pin memory during zeContextMakeMemoryReside...
This reverts commit f9b87d53e6.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
19dd63ba1c
commit
d842f65cf1
@@ -347,13 +347,9 @@ NEO::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t size
|
||||
void DrmMemoryManager::emitPinningRequest(BufferObject *bo, const AllocationData &allocationData) const {
|
||||
auto rootDeviceIndex = allocationData.rootDeviceIndex;
|
||||
if (forcePinEnabled && pinBBs.at(rootDeviceIndex) != nullptr && allocationData.flags.forcePin && allocationData.size >= this->pinThreshold) {
|
||||
emitPinningRequestForBoContainer(&bo, 1, rootDeviceIndex);
|
||||
pinBBs.at(rootDeviceIndex)->pin(&bo, 1, getDefaultOsContext(rootDeviceIndex), 0, getDefaultDrmContextId(rootDeviceIndex));
|
||||
}
|
||||
}
|
||||
SubmissionStatus DrmMemoryManager::emitPinningRequestForBoContainer(BufferObject **bo, uint32_t boCount, uint32_t rootDeviceIndex) const {
|
||||
auto ret = pinBBs.at(rootDeviceIndex)->pin(bo, boCount, getDefaultOsContext(rootDeviceIndex), 0, getDefaultDrmContextId(rootDeviceIndex));
|
||||
return ret == 0 ? SubmissionStatus::success : SubmissionStatus::outOfMemory;
|
||||
}
|
||||
|
||||
StorageInfo DrmMemoryManager::createStorageInfoFromProperties(const AllocationProperties &properties) {
|
||||
auto storageInfo{MemoryManager::createStorageInfoFromProperties(properties)};
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/command_stream/submission_status.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/os_interface/linux/drm_buffer_object.h"
|
||||
|
||||
@@ -110,7 +109,6 @@ class DrmMemoryManager : public MemoryManager {
|
||||
|
||||
bool isCompressionSupportedForShareable(bool isShareable) override;
|
||||
bool usmCompressionSupported(Device *device) override;
|
||||
MOCKABLE_VIRTUAL SubmissionStatus emitPinningRequestForBoContainer(BufferObject **bo, uint32_t boCount, uint32_t rootDeviceIndex) const;
|
||||
|
||||
protected:
|
||||
void registerSharedBoHandleAllocation(DrmAllocation *drmAllocation);
|
||||
|
||||
@@ -26,7 +26,7 @@ DrmMemoryOperationsHandlerBind::DrmMemoryOperationsHandlerBind(const RootDeviceE
|
||||
|
||||
DrmMemoryOperationsHandlerBind::~DrmMemoryOperationsHandlerBind() = default;
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) {
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
|
||||
auto &engines = device->getAllEngines();
|
||||
MemoryOperationsStatus result = MemoryOperationsStatus::success;
|
||||
for (const auto &engine : engines) {
|
||||
@@ -43,7 +43,7 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::lock(Device *device, Arra
|
||||
for (auto gfxAllocation = gfxAllocations.begin(); gfxAllocation != gfxAllocations.end(); gfxAllocation++) {
|
||||
(*gfxAllocation)->setLockedMemory(true);
|
||||
}
|
||||
return makeResident(device, gfxAllocations, false);
|
||||
return makeResident(device, gfxAllocations);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) {
|
||||
|
||||
@@ -17,7 +17,7 @@ class DrmMemoryOperationsHandlerBind : public DrmMemoryOperationsHandler {
|
||||
~DrmMemoryOperationsHandlerBind() override;
|
||||
|
||||
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override;
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override;
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override;
|
||||
|
||||
@@ -7,12 +7,9 @@
|
||||
|
||||
#include "shared/source/os_interface/linux/drm_memory_operations_handler_default.h"
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/os_interface/linux/drm_allocation.h"
|
||||
#include "shared/source/os_interface/linux/drm_buffer_object.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_manager.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -29,13 +26,9 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResidentWithinOsCo
|
||||
return MemoryOperationsStatus::success;
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) {
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
|
||||
OsContext *osContext = nullptr;
|
||||
auto ret = this->makeResidentWithinOsContext(osContext, gfxAllocations, false);
|
||||
if (!isDummyExecNeeded || ret != MemoryOperationsStatus::success) {
|
||||
return ret;
|
||||
}
|
||||
return flushDummyExec(device, gfxAllocations);
|
||||
return this->makeResidentWithinOsContext(osContext, gfxAllocations, false);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
|
||||
@@ -102,28 +95,4 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::evictUnusedAllocations
|
||||
return MemoryOperationsStatus::success;
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::flushDummyExec(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
|
||||
OsContext *osContext = nullptr;
|
||||
auto memoryManager = reinterpret_cast<DrmMemoryManager *>(device->getMemoryManager());
|
||||
|
||||
std::vector<BufferObject *> boArray;
|
||||
uint32_t boCount = 0;
|
||||
for (auto &alloc : this->residency) {
|
||||
for (auto &bo : reinterpret_cast<DrmAllocation *>(alloc)->getBOs()) {
|
||||
if (bo != 0) {
|
||||
boArray.push_back(bo);
|
||||
boCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto submissionStatus = memoryManager->emitPinningRequestForBoContainer(boArray.data(), boCount, rootDeviceIndex);
|
||||
if (submissionStatus != SubmissionStatus::success) {
|
||||
for (auto &alloc : gfxAllocations) {
|
||||
evictWithinOsContext(osContext, *alloc);
|
||||
}
|
||||
return MemoryOperationsStatus::outOfMemory;
|
||||
}
|
||||
return MemoryOperationsStatus::success;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -20,7 +20,7 @@ class DrmMemoryOperationsHandlerDefault : public DrmMemoryOperationsHandler {
|
||||
~DrmMemoryOperationsHandlerDefault() override;
|
||||
|
||||
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override;
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override;
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override;
|
||||
@@ -30,7 +30,6 @@ class DrmMemoryOperationsHandlerDefault : public DrmMemoryOperationsHandler {
|
||||
[[nodiscard]] std::unique_lock<std::mutex> lockHandlerIfUsed() override;
|
||||
|
||||
MemoryOperationsStatus evictUnusedAllocations(bool waitForCompletion, bool isLockNeeded) override;
|
||||
MOCKABLE_VIRTUAL MemoryOperationsStatus flushDummyExec(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations);
|
||||
|
||||
protected:
|
||||
std::unordered_set<GraphicsAllocation *> residency;
|
||||
|
||||
@@ -36,13 +36,13 @@ class DrmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
|
||||
|
||||
~DrmMemoryOperationsHandlerWithAubDump() override = default;
|
||||
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override {
|
||||
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, isDummyExecNeeded);
|
||||
return BaseOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded);
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
|
||||
aubMemoryOperationsHandler->makeResident(device, gfxAllocations);
|
||||
return BaseOperationsHandler::makeResident(device, gfxAllocations);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
|
||||
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, false);
|
||||
aubMemoryOperationsHandler->makeResident(device, gfxAllocations);
|
||||
return BaseOperationsHandler::lock(device, gfxAllocations);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user