mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +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
@ -449,7 +449,7 @@ HWTEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreat
|
||||
device->setPreemptionMode(PreemptionMode::Disabled);
|
||||
|
||||
auto csr = static_cast<TestedDrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> *>(device->getDefaultEngine().commandStreamReceiver);
|
||||
csr->callHwFlush = false;
|
||||
csr->flushInternalCallBase = false;
|
||||
|
||||
mock->ioctl_expected.gemCreate = 1;
|
||||
mock->ioctl_expected.gemSetTiling = 1;
|
||||
|
@ -1400,70 +1400,6 @@ struct MockMergeResidencyContainerMemoryOperationsHandler : public DrmMemoryOper
|
||||
(OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable));
|
||||
};
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMakeResidentWithinOsContextFailsThenFlushReturnsError) {
|
||||
struct MockDrmCsr : public DrmCommandStreamReceiver<FamilyType> {
|
||||
using DrmCommandStreamReceiver<FamilyType>::DrmCommandStreamReceiver;
|
||||
SubmissionStatus flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency) override {
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
mock->bindAvailable = true;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface.reset(new MockMergeResidencyContainerMemoryOperationsHandler());
|
||||
auto operationHandler = static_cast<MockMergeResidencyContainerMemoryOperationsHandler *>(executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface.get());
|
||||
operationHandler->makeResidentWithinOsContextResult = NEO::MemoryOperationsStatus::FAILED;
|
||||
|
||||
auto osContext = std::make_unique<OsContextLinux>(*mock, 0u,
|
||||
EngineDescriptorHelper::getDefaultDescriptor(HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0],
|
||||
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
|
||||
|
||||
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};
|
||||
|
||||
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
mockCsr.setupContext(*osContext.get());
|
||||
auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
|
||||
EXPECT_GT(operationHandler->makeResidentWithinOsContextCalled, 0u);
|
||||
EXPECT_EQ(NEO::SubmissionStatus::FAILED, res);
|
||||
|
||||
mm->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMakeResidentWithinOsContextOutOfMemoryThenFlushReturnsError) {
|
||||
struct MockDrmCsr : public DrmCommandStreamReceiver<FamilyType> {
|
||||
using DrmCommandStreamReceiver<FamilyType>::DrmCommandStreamReceiver;
|
||||
SubmissionStatus flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency) override {
|
||||
return SubmissionStatus::SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
mock->bindAvailable = true;
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface.reset(new MockMergeResidencyContainerMemoryOperationsHandler());
|
||||
auto operationHandler = static_cast<MockMergeResidencyContainerMemoryOperationsHandler *>(executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface.get());
|
||||
operationHandler->makeResidentWithinOsContextResult = NEO::MemoryOperationsStatus::OUT_OF_MEMORY;
|
||||
|
||||
auto osContext = std::make_unique<OsContextLinux>(*mock, 0u,
|
||||
EngineDescriptorHelper::getDefaultDescriptor(HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*defaultHwInfo)[0],
|
||||
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
|
||||
|
||||
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};
|
||||
|
||||
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, gemCloseWorkerMode::gemCloseWorkerInactive);
|
||||
mockCsr.setupContext(*osContext.get());
|
||||
auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
|
||||
EXPECT_GT(operationHandler->makeResidentWithinOsContextCalled, 0u);
|
||||
EXPECT_EQ(NEO::SubmissionStatus::OUT_OF_MEMORY, res);
|
||||
|
||||
mm->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContainerFailsThenFlushReturnsError) {
|
||||
struct MockDrmCsr : public DrmCommandStreamReceiver<FamilyType> {
|
||||
using DrmCommandStreamReceiver<FamilyType>::DrmCommandStreamReceiver;
|
||||
|
@ -116,7 +116,7 @@ HWTEST_F(clCreateCommandQueueWithPropertiesLinux, givenPropertiesWithClQueueSlic
|
||||
cl_queue_properties properties[] = {CL_QUEUE_SLICE_COUNT_INTEL, newSliceCount, 0};
|
||||
|
||||
auto mockCsr = new TestedDrmCommandStreamReceiver<FamilyType>(*mdevice->executionEnvironment, rootDeviceIndex, 1);
|
||||
mockCsr->callHwFlush = false;
|
||||
mockCsr->flushInternalCallBase = false;
|
||||
mdevice->resetCommandStreamReceiver(mockCsr);
|
||||
|
||||
cl_command_queue cmdQ = clCreateCommandQueueWithProperties(context.get(), clDevice, properties, &retVal);
|
||||
@ -162,7 +162,7 @@ HWTEST_F(clCreateCommandQueueWithPropertiesLinux, givenSameSliceCountAsRecentlyS
|
||||
cl_queue_properties properties[] = {CL_QUEUE_SLICE_COUNT_INTEL, newSliceCount, 0};
|
||||
|
||||
auto mockCsr = new TestedDrmCommandStreamReceiver<FamilyType>(*mdevice->executionEnvironment, rootDeviceIndex, 1);
|
||||
mockCsr->callHwFlush = false;
|
||||
mockCsr->flushInternalCallBase = false;
|
||||
mdevice->resetCommandStreamReceiver(mockCsr);
|
||||
|
||||
cl_command_queue cmdQ = clCreateCommandQueueWithProperties(context.get(), clDevice, properties, &retVal);
|
||||
@ -207,7 +207,7 @@ HWTEST_F(clCreateCommandQueueWithPropertiesLinux, givenPropertiesWithClQueueSlic
|
||||
cl_queue_properties properties[] = {CL_QUEUE_SLICE_COUNT_INTEL, newSliceCount, 0};
|
||||
|
||||
auto mockCsr = new TestedDrmCommandStreamReceiver<FamilyType>(*mdevice->executionEnvironment, rootDeviceIndex, 1);
|
||||
mockCsr->callHwFlush = false;
|
||||
mockCsr->flushInternalCallBase = false;
|
||||
mdevice->resetCommandStreamReceiver(mockCsr);
|
||||
|
||||
cl_command_queue cmdQ = clCreateCommandQueueWithProperties(context.get(), clDevice, properties, &retVal);
|
||||
|
Reference in New Issue
Block a user