mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Do not bind command buffer separately
Improve performance by binding the command buffer together with other allocations if VM_BIND feature is available. Remove the legacy flag PassBoundBOToExec from DebugManager to simplify the logic. Adapt unit tests and reuse handy macros to generate proxy mock-methods. Related-To: NEO-7348 Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e6daa207ad
commit
11eb0aa769
@@ -468,7 +468,6 @@ DECLARE_DEBUG_VARIABLE(int64_t, ForceNonSystemMemoryPlacement, 0, "0: default,
|
||||
DECLARE_DEBUG_VARIABLE(int64_t, ForceUncachedGmmUsageType, 0, "0: default, >0: (bitmask) for given Graphics Allocation Type, force uncached gmm resource type")
|
||||
DECLARE_DEBUG_VARIABLE(int64_t, DisableIndirectAccess, -1, "0: default, 0: Use indirect access settings provided by application, 1: Disable indirect access and ignore settings provided by application")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UseVmBind, -1, "Use new residency model on Linux (requires kernel support), -1: default, 0: disabled, 1: enabled")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, PassBoundBOToExec, -1, "Pass bound BOs to exec call to keep dependencies")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableStaticPartitioning, -1, "Divide workload into partitions during dispatch, -1: default, 0: disabled, 1: enabled")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UpdateTaskCountFromWait, -1, " Do not update task count after each enqueue, but send update request while wait, -1: default(disabled), 0: disabled, 1: enabled on gpgpu engine with direct submission, 2: enabled on any direct submission, 3: enabled")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableTimestampWaitForQueues, -1, "Wait on queues using timestamps, -1: default(disabled), 0: disabled, 1: enabled where UpdateTaskCountFromWait enabled, 2: enabled on gpgpu engine with direct submission, 3: enabled on any direct submission, 4: enabled")
|
||||
|
||||
@@ -116,6 +116,10 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBu
|
||||
|
||||
this->printBOsForSubmit(allocationsForResidency, *batchBuffer.commandBufferAllocation);
|
||||
|
||||
if (this->drm->isVmBindAvailable()) {
|
||||
allocationsForResidency.push_back(batchBuffer.commandBufferAllocation);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus retVal = memoryOperationsInterface->mergeWithResidencyContainer(this->osContext, allocationsForResidency);
|
||||
if (retVal != MemoryOperationsStatus::SUCCESS) {
|
||||
if (retVal == MemoryOperationsStatus::OUT_OF_MEMORY) {
|
||||
@@ -124,16 +128,6 @@ SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBu
|
||||
return SubmissionStatus::FAILED;
|
||||
}
|
||||
|
||||
if (this->drm->isVmBindAvailable()) {
|
||||
retVal = memoryOperationsInterface->makeResidentWithinOsContext(this->osContext, ArrayRef<GraphicsAllocation *>(&batchBuffer.commandBufferAllocation, 1), true);
|
||||
if (retVal != MemoryOperationsStatus::SUCCESS) {
|
||||
if (retVal == MemoryOperationsStatus::OUT_OF_MEMORY) {
|
||||
return SubmissionStatus::OUT_OF_MEMORY;
|
||||
}
|
||||
return SubmissionStatus::FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->directSubmission.get()) {
|
||||
this->startControllingDirectSubmissions();
|
||||
bool ret = this->directSubmission->dispatchCommandBuffer(batchBuffer, *this->flushStamp.get());
|
||||
@@ -211,7 +205,9 @@ int DrmCommandStreamReceiver<GfxFamily>::exec(const BatchBuffer &batchBuffer, ui
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(this->osContext);
|
||||
auto execFlags = osContextLinux->getEngineFlag() | drm->getIoctlHelper()->getDrmParamValue(DrmParam::ExecNoReloc);
|
||||
|
||||
// Residency hold all allocation except command buffer, hence + 1
|
||||
// requiredSize determinant:
|
||||
// * vmBind UNAVAILABLE => residency holds all allocations except for the command buffer
|
||||
// * vmBind AVAILABLE => residency holds command buffer as well
|
||||
auto requiredSize = this->residency.size() + 1;
|
||||
if (requiredSize > this->execObjectsStorage.size()) {
|
||||
this->execObjectsStorage.resize(requiredSize);
|
||||
@@ -219,8 +215,7 @@ int DrmCommandStreamReceiver<GfxFamily>::exec(const BatchBuffer &batchBuffer, ui
|
||||
|
||||
uint64_t completionGpuAddress = 0;
|
||||
uint32_t completionValue = 0;
|
||||
if (this->drm->isVmBindAvailable() &&
|
||||
this->drm->completionFenceSupport()) {
|
||||
if (this->drm->isVmBindAvailable() && this->drm->completionFenceSupport()) {
|
||||
completionGpuAddress = getTagAllocation()->getGpuAddress() + (index * this->postSyncWriteOffset) + Drm::completionFenceOffset;
|
||||
completionValue = this->latestSentTaskCount;
|
||||
}
|
||||
@@ -243,16 +238,18 @@ int DrmCommandStreamReceiver<GfxFamily>::exec(const BatchBuffer &batchBuffer, ui
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) {
|
||||
bool ret = 0;
|
||||
if ((!drm->isVmBindAvailable()) || (DebugManager.flags.PassBoundBOToExec.get() == 1)) {
|
||||
for (auto &alloc : inputAllocationsForResidency) {
|
||||
auto drmAlloc = static_cast<DrmAllocation *>(alloc);
|
||||
ret = drmAlloc->makeBOsResident(osContext, handleId, &this->residency, false);
|
||||
if (ret != 0) {
|
||||
break;
|
||||
}
|
||||
if (drm->isVmBindAvailable()) {
|
||||
return true;
|
||||
}
|
||||
int ret = 0;
|
||||
for (auto &alloc : inputAllocationsForResidency) {
|
||||
auto drmAlloc = static_cast<DrmAllocation *>(alloc);
|
||||
ret = drmAlloc->makeBOsResident(osContext, handleId, &this->residency, false);
|
||||
if (ret != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,21 @@
|
||||
#pragma once
|
||||
#include "shared/source/os_interface/linux/drm_command_stream.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
#include "shared/test/common/test_macros/mock_method_macros.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
template <typename GfxFamily>
|
||||
class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily> {
|
||||
public:
|
||||
using BaseClass = DrmCommandStreamReceiver<GfxFamily>;
|
||||
using BaseClass::drm;
|
||||
using BaseClass::exec;
|
||||
using BaseClass::execObjectsStorage;
|
||||
using BaseClass::residency;
|
||||
using BaseClass::useContextForUserFenceWait;
|
||||
using BaseClass::useUserFenceWait;
|
||||
using CommandStreamReceiver::activePartitions;
|
||||
using CommandStreamReceiver::clearColorAllocation;
|
||||
using CommandStreamReceiver::commandStream;
|
||||
@@ -32,11 +41,6 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
||||
using CommandStreamReceiver::useGpuIdleImplicitFlush;
|
||||
using CommandStreamReceiver::useNewResourceImplicitFlush;
|
||||
using CommandStreamReceiver::useNotifyEnableForPostSync;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::exec;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::residency;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::useContextForUserFenceWait;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::useUserFenceWait;
|
||||
using DrmCommandStreamReceiver<GfxFamily>::execObjectsStorage;
|
||||
using CommandStreamReceiverHw<GfxFamily>::directSubmission;
|
||||
using CommandStreamReceiverHw<GfxFamily>::blitterDirectSubmission;
|
||||
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiver::lastSentSliceCount;
|
||||
@@ -59,7 +63,7 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
||||
void makeNonResident(GraphicsAllocation &gfxAllocation) override {
|
||||
makeNonResidentResult.called = true;
|
||||
makeNonResidentResult.allocation = &gfxAllocation;
|
||||
DrmCommandStreamReceiver<GfxFamily>::makeNonResident(gfxAllocation);
|
||||
BaseClass::makeNonResident(gfxAllocation);
|
||||
}
|
||||
|
||||
struct MakeResidentNonResidentResult {
|
||||
@@ -73,19 +77,9 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
||||
return this->submissionAggregator.get();
|
||||
}
|
||||
|
||||
bool processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
|
||||
if (callBaseProcessResidency) {
|
||||
return DrmCommandStreamReceiver<GfxFamily>::processResidency(allocationsForResidency, handleId);
|
||||
}
|
||||
return processResidencyResult;
|
||||
}
|
||||
ADDMETHOD(processResidency, bool, true, true, (const ResidencyContainer &allocationsForResidency, uint32_t handleId), (allocationsForResidency, handleId));
|
||||
|
||||
int exec(const BatchBuffer &batchBuffer, uint32_t vmHandleId, uint32_t drmContextId, uint32_t index) override {
|
||||
if (callBaseExec) {
|
||||
return DrmCommandStreamReceiver<GfxFamily>::exec(batchBuffer, vmHandleId, drmContextId, index);
|
||||
}
|
||||
return execResult;
|
||||
}
|
||||
ADDMETHOD(exec, int, true, 0, (const BatchBuffer &batchBuffer, uint32_t vmHandleId, uint32_t drmContextId, uint32_t index), (batchBuffer, vmHandleId, drmContextId, index));
|
||||
|
||||
void overrideSubmissionAggregator(SubmissionAggregator *newSubmissionsAggregator) {
|
||||
this->submissionAggregator.reset(newSubmissionsAggregator);
|
||||
@@ -113,30 +107,24 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver<GfxFamily
|
||||
waitUserFenceResult.waitValue = waitValue;
|
||||
|
||||
if (waitUserFenceResult.callParent) {
|
||||
return DrmCommandStreamReceiver<GfxFamily>::waitUserFence(waitValue);
|
||||
return BaseClass::waitUserFence(waitValue);
|
||||
} else {
|
||||
return waitUserFenceResult.returnValue;
|
||||
}
|
||||
}
|
||||
|
||||
SubmissionStatus flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency) override {
|
||||
if (callHwFlush) {
|
||||
return DrmCommandStreamReceiver<GfxFamily>::flushInternal(batchBuffer, allocationsForResidency);
|
||||
}
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
ADDMETHOD(flushInternal, SubmissionStatus, true, SubmissionStatus::SUCCESS, (const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency), (batchBuffer, allocationsForResidency));
|
||||
|
||||
void readBackAllocation(void *source) override {
|
||||
latestReadBackAddress = source;
|
||||
DrmCommandStreamReceiver<GfxFamily>::readBackAllocation(source);
|
||||
}
|
||||
|
||||
void plugProxyDrm(DrmMock *proxyDrm) {
|
||||
this->drm = proxyDrm;
|
||||
}
|
||||
|
||||
void *latestReadBackAddress = nullptr;
|
||||
bool callHwFlush = true;
|
||||
bool callBaseProcessResidency = true;
|
||||
bool processResidencyResult = true;
|
||||
bool callBaseExec = true;
|
||||
int execResult = 0;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -108,7 +108,6 @@ EnableDirectSubmissionController = -1
|
||||
DirectSubmissionControllerTimeout = -1
|
||||
DirectSubmissionControllerDivisor = -1
|
||||
UseVmBind = -1
|
||||
PassBoundBOToExec = -1
|
||||
EnableNullHardware = 0
|
||||
ForceLinearImages = 0
|
||||
ForceSLML3Config = 0
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/execution_environment_helper.h"
|
||||
#include "shared/test/common/helpers/gtest_helpers.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
#include "shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_allocation_properties.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
@@ -609,11 +610,14 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingProcessResidencyWhe
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1));
|
||||
|
||||
static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->callBaseProcessResidency = false;
|
||||
static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->processResidencyResult = false;
|
||||
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
|
||||
testedCsr->processResidencyCallBase = false;
|
||||
testedCsr->processResidencyResult = false;
|
||||
|
||||
SubmissionStatus ret = csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
EXPECT_EQ(SubmissionStatus::OUT_OF_MEMORY, ret);
|
||||
EXPECT_EQ(testedCsr->flushInternalCalled, 1u);
|
||||
EXPECT_EQ(testedCsr->processResidencyCalled, 1u);
|
||||
mm->freeGraphicsMemory(allocation);
|
||||
mm->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
@@ -628,11 +632,17 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingExecWhenFlushingThe
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1));
|
||||
|
||||
static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->callBaseExec = false;
|
||||
static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->execResult = -1;
|
||||
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
|
||||
testedCsr->processResidencyCallBase = true;
|
||||
testedCsr->processResidencyResult = true;
|
||||
testedCsr->execCallBase = false;
|
||||
testedCsr->execResult = -1;
|
||||
|
||||
SubmissionStatus ret = csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
EXPECT_EQ(SubmissionStatus::FAILED, ret);
|
||||
EXPECT_EQ(testedCsr->flushInternalCalled, 1u);
|
||||
EXPECT_EQ(testedCsr->processResidencyCalled, 1u);
|
||||
EXPECT_EQ(testedCsr->execCalled, 1u);
|
||||
mm->freeGraphicsMemory(allocation);
|
||||
mm->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
@@ -835,7 +845,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
|
||||
static_cast<MockDrmDirectSubmission<FamilyType> *>(directSubmission)->currentTagData.tagValue = 0u;
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmissionWhenFlushThenCommandBufferAllocationIsResident) {
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmissionWhenFlushThenCommandBufferAllocationIsNotAddedToHandlerResidencySet) {
|
||||
mock->bindAvailable = true;
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
@@ -847,7 +857,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenEnabledDirectSubmi
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
auto memoryOperationsInterface = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface.get();
|
||||
EXPECT_EQ(memoryOperationsInterface->isResident(device.get(), *batchBuffer.commandBufferAllocation), MemoryOperationsStatus::SUCCESS);
|
||||
EXPECT_NE(memoryOperationsInterface->isResident(device.get(), *batchBuffer.commandBufferAllocation), MemoryOperationsStatus::SUCCESS);
|
||||
|
||||
auto directSubmission = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->directSubmission.get();
|
||||
ASSERT_NE(nullptr, directSubmission);
|
||||
@@ -874,27 +884,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBlitterDirectSubmissionTest, givenEnabledDire
|
||||
EXPECT_EQ(nullptr, static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->directSubmission.get());
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamBlitterDirectSubmissionTest, givenEnabledDirectSubmissionOnBlitterWhenFlushThenCommandBufferAllocationIsResident) {
|
||||
mock->bindAvailable = true;
|
||||
auto &cs = csr->getCS();
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 4, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
uint8_t bbStart[64];
|
||||
batchBuffer.endCmdPtr = &bbStart[0];
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
auto memoryOperationsInterface = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface.get();
|
||||
EXPECT_EQ(memoryOperationsInterface->isResident(device.get(), *batchBuffer.commandBufferAllocation), MemoryOperationsStatus::SUCCESS);
|
||||
|
||||
auto directSubmission = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->blitterDirectSubmission.get();
|
||||
ASSERT_NE(nullptr, directSubmission);
|
||||
static_cast<MockDrmBlitterDirectSubmission<FamilyType> *>(directSubmission)->currentTagData.tagValue = 0u;
|
||||
|
||||
EXPECT_EQ(nullptr, static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->directSubmission.get());
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockDrmCsr : public DrmCommandStreamReceiver<GfxFamily> {
|
||||
using DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver;
|
||||
|
||||
@@ -2110,22 +2110,30 @@ struct DrmCommandStreamEnhancedPrelimTest : public DrmCommandStreamEnhancedTempl
|
||||
dbgState.reset();
|
||||
}
|
||||
|
||||
template <typename FamilyType>
|
||||
void setUpT() {
|
||||
DrmCommandStreamEnhancedTemplate<DrmMockCustomPrelim>::setUpT<FamilyType>();
|
||||
|
||||
this->commandBuffer = this->mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{this->csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
this->batchBuffer = BatchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
this->allocation = this->mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
this->csr->makeResident(*this->allocation);
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
GraphicsAllocation *commandBuffer;
|
||||
GraphicsAllocation *allocation;
|
||||
BatchBuffer batchBuffer;
|
||||
};
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedPrelimTest, givenUseVmBindSetWhenFlushThenAllocIsBoundAndNotPassedToExec) {
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
csr->makeResident(*allocation);
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
const auto execObjectRequirements = [&allocation](const auto &execObject) {
|
||||
const auto execObjectRequirements = [allocation = this->allocation](const auto &execObject) {
|
||||
auto mockExecObject = static_cast<const MockExecObject &>(execObject);
|
||||
return (mockExecObject.getHandle() == 0 &&
|
||||
mockExecObject.getOffset() == static_cast<DrmAllocation *>(allocation)->getBO()->peekAddress());
|
||||
@@ -2140,63 +2148,3 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedPrelimTest, givenUseVmBindSetWhenFlus
|
||||
mm->freeGraphicsMemory(allocation);
|
||||
mm->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedPrelimTest, givenUseVmBindAndPassBoundBOToExecSetToFalseWhenFlushThenAllocIsBoundOnly) {
|
||||
DebugManager.flags.PassBoundBOToExec.set(0u);
|
||||
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
csr->makeResident(*allocation);
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
const auto execObjectRequirements = [&allocation](const auto &execObject) {
|
||||
auto mockExecObject = static_cast<const MockExecObject &>(execObject);
|
||||
return (mockExecObject.getHandle() == 0 &&
|
||||
mockExecObject.getOffset() == static_cast<DrmAllocation *>(allocation)->getBO()->peekAddress());
|
||||
};
|
||||
|
||||
auto &residency = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->execObjectsStorage;
|
||||
EXPECT_FALSE(std::find_if(residency.begin(), residency.end(), execObjectRequirements) != residency.end());
|
||||
EXPECT_EQ(residency.size(), 1u);
|
||||
|
||||
residency.clear();
|
||||
|
||||
mm->freeGraphicsMemory(allocation);
|
||||
mm->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedPrelimTest, givenUseVmBindAndPassBoundBOToExecSetToTrueWhenFlushThenAllocIsBoundAndPassedToExec) {
|
||||
DebugManager.flags.PassBoundBOToExec.set(1u);
|
||||
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(cs);
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
csr->makeResident(*allocation);
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
const auto execObjectRequirements = [&allocation](const auto &execObject) {
|
||||
auto mockExecObject = static_cast<const MockExecObject &>(execObject);
|
||||
return (mockExecObject.getHandle() == 0 &&
|
||||
mockExecObject.getOffset() == static_cast<DrmAllocation *>(allocation)->getBO()->peekAddress());
|
||||
};
|
||||
|
||||
auto &residency = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->execObjectsStorage;
|
||||
EXPECT_TRUE(std::find_if(residency.begin(), residency.end(), execObjectRequirements) != residency.end());
|
||||
EXPECT_EQ(residency.size(), 2u);
|
||||
|
||||
residency.clear();
|
||||
|
||||
mm->freeGraphicsMemory(allocation);
|
||||
mm->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user