Add writeStreamInline at the end of flushTask
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
c0121eb824
commit
ba156c7eaa
|
@ -8,9 +8,11 @@
|
|||
#include "shared/source/helpers/timestamp_packet.h"
|
||||
#include "shared/source/memory_manager/surface.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_csr.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_logical_state_helper.h"
|
||||
#include "shared/test/common/mocks/mock_timestamp_container.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
@ -60,6 +62,66 @@ HWTEST_F(EnqueueHandlerTest, GivenCommandStreamWithoutKernelWhenCommandEnqueuedT
|
|||
EXPECT_EQ(allocation->getTaskCount(mockCmdQ->getGpgpuCommandStreamReceiver().getOsContext().getContextId()), 1u);
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueHandlerTest, givenLogicalStateHelperWhenDispatchingCommandsThenAddLastCommand) {
|
||||
using MI_NOOP = typename FamilyType::MI_NOOP;
|
||||
|
||||
auto mockCmdQ = std::make_unique<MockCommandQueueHw<FamilyType>>(context, pClDevice, nullptr);
|
||||
auto logicalStateHelper = new LogicalStateHelperMock<FamilyType>();
|
||||
|
||||
auto &ultCsr = static_cast<UltCommandStreamReceiver<FamilyType> &>(mockCmdQ->getGpgpuCommandStreamReceiver());
|
||||
ultCsr.logicalStateHelper.reset(logicalStateHelper);
|
||||
|
||||
auto surface = std::make_unique<NullSurface>();
|
||||
EventsRequest eventsRequest(0, nullptr, nullptr);
|
||||
EventBuilder eventBuilder;
|
||||
Surface *surfaces[] = {surface.get()};
|
||||
bool blocking = true;
|
||||
|
||||
TimestampPacketDependencies timestampPacketDependencies;
|
||||
|
||||
CsrDependencies csrDeps;
|
||||
EnqueueProperties enqueueProperties(false, false, false, true, false, nullptr);
|
||||
|
||||
EXPECT_EQ(0u, logicalStateHelper->writeStreamInlineCalledCounter);
|
||||
|
||||
mockCmdQ->enqueueCommandWithoutKernel(surfaces, 1, &mockCmdQ->getCS(0), 0, blocking, enqueueProperties, timestampPacketDependencies,
|
||||
eventsRequest, eventBuilder, 0, csrDeps, nullptr);
|
||||
|
||||
EXPECT_EQ(1u, logicalStateHelper->writeStreamInlineCalledCounter);
|
||||
|
||||
HardwareParse cmdParser;
|
||||
cmdParser.parseCommands<FamilyType>(ultCsr.commandStream);
|
||||
|
||||
auto miNoop = find<MI_NOOP *>(cmdParser.cmdList.begin(), cmdParser.cmdList.end());
|
||||
bool miNoopFound = false;
|
||||
uint32_t cmdsAfterNoop = 0;
|
||||
|
||||
while (miNoop != cmdParser.cmdList.end()) {
|
||||
auto miNoopCmd = genCmdCast<MI_NOOP *>(*miNoop);
|
||||
if (miNoopCmd->getIdentificationNumber() == 0x123) {
|
||||
miNoopFound = true;
|
||||
break;
|
||||
}
|
||||
|
||||
miNoop = find<MI_NOOP *>(++miNoop, cmdParser.cmdList.end());
|
||||
}
|
||||
|
||||
miNoop++;
|
||||
|
||||
while (miNoop != cmdParser.cmdList.end()) {
|
||||
auto miNoopCmd = genCmdCast<MI_NOOP *>(*miNoop);
|
||||
|
||||
if (miNoopCmd == nullptr) {
|
||||
cmdsAfterNoop++;
|
||||
}
|
||||
|
||||
miNoop++;
|
||||
}
|
||||
|
||||
EXPECT_TRUE(miNoopFound);
|
||||
EXPECT_EQ(1u, cmdsAfterNoop);
|
||||
}
|
||||
|
||||
template <bool enabled>
|
||||
struct EnqueueHandlerTimestampTest : public EnqueueHandlerTest {
|
||||
void SetUp() override {
|
||||
|
|
|
@ -533,6 +533,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
|||
makeResident(*workPartitionAllocation);
|
||||
}
|
||||
|
||||
if (logicalStateHelper) {
|
||||
logicalStateHelper->writeStreamInline(commandStreamCSR);
|
||||
}
|
||||
|
||||
// If the CSR has work in its CS, flush it before the task
|
||||
bool submitTask = commandStreamStartTask != commandStreamTask.getUsed();
|
||||
bool submitCSR = (commandStreamStartCSR != commandStreamCSR.getUsed()) || this->isMultiOsContextCapable();
|
||||
|
|
|
@ -66,6 +66,7 @@ set(NEO_CORE_tests_mocks
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/mock_io_functions.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel_info.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_kernel_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_logical_state_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_lrca_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_manager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_memory_operations_handler.h
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/helpers/logical_state_helper.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
class LogicalStateHelperMock : public LogicalStateHelper {
|
||||
public:
|
||||
LogicalStateHelperMock() = default;
|
||||
|
||||
void writeStreamInline(LinearStream &linearStream) override {
|
||||
writeStreamInlineCalledCounter++;
|
||||
|
||||
auto cmd = linearStream.getSpaceForCmd<typename GfxFamily::MI_NOOP>();
|
||||
*cmd = GfxFamily::cmdInitNoop;
|
||||
cmd->setIdentificationNumber(0x123);
|
||||
}
|
||||
|
||||
uint32_t writeStreamInlineCalledCounter = 0;
|
||||
};
|
||||
} // namespace NEO
|
Loading…
Reference in New Issue