performance: Disable force pin for ULLS light

Related-To: NEO-13922

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-02-14 12:57:12 +00:00
committed by Compute-Runtime-Automation
parent 1a996d666a
commit 7cb7229c1c
4 changed files with 30 additions and 0 deletions

View File

@@ -12,6 +12,7 @@
#include "shared/source/direct_submission/linux/drm_direct_submission.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 "shared/source/os_interface/linux/drm_memory_operations_handler.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/linux/drm_wrappers.h"
@@ -48,6 +49,10 @@ DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(const DirectSubm
auto &drm = osContextLinux->getDrm();
drm.setDirectSubmissionActive(true);
if (!drm.isVmBindAvailable()) {
static_cast<DrmMemoryManager *>(this->memoryManager)->disableForcePin();
}
auto usePciBarrier = !this->hwInfo->capabilityTable.isIntegratedDevice;
if (debugManager.flags.DirectSubmissionPCIBarrier.get() != -1) {
usePciBarrier = debugManager.flags.DirectSubmissionPCIBarrier.get();

View File

@@ -1775,6 +1775,10 @@ void DrmMemoryManager::drainGemCloseWorker() const {
}
}
void DrmMemoryManager::disableForcePin() {
this->forcePinEnabled = false;
}
bool DrmMemoryManager::copyMemoryToAllocation(GraphicsAllocation *graphicsAllocation, size_t destinationOffset, const void *memoryToCopy, size_t sizeToCopy) {
if (graphicsAllocation->getUnderlyingBuffer() && (graphicsAllocation->storageInfo.getNumBanks() == 1 || GraphicsAllocation::isDebugSurfaceAllocationType(graphicsAllocation->getAllocationType()))) {
return MemoryManager::copyMemoryToAllocation(graphicsAllocation, destinationOffset, memoryToCopy, sizeToCopy);

View File

@@ -130,6 +130,7 @@ class DrmMemoryManager : public MemoryManager {
size_t getUserptrAlignment();
void drainGemCloseWorker() const override;
void disableForcePin();
decltype(&mmap) mmapFunction = mmap;
decltype(&munmap) munmapFunction = munmap;

View File

@@ -108,6 +108,26 @@ struct MockDrmDirectSubmission : public DrmDirectSubmission<GfxFamily, Dispatche
using namespace NEO;
struct MockDrmMemoryManagerForcePin : public DrmMemoryManager {
using DrmMemoryManager::forcePinEnabled;
};
HWTEST_F(DrmDirectSubmissionTest, whenCreateDrmDirectSubmissionLightThenDisableForcePin) {
EXPECT_TRUE(static_cast<MockDrmMemoryManagerForcePin *>(executionEnvironment.memoryManager.get())->forcePinEnabled);
auto drm = static_cast<DrmMock *>(executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>());
drm->bindAvailable = false;
MockDrmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> drmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
EXPECT_FALSE(static_cast<MockDrmMemoryManagerForcePin *>(executionEnvironment.memoryManager.get())->forcePinEnabled);
}
HWTEST_F(DrmDirectSubmissionTest, whenCreateDrmDirectSubmissionThenEnableForcePin) {
EXPECT_TRUE(static_cast<MockDrmMemoryManagerForcePin *>(executionEnvironment.memoryManager.get())->forcePinEnabled);
auto drm = static_cast<DrmMock *>(executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>());
drm->bindAvailable = true;
MockDrmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> drmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);
EXPECT_TRUE(static_cast<MockDrmMemoryManagerForcePin *>(executionEnvironment.memoryManager.get())->forcePinEnabled);
}
HWTEST_F(DrmDirectSubmissionTest, givenDrmDirectSubmissionWhenCallingLinuxImplementationThenExpectInitialImplementationValues) {
MockDrmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>> drmDirectSubmission(*device->getDefaultEngine().commandStreamReceiver);