Fix update residency task count for all submited allocations

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2021-06-02 18:09:15 +00:00
committed by Compute-Runtime-Automation
parent 770a6676a4
commit 925d8ad1eb
4 changed files with 48 additions and 0 deletions

View File

@@ -62,6 +62,9 @@ void CommandQueueImp::submitBatchBuffer(size_t offset, NEO::ResidencyContainer &
NEO::QueueThrottle::HIGH, NEO::QueueSliceCount::defaultSliceCount,
commandStream->getUsed(), commandStream, endingCmdPtr, false);
for (auto &surface : residencyContainer) {
csr->makeResident(*surface);
}
csr->submitBatchBuffer(batchBuffer, residencyContainer);
buffers.setCurrentFlushStamp(csr->obtainCurrentFlushStamp());
}

View File

@@ -25,6 +25,7 @@ struct WhiteBox<::L0::CommandQueue> : public ::L0::CommandQueueImp {
using BaseClass::device;
using BaseClass::preemptionCmdSyncProgramming;
using BaseClass::printfFunctionContainer;
using BaseClass::submitBatchBuffer;
using BaseClass::synchronizeByPollingForTaskCount;
using CommandQueue::commandQueuePreemptionMode;
using CommandQueue::internalUsage;

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/command_stream/scratch_space_controller_base.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/state_base_address.h"
@@ -217,6 +218,45 @@ HWTEST_F(CommandQueueCreate, given100CmdListsWhenExecutingThenCommandStreamIsNot
commandQueue->destroy();
}
HWTEST_F(CommandQueueCreate, givenContainerWithAllocationsWhenSubmitBatchBufferCalledThenMakeResidentWasCalled) {
auto csr = std::make_unique<MockCommandStreamReceiver>(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
csr->setupContext(*neoDevice->getDefaultEngine().osContext);
const ze_command_queue_desc_t desc = {};
ze_result_t returnValue;
auto commandQueue = whitebox_cast(CommandQueue::create(productFamily,
device,
csr.get(),
&desc,
false,
false,
returnValue));
ResidencyContainer container;
MockGraphicsAllocation mockGA1, mockGA2;
container.push_back(&mockGA1);
container.push_back(&mockGA2);
commandQueue->submitBatchBuffer(0, container, nullptr);
EXPECT_EQ(csr->makeResidentCalledTimes, container.size());
commandQueue->destroy();
}
HWTEST_F(CommandQueueCreate, givenContainerWithAllocationsWhenResidencyContainerIsEmptyThenMakeResidentWasNotCalled) {
auto csr = std::make_unique<MockCommandStreamReceiver>(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield());
csr->setupContext(*neoDevice->getDefaultEngine().osContext);
const ze_command_queue_desc_t desc = {};
ze_result_t returnValue;
auto commandQueue = whitebox_cast(CommandQueue::create(productFamily,
device,
csr.get(),
&desc,
false,
false,
returnValue));
ResidencyContainer container;
commandQueue->submitBatchBuffer(0, container, nullptr);
EXPECT_EQ(csr->makeResidentCalledTimes, 0u);
commandQueue->destroy();
}
TEST_F(CommandQueueCreate, whenCommandQueueCreatedThenExpectLinearStreamInitializedWithExpectedSize) {
const ze_command_queue_desc_t desc = {};
ze_result_t returnValue;