fix: Make makeResident explicitly blocking on linux

Currently this call is blocking on Windows and
xe kmd, this commit also makes it blocking on i915.

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2024-05-07 08:38:27 +00:00
committed by Compute-Runtime-Automation
parent e39893485c
commit 9095c3ed8a
3 changed files with 15 additions and 2 deletions

View File

@@ -17,7 +17,7 @@
#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 "shared/source/os_interface/os_context.h"
#include "shared/source/os_interface/linux/os_context_linux.h"
namespace NEO {
@@ -36,6 +36,10 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *devi
break;
}
}
for (const auto &engine : engines) {
static_cast<OsContextLinux *>(engine.osContext)->waitForPagingFence();
}
return result;
}

View File

@@ -29,7 +29,7 @@ class OsContextLinux : public OsContext {
const std::vector<uint32_t> &getDrmVmIds() const { return drmVmIds; }
bool isDirectSubmissionSupported() const override;
Drm &getDrm() const;
virtual void waitForPagingFence();
MOCKABLE_VIRTUAL void waitForPagingFence();
static OsContext *create(OSInterface *osInterface, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor);
void reInitializeContext() override;
void setHangDetected() {

View File

@@ -1409,6 +1409,15 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenLockedAndResidentAllocationsWhen
memoryManager->freeGraphicsMemory(allocation1);
}
TEST_F(DrmMemoryOperationsHandlerBindTest, whenCallMakeResidentThenWaitUntilResidencyCompleted) {
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
mock->fenceVal[0]++;
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1)), MemoryOperationsStatus::success);
EXPECT_EQ(mock->context.waitUserFenceCalled, 1u);
memoryManager->freeGraphicsMemory(allocation);
}
using DrmResidencyHandlerTests = ::testing::Test;
HWTEST2_F(DrmResidencyHandlerTests, givenClosIndexAndMemoryTypeWhenAskingForPatIndexThenReturnCorrectValue, IsWithinXeGfxFamily) {