Add ULT helper functions for PIPE_CONTROL command
Resolves: NEO-4227 Change-Id: I8cca5edc1dd39c22e1f97fc8163f299fd379ad49 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
parent
c7ed76a169
commit
8a6cb1e5ca
|
@ -153,6 +153,8 @@ struct EncodeSempahore {
|
|||
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
|
||||
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
|
||||
|
||||
static constexpr uint32_t invalidHardwareTag = -2;
|
||||
|
||||
static void programMiSemaphoreWait(MI_SEMAPHORE_WAIT *cmd,
|
||||
uint64_t compareAddress,
|
||||
uint32_t compareData,
|
||||
|
|
|
@ -19,6 +19,7 @@ set(NEO_CORE_HELPERS_TESTS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/string_to_hash_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_config.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_helper.h
|
||||
)
|
||||
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_HELPERS_TESTS ${NEO_CORE_HELPERS_TESTS})
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/helpers/hw_helper.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct UltPipeControlHelper : PipeControlHelper<GfxFamily> {
|
||||
|
||||
static size_t getExpectedPipeControlCount(const HardwareInfo &hwInfo) {
|
||||
return (PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo) -
|
||||
PipeControlHelper<GfxFamily>::getSizeForAdditonalSynchronization()) /
|
||||
sizeof(typename GfxFamily::PIPE_CONTROL);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
|
@ -19,6 +19,7 @@
|
|||
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/helpers/hw_parse.h"
|
||||
#include "unit_tests/helpers/unit_test_helper.h"
|
||||
#include "unit_tests/mocks/mock_buffer.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
|
@ -1414,6 +1415,9 @@ HWTEST_P(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsTakenThenT
|
|||
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired(pDevice->getHardwareInfo())) {
|
||||
itorPipeCtrl++;
|
||||
}
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(pDevice->getHardwareInfo())) {
|
||||
itorPipeCtrl++;
|
||||
}
|
||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*itorPipeCtrl);
|
||||
ASSERT_NE(nullptr, pipeControl);
|
||||
|
||||
|
@ -1426,6 +1430,9 @@ HWTEST_P(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsTakenThenT
|
|||
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired(pDevice->getHardwareInfo())) {
|
||||
itorPipeCtrl++;
|
||||
}
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(pDevice->getHardwareInfo())) {
|
||||
itorPipeCtrl++;
|
||||
}
|
||||
ASSERT_NE(cmdList.end(), itorPipeCtrl);
|
||||
pipeControl = genCmdCast<PIPE_CONTROL *>(*itorPipeCtrl);
|
||||
ASSERT_NE(nullptr, pipeControl);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "core/gmm_helper/gmm_helper.h"
|
||||
#include "core/os_interface/os_context.h"
|
||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "core/unit_tests/helpers/ult_hw_helper.h"
|
||||
#include "runtime/command_queue/gpgpu_walker.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/fixtures/ult_command_stream_receiver_fixture.h"
|
||||
|
@ -924,7 +925,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWit
|
|||
|
||||
auto &commandStreamReceiver = commandQueue.getGpgpuCommandStreamReceiver();
|
||||
|
||||
size_t pipeControlCount = PipeControlHelper<FamilyType>::getSizeForPipeControlWithPostSyncOperation(pDevice->getHardwareInfo()) / sizeof(PIPE_CONTROL);
|
||||
size_t pipeControlCount = UltPipeControlHelper<FamilyType>::getExpectedPipeControlCount(pDevice->getHardwareInfo());
|
||||
|
||||
auto &commandStreamTask = commandQueue.getCS(1024);
|
||||
|
||||
|
@ -955,8 +956,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWit
|
|||
|
||||
if (pipeControlCount > 1) {
|
||||
// Search taskCS for PC to analyze
|
||||
auto pipeControlTask = genCmdCast<typename FamilyType::PIPE_CONTROL *>(
|
||||
ptrOffset(commandStreamTask.getCpuBase(), 24));
|
||||
itorPC = find<PIPE_CONTROL *>(++itorPC, cmdList.end());
|
||||
auto pipeControlTask = genCmdCast<typename FamilyType::PIPE_CONTROL *>(*itorPC);
|
||||
ASSERT_NE(nullptr, pipeControlTask);
|
||||
|
||||
// Verify that the dcFlushEnabled bit is not set in PC
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "core/memory_manager/graphics_allocation.h"
|
||||
#include "core/os_interface/linux/debug_env_reader.h"
|
||||
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "core/unit_tests/helpers/ult_hw_helper.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/command_queue/command_queue_hw.h"
|
||||
#include "runtime/command_queue/gpgpu_walker.h"
|
||||
|
@ -76,7 +77,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenCsrInBatchingModeThreeRe
|
|||
dispatchFlags.outOfOrderExecutionAllowed = true;
|
||||
|
||||
EXPECT_CALL(*mockHelper, setPatchInfoData(::testing::_)).Times(10);
|
||||
size_t removePatchInfoDataCount = 4 * PipeControlHelper<FamilyType>::getSizeForPipeControlWithPostSyncOperation(pDevice->getHardwareInfo()) / sizeof(PIPE_CONTROL);
|
||||
size_t removePatchInfoDataCount = 4 * UltPipeControlHelper<FamilyType>::getExpectedPipeControlCount(pDevice->getHardwareInfo());
|
||||
EXPECT_CALL(*mockHelper, removePatchInfoData(::testing::_)).Times(static_cast<int>(removePatchInfoDataCount));
|
||||
EXPECT_CALL(*mockHelper, registerCommandChunk(::testing::_)).Times(4);
|
||||
EXPECT_CALL(*mockHelper, registerBatchBufferStartAddress(::testing::_, ::testing::_)).Times(3);
|
||||
|
|
|
@ -101,6 +101,10 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
|
|||
it++;
|
||||
}
|
||||
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(pDevice->getHardwareInfo())) {
|
||||
it++;
|
||||
}
|
||||
|
||||
//2nd PIPE_CONTROL with ts addr
|
||||
uint64_t timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress();
|
||||
uint32_t expectedTsAddress = static_cast<uint32_t>(timeStampAddress & 0x0000FFFFFFFFULL);
|
||||
|
@ -131,6 +135,10 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
|
|||
EXPECT_EQ(1u, pipeControl->getCommandStreamerStallEnable());
|
||||
}
|
||||
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(pDevice->getHardwareInfo())) {
|
||||
it++;
|
||||
}
|
||||
|
||||
//4th PIPE_CONTROL with ts addr
|
||||
timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress() + sizeof(uint64_t);
|
||||
expectedTsAddress = static_cast<uint32_t>(timeStampAddress & 0x0000FFFFFFFFULL);
|
||||
|
@ -223,6 +231,9 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
|
|||
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired(pDevice->getHardwareInfo())) {
|
||||
it++;
|
||||
}
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(pDevice->getHardwareInfo())) {
|
||||
it++;
|
||||
}
|
||||
//2nd PIPE_CONTROL
|
||||
uint64_t timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress() + 2 * sizeof(uint64_t);
|
||||
uint32_t expectedTsAddress = static_cast<uint32_t>(timeStampAddress & 0x0000FFFFFFFFULL);
|
||||
|
@ -238,6 +249,9 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
|
|||
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired(pDevice->getHardwareInfo())) {
|
||||
it++;
|
||||
}
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(pDevice->getHardwareInfo())) {
|
||||
it++;
|
||||
}
|
||||
it++;
|
||||
//get 4th PIPE_CONTROL
|
||||
timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress() + 3 * sizeof(uint64_t);
|
||||
|
|
|
@ -640,7 +640,9 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe
|
|||
EXPECT_NE(nullptr, pipeControl);
|
||||
}
|
||||
walkerFound = true;
|
||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*++it);
|
||||
it = find<PIPE_CONTROL *>(++it, hwParser.cmdList.end());
|
||||
ASSERT_NE(hwParser.cmdList.end(), it);
|
||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
|
||||
ASSERT_NE(nullptr, pipeControl);
|
||||
EXPECT_EQ(PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, pipeControl->getPostSyncOperation());
|
||||
}
|
||||
|
@ -1235,7 +1237,8 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingThenDontKee
|
|||
atomicsFound++;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(0u, semaphoresFound);
|
||||
uint32_t expectedSemaphoresCount = (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(device->getHardwareInfo()) ? 1 : 0);
|
||||
EXPECT_EQ(expectedSemaphoresCount, semaphoresFound);
|
||||
EXPECT_EQ(0u, atomicsFound);
|
||||
}
|
||||
|
||||
|
@ -1268,7 +1271,10 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingThenKeepDep
|
|||
verifyMiAtomic<FamilyType>(genCmdCast<MI_ATOMIC *>(*++it), firstTag1);
|
||||
|
||||
while (it != hwParser.cmdList.end()) {
|
||||
EXPECT_EQ(nullptr, genCmdCast<MI_SEMAPHORE_WAIT *>(*it));
|
||||
auto semaphoreWait = genCmdCast<MI_SEMAPHORE_WAIT *>(*it);
|
||||
if (semaphoreWait) {
|
||||
EXPECT_TRUE(UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWait(*semaphoreWait));
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
@ -1297,7 +1303,8 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingToOoqThenDo
|
|||
atomicsFound++;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(0u, semaphoresFound);
|
||||
uint32_t expectedSemaphoresCount = (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(device->getHardwareInfo()) ? 1 : 0);
|
||||
EXPECT_EQ(expectedSemaphoresCount, semaphoresFound);
|
||||
EXPECT_EQ(0u, atomicsFound);
|
||||
}
|
||||
|
||||
|
@ -1327,7 +1334,8 @@ HWTEST_F(TimestampPacketTests, givenAlreadyAssignedNodeWhenEnqueueingWithOmitTim
|
|||
atomicsFound++;
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(0u, semaphoresFound);
|
||||
uint32_t expectedSemaphoresCount = (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(device->getHardwareInfo()) ? 1 : 0);
|
||||
EXPECT_EQ(expectedSemaphoresCount, semaphoresFound);
|
||||
EXPECT_EQ(0u, atomicsFound);
|
||||
}
|
||||
|
||||
|
@ -1565,7 +1573,11 @@ HWTEST_F(TimestampPacketTests, givenBlockedEnqueueWithoutKernelWhenSubmittingThe
|
|||
hwParserCmdQ.parseCommands<FamilyType>(taskStream, 0);
|
||||
|
||||
auto queueSemaphores = findAll<MI_SEMAPHORE_WAIT *>(hwParserCmdQ.cmdList.begin(), hwParserCmdQ.cmdList.end());
|
||||
EXPECT_EQ(1u, queueSemaphores.size());
|
||||
auto expectedQueueSemaphoresCount = 1u;
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(device->getHardwareInfo())) {
|
||||
expectedQueueSemaphoresCount++;
|
||||
}
|
||||
EXPECT_EQ(expectedQueueSemaphoresCount, queueSemaphores.size());
|
||||
verifySemaphore(genCmdCast<MI_SEMAPHORE_WAIT *>(*(queueSemaphores[0])), node0.getNode(0), 0);
|
||||
|
||||
auto csrSemaphores = findAll<MI_SEMAPHORE_WAIT *>(hwParserCsr.cmdList.begin(), hwParserCsr.cmdList.end());
|
||||
|
@ -1615,7 +1627,11 @@ HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingMarkerWi
|
|||
verifySemaphore(genCmdCast<MI_SEMAPHORE_WAIT *>(*(csrSemaphores[0])), node2.getNode(0), 0);
|
||||
|
||||
auto queueSemaphores = findAll<MI_SEMAPHORE_WAIT *>(hwParserCmdQ.cmdList.begin(), hwParserCmdQ.cmdList.end());
|
||||
EXPECT_EQ(1u, queueSemaphores.size());
|
||||
auto expectedQueueSemaphoresCount = 1u;
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(device->getHardwareInfo())) {
|
||||
expectedQueueSemaphoresCount++;
|
||||
}
|
||||
EXPECT_EQ(expectedQueueSemaphoresCount, queueSemaphores.size());
|
||||
verifySemaphore(genCmdCast<MI_SEMAPHORE_WAIT *>(*(queueSemaphores[0])), node1.getNode(0), 0);
|
||||
}
|
||||
|
||||
|
@ -1654,7 +1670,11 @@ HWTEST_F(TimestampPacketTests, givenWaitlistAndOutputEventWhenEnqueueingBarrierW
|
|||
verifySemaphore(genCmdCast<MI_SEMAPHORE_WAIT *>(*(csrSemaphores[0])), node2.getNode(0), 0);
|
||||
|
||||
auto queueSemaphores = findAll<MI_SEMAPHORE_WAIT *>(hwParserCmdQ.cmdList.begin(), hwParserCmdQ.cmdList.end());
|
||||
EXPECT_EQ(1u, queueSemaphores.size());
|
||||
auto expectedQueueSemaphoresCount = 1u;
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWaitRequired(device->getHardwareInfo())) {
|
||||
expectedQueueSemaphoresCount++;
|
||||
}
|
||||
EXPECT_EQ(expectedQueueSemaphoresCount, queueSemaphores.size());
|
||||
verifySemaphore(genCmdCast<MI_SEMAPHORE_WAIT *>(*(queueSemaphores[0])), node1.getNode(0), 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,10 @@ struct UnitTestHelper {
|
|||
|
||||
static bool isPipeControlWArequired(const HardwareInfo &hwInfo);
|
||||
|
||||
static bool isAdditionalMiSemaphoreWaitRequired(const HardwareInfo &hwInfo);
|
||||
|
||||
static bool isAdditionalMiSemaphoreWait(const typename GfxFamily::MI_SEMAPHORE_WAIT &semaphoreWait);
|
||||
|
||||
static uint64_t getMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic);
|
||||
|
||||
static const bool tiledImagesSupported;
|
||||
|
@ -45,4 +49,5 @@ struct UnitTestHelper {
|
|||
|
||||
static const bool useFullRowForLocalIdsGeneration;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -55,6 +55,16 @@ bool UnitTestHelper<GfxFamily>::isPipeControlWArequired(const HardwareInfo &hwIn
|
|||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isAdditionalMiSemaphoreWaitRequired(const HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isAdditionalMiSemaphoreWait(const typename GfxFamily::MI_SEMAPHORE_WAIT &semaphoreWait) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline uint64_t UnitTestHelper<GfxFamily>::getMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic) {
|
||||
return atomic.getMemoryAddress() | ((static_cast<uint64_t>(atomic.getMemoryAddressHigh())) << 32);
|
||||
|
|
|
@ -919,6 +919,9 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenWriteBufferEnqueueWhenProgrammingCommand
|
|||
uint32_t miAtomicsCount = 0;
|
||||
for (auto &cmd : hwParser.cmdList) {
|
||||
if (auto semaphoreCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(cmd)) {
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWait(*semaphoreCmd)) {
|
||||
continue;
|
||||
}
|
||||
semaphoresCount++;
|
||||
auto dataAddress = timestampPacketNode->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
|
||||
EXPECT_EQ(dataAddress, semaphoreCmd->getSemaphoreGraphicsAddress());
|
||||
|
@ -961,6 +964,9 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenReadBufferEnqueueWhenProgrammingCommandS
|
|||
uint32_t miAtomicsCount = 0;
|
||||
for (auto &cmd : hwParser.cmdList) {
|
||||
if (auto semaphoreCmd = genCmdCast<MI_SEMAPHORE_WAIT *>(cmd)) {
|
||||
if (UnitTestHelper<FamilyType>::isAdditionalMiSemaphoreWait(*semaphoreCmd)) {
|
||||
continue;
|
||||
}
|
||||
semaphoresCount++;
|
||||
auto dataAddress = timestampPacketNode->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
|
||||
EXPECT_EQ(dataAddress, semaphoreCmd->getSemaphoreGraphicsAddress());
|
||||
|
|
Loading…
Reference in New Issue