2020-02-21 15:35:08 +01:00
|
|
|
/*
|
2025-01-17 15:03:50 +00:00
|
|
|
* Copyright (C) 2020-2025 Intel Corporation
|
2020-02-21 15:35:08 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_container/command_encoder.h"
|
2023-01-20 17:45:04 +00:00
|
|
|
#include "shared/source/command_container/encode_surface_state.h"
|
2023-12-22 15:59:55 +00:00
|
|
|
#include "shared/source/command_container/implicit_scaling.h"
|
2022-01-12 16:57:42 +00:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2022-07-24 04:21:16 +00:00
|
|
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
2022-03-25 11:24:00 +00:00
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
2024-08-12 21:06:11 +00:00
|
|
|
#include "shared/source/helpers/compiler_product_helper.h"
|
2023-03-06 12:42:09 +00:00
|
|
|
#include "shared/source/helpers/definitions/command_encoder_args.h"
|
2023-02-01 16:23:01 +00:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2023-12-11 12:10:56 +00:00
|
|
|
#include "shared/source/helpers/in_order_cmd_helpers.h"
|
2023-12-22 15:59:55 +00:00
|
|
|
#include "shared/source/helpers/pipe_control_args.h"
|
2025-03-18 00:28:35 +00:00
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
2024-05-15 10:25:49 +00:00
|
|
|
#include "shared/source/kernel/kernel_descriptor.h"
|
2022-01-26 10:59:30 +00:00
|
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
2022-06-01 17:12:34 +00:00
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
2023-08-30 14:23:02 +00:00
|
|
|
#include "shared/source/os_interface/product_helper.h"
|
2022-03-09 15:17:47 +00:00
|
|
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/helpers/default_hw_info.h"
|
2021-04-13 14:00:07 +02:00
|
|
|
#include "shared/test/common/helpers/unit_test_helper.h"
|
2024-09-20 14:53:27 +00:00
|
|
|
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
2024-01-12 16:27:50 +00:00
|
|
|
#include "shared/test/common/mocks/mock_device.h"
|
2022-03-25 11:24:00 +00:00
|
|
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
2023-12-11 12:10:56 +00:00
|
|
|
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
|
|
|
|
#include "shared/test/common/mocks/mock_memory_manager.h"
|
2024-02-28 12:46:21 +00:00
|
|
|
#include "shared/test/common/mocks/mock_timestamp_container.h"
|
2022-06-29 19:17:47 +00:00
|
|
|
#include "shared/test/common/test_macros/hw_test.h"
|
2020-02-23 09:03:33 +01:00
|
|
|
|
2023-01-19 12:26:21 +00:00
|
|
|
#include "encode_surface_state_args.h"
|
|
|
|
|
|
2020-02-21 15:35:08 +01:00
|
|
|
using namespace NEO;
|
2020-07-23 09:43:52 +02:00
|
|
|
using CommandEncoderTests = ::testing::Test;
|
2020-02-21 15:35:08 +01:00
|
|
|
|
2025-10-29 15:19:49 +00:00
|
|
|
#include "shared/test/common/test_macros/heapless_matchers.h"
|
2025-03-18 00:28:35 +00:00
|
|
|
|
|
|
|
|
HWTEST2_F(CommandEncoderTests, whenPushBindingTableAndSurfaceStatesIsCalledAndHeaplessRequiredThenFail, IsHeaplessRequired) {
|
|
|
|
|
std::byte mockHeap[sizeof(IndirectHeap)];
|
|
|
|
|
EXPECT_ANY_THROW(EncodeSurfaceState<FamilyType>::pushBindingTableAndSurfaceStates(reinterpret_cast<IndirectHeap &>(mockHeap), nullptr, 0, 0, 0));
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-19 12:26:21 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenMisalignedSizeWhenProgrammingSurfaceStateForBufferThenAlignedSizeIsProgrammed) {
|
|
|
|
|
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
|
|
|
|
|
|
|
|
|
RENDER_SURFACE_STATE renderSurfaceState{};
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
|
|
|
|
|
auto misalignedSize = 1u;
|
|
|
|
|
auto alignedSize = 4u;
|
|
|
|
|
|
|
|
|
|
NEO::EncodeSurfaceStateArgs args{};
|
|
|
|
|
args.outMemory = &renderSurfaceState;
|
|
|
|
|
args.gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
|
|
|
|
|
args.size = misalignedSize;
|
|
|
|
|
|
|
|
|
|
EncodeSurfaceState<FamilyType>::encodeBuffer(args);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(alignedSize, renderSurfaceState.getWidth());
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 16:27:50 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenDifferentInputParamsWhenCreatingStandaloneInOrderExecInfoThenSetupCorrectly) {
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
|
|
|
|
uint64_t counterValue = 2;
|
|
|
|
|
uint64_t *hostAddress = &counterValue;
|
|
|
|
|
uint64_t gpuAddress = castToUint64(ptrOffset(&counterValue, 64));
|
|
|
|
|
|
2025-02-11 16:28:01 +00:00
|
|
|
MockGraphicsAllocation deviceAlloc(nullptr, gpuAddress, 1);
|
2024-10-14 16:37:26 +00:00
|
|
|
|
2025-02-11 16:28:01 +00:00
|
|
|
auto inOrderExecInfo = InOrderExecInfo::createFromExternalAllocation(mockDevice, &deviceAlloc, gpuAddress, nullptr, hostAddress, counterValue, 2, 3);
|
2024-01-12 16:27:50 +00:00
|
|
|
|
|
|
|
|
EXPECT_EQ(counterValue, inOrderExecInfo->getCounterValue());
|
|
|
|
|
EXPECT_EQ(hostAddress, inOrderExecInfo->getBaseHostAddress());
|
|
|
|
|
EXPECT_EQ(gpuAddress, inOrderExecInfo->getBaseDeviceAddress());
|
2025-02-11 16:28:01 +00:00
|
|
|
EXPECT_EQ(&deviceAlloc, inOrderExecInfo->getDeviceCounterAllocation());
|
2024-01-12 16:27:50 +00:00
|
|
|
EXPECT_EQ(nullptr, inOrderExecInfo->getHostCounterAllocation());
|
2024-04-11 18:55:27 +00:00
|
|
|
EXPECT_TRUE(inOrderExecInfo->isExternalMemoryExecInfo());
|
2024-10-15 16:32:10 +00:00
|
|
|
EXPECT_EQ(2u, inOrderExecInfo->getNumDevicePartitionsToWait());
|
|
|
|
|
EXPECT_EQ(3u, inOrderExecInfo->getNumHostPartitionsToWait());
|
2025-08-08 12:42:03 +00:00
|
|
|
EXPECT_EQ(0u, inOrderExecInfo->getDeviceNodeWriteSize());
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo->getHostNodeWriteSize());
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo->getDeviceNodeGpuAddress());
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo->getHostNodeGpuAddress());
|
2024-01-12 16:27:50 +00:00
|
|
|
|
|
|
|
|
inOrderExecInfo->reset();
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo->getCounterValue());
|
2025-02-11 16:28:01 +00:00
|
|
|
|
|
|
|
|
MockGraphicsAllocation hostAlloc(nullptr, castToUint64(hostAddress), 1);
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo = InOrderExecInfo::createFromExternalAllocation(mockDevice, &deviceAlloc, gpuAddress, &hostAlloc, hostAddress, counterValue, 2, 3);
|
|
|
|
|
EXPECT_EQ(&hostAlloc, inOrderExecInfo->getHostCounterAllocation());
|
2024-01-12 16:27:50 +00:00
|
|
|
}
|
|
|
|
|
|
2024-07-19 15:15:04 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenTsNodesWhenStoringOnTempListThenHandleOwnershipCorrectly) {
|
|
|
|
|
class MyMockInOrderExecInfo : public NEO::InOrderExecInfo {
|
|
|
|
|
public:
|
|
|
|
|
using InOrderExecInfo::InOrderExecInfo;
|
|
|
|
|
using InOrderExecInfo::lastWaitedCounterValue;
|
|
|
|
|
using InOrderExecInfo::tempTimestampNodes;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
|
|
|
|
using AllocatorT = MockTagAllocator<NEO::TimestampPackets<uint64_t, 1>>;
|
|
|
|
|
|
|
|
|
|
AllocatorT tsAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
|
|
|
|
|
auto node0 = static_cast<AllocatorT::NodeType *>(tsAllocator.getTag());
|
|
|
|
|
auto node1 = static_cast<AllocatorT::NodeType *>(tsAllocator.getTag());
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(tsAllocator.freeTags.peekContains(*node0));
|
|
|
|
|
EXPECT_FALSE(tsAllocator.freeTags.peekContains(*node1));
|
|
|
|
|
|
|
|
|
|
{
|
2024-09-20 14:53:27 +00:00
|
|
|
MyMockInOrderExecInfo inOrderExecInfo(nullptr, nullptr, mockDevice, 1, false, false);
|
2024-07-19 15:15:04 +00:00
|
|
|
|
|
|
|
|
inOrderExecInfo.lastWaitedCounterValue = 0;
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo.pushTempTimestampNode(node0, 1);
|
|
|
|
|
inOrderExecInfo.pushTempTimestampNode(node1, 2);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(2u, inOrderExecInfo.tempTimestampNodes.size());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo.releaseNotUsedTempTimestampNodes(false);
|
|
|
|
|
EXPECT_EQ(2u, inOrderExecInfo.tempTimestampNodes.size());
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(tsAllocator.freeTags.peekContains(*node0));
|
|
|
|
|
EXPECT_FALSE(tsAllocator.freeTags.peekContains(*node1));
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo.lastWaitedCounterValue = 1;
|
|
|
|
|
inOrderExecInfo.releaseNotUsedTempTimestampNodes(false);
|
|
|
|
|
EXPECT_EQ(1u, inOrderExecInfo.tempTimestampNodes.size());
|
|
|
|
|
EXPECT_EQ(node1, inOrderExecInfo.tempTimestampNodes[0].first);
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(tsAllocator.freeTags.peekContains(*node0));
|
|
|
|
|
EXPECT_FALSE(tsAllocator.freeTags.peekContains(*node1));
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo.lastWaitedCounterValue = 2;
|
|
|
|
|
inOrderExecInfo.releaseNotUsedTempTimestampNodes(false);
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo.tempTimestampNodes.size());
|
|
|
|
|
EXPECT_TRUE(tsAllocator.freeTags.peekContains(*node0));
|
|
|
|
|
EXPECT_TRUE(tsAllocator.freeTags.peekContains(*node1));
|
|
|
|
|
|
|
|
|
|
node0 = static_cast<AllocatorT::NodeType *>(tsAllocator.getTag());
|
|
|
|
|
node1 = static_cast<AllocatorT::NodeType *>(tsAllocator.getTag());
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(tsAllocator.freeTags.peekContains(*node0));
|
|
|
|
|
EXPECT_FALSE(tsAllocator.freeTags.peekContains(*node1));
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo.pushTempTimestampNode(node0, 3);
|
|
|
|
|
inOrderExecInfo.pushTempTimestampNode(node1, 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// forced release on destruction
|
|
|
|
|
EXPECT_TRUE(tsAllocator.freeTags.peekContains(*node0));
|
|
|
|
|
EXPECT_TRUE(tsAllocator.freeTags.peekContains(*node1));
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-11 12:10:56 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenDifferentInputParamsWhenCreatingInOrderExecInfoThenSetupCorrectly) {
|
2024-01-12 16:27:50 +00:00
|
|
|
MockDevice mockDevice;
|
2023-12-11 12:10:56 +00:00
|
|
|
|
2024-03-13 15:48:10 +00:00
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> deviceTagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> hostTagAllocator(0, mockDevice.getMemoryManager());
|
2024-02-28 12:46:21 +00:00
|
|
|
|
2024-03-13 15:48:10 +00:00
|
|
|
auto tempNode1 = deviceTagAllocator.getTag();
|
|
|
|
|
auto tempNode2 = hostTagAllocator.getTag();
|
2023-12-11 12:10:56 +00:00
|
|
|
|
|
|
|
|
{
|
2024-03-13 15:48:10 +00:00
|
|
|
auto deviceNode = deviceTagAllocator.getTag();
|
2024-02-28 12:46:21 +00:00
|
|
|
|
|
|
|
|
EXPECT_NE(deviceNode->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation()->getGpuAddress(), deviceNode->getGpuAddress());
|
|
|
|
|
EXPECT_NE(deviceNode->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation()->getUnderlyingBuffer(), deviceNode->getCpuBase());
|
2024-01-12 16:27:50 +00:00
|
|
|
|
2024-03-13 15:48:10 +00:00
|
|
|
auto inOrderExecInfo = InOrderExecInfo::create(deviceNode, nullptr, mockDevice, 2, false);
|
2024-02-28 12:46:21 +00:00
|
|
|
|
|
|
|
|
EXPECT_EQ(deviceNode->getCpuBase(), inOrderExecInfo->getBaseHostAddress());
|
|
|
|
|
EXPECT_EQ(deviceNode->getBaseGraphicsAllocation()->getGraphicsAllocation(0), inOrderExecInfo->getDeviceCounterAllocation());
|
|
|
|
|
EXPECT_EQ(deviceNode->getGpuAddress(), inOrderExecInfo->getBaseDeviceAddress());
|
2024-01-12 16:27:50 +00:00
|
|
|
EXPECT_EQ(nullptr, inOrderExecInfo->getHostCounterAllocation());
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isHostStorageDuplicated());
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isRegularCmdList());
|
2024-08-12 21:06:11 +00:00
|
|
|
|
2025-04-01 23:42:36 +00:00
|
|
|
auto heaplessEnabled = mockDevice.getCompilerProductHelper().isHeaplessModeEnabled(*defaultHwInfo);
|
2024-08-12 21:06:11 +00:00
|
|
|
|
|
|
|
|
if (heaplessEnabled) {
|
|
|
|
|
EXPECT_TRUE(inOrderExecInfo->isAtomicDeviceSignalling());
|
|
|
|
|
EXPECT_EQ(1u, inOrderExecInfo->getNumDevicePartitionsToWait());
|
|
|
|
|
} else {
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isAtomicDeviceSignalling());
|
|
|
|
|
EXPECT_EQ(2u, inOrderExecInfo->getNumDevicePartitionsToWait());
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 16:27:50 +00:00
|
|
|
EXPECT_EQ(2u, inOrderExecInfo->getNumHostPartitionsToWait());
|
|
|
|
|
EXPECT_EQ(0u, InOrderPatchCommandHelpers::getAppendCounterValue(*inOrderExecInfo));
|
2024-04-11 18:55:27 +00:00
|
|
|
EXPECT_FALSE(inOrderExecInfo->isExternalMemoryExecInfo());
|
2023-12-11 12:10:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2024-03-13 15:48:10 +00:00
|
|
|
auto deviceNode = deviceTagAllocator.getTag();
|
2023-12-11 12:10:56 +00:00
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
InOrderExecInfo inOrderExecInfo(deviceNode, nullptr, mockDevice, 2, true, true);
|
2023-12-11 12:10:56 +00:00
|
|
|
EXPECT_TRUE(inOrderExecInfo.isRegularCmdList());
|
2023-12-13 11:47:42 +00:00
|
|
|
EXPECT_TRUE(inOrderExecInfo.isAtomicDeviceSignalling());
|
2023-12-11 12:10:56 +00:00
|
|
|
EXPECT_EQ(1u, inOrderExecInfo.getNumDevicePartitionsToWait());
|
|
|
|
|
EXPECT_EQ(2u, inOrderExecInfo.getNumHostPartitionsToWait());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2024-03-13 15:48:10 +00:00
|
|
|
auto deviceNode = deviceTagAllocator.getTag();
|
|
|
|
|
auto hostNode = hostTagAllocator.getTag();
|
|
|
|
|
auto offset = ptrDiff(hostNode->getCpuBase(), tempNode2->getCpuBase());
|
2024-02-28 12:46:21 +00:00
|
|
|
|
2024-02-29 14:52:48 +00:00
|
|
|
DebugManagerStateRestore restore;
|
|
|
|
|
debugManager.flags.InOrderDuplicatedCounterStorageEnabled.set(1);
|
|
|
|
|
|
2025-08-08 12:42:03 +00:00
|
|
|
constexpr uint32_t partitionCount = 2u;
|
|
|
|
|
auto inOrderExecInfo = InOrderExecInfo::create(deviceNode, hostNode, mockDevice, partitionCount, false);
|
2024-01-12 16:27:50 +00:00
|
|
|
|
2024-03-13 15:48:10 +00:00
|
|
|
EXPECT_EQ(inOrderExecInfo->getBaseHostGpuAddress(), hostNode->getGpuAddress());
|
2024-01-12 16:27:50 +00:00
|
|
|
EXPECT_NE(inOrderExecInfo->getDeviceCounterAllocation(), inOrderExecInfo->getHostCounterAllocation());
|
2024-02-28 12:46:21 +00:00
|
|
|
EXPECT_NE(deviceNode->getBaseGraphicsAllocation()->getGraphicsAllocation(0), inOrderExecInfo->getHostCounterAllocation());
|
2025-08-08 12:42:03 +00:00
|
|
|
EXPECT_NE(0u, inOrderExecInfo->getDeviceNodeGpuAddress());
|
|
|
|
|
size_t deviceNodeSize = sizeof(uint64_t) * (mockDevice.getGfxCoreHelper().inOrderAtomicSignallingEnabled(mockDevice.getRootDeviceEnvironment()) ? 1u : partitionCount);
|
|
|
|
|
EXPECT_EQ(deviceNodeSize, inOrderExecInfo->getDeviceNodeWriteSize());
|
|
|
|
|
EXPECT_NE(0u, inOrderExecInfo->getHostNodeGpuAddress());
|
|
|
|
|
EXPECT_EQ(sizeof(uint64_t) * partitionCount, inOrderExecInfo->getHostNodeWriteSize());
|
2024-01-12 16:27:50 +00:00
|
|
|
|
2024-02-28 12:46:21 +00:00
|
|
|
EXPECT_NE(deviceNode->getCpuBase(), inOrderExecInfo->getBaseHostAddress());
|
2024-03-13 15:48:10 +00:00
|
|
|
EXPECT_EQ(ptrOffset(inOrderExecInfo->getHostCounterAllocation()->getUnderlyingBuffer(), offset), inOrderExecInfo->getBaseHostAddress());
|
2024-01-12 16:27:50 +00:00
|
|
|
EXPECT_TRUE(inOrderExecInfo->isHostStorageDuplicated());
|
2023-12-11 12:10:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2024-03-13 15:48:10 +00:00
|
|
|
auto deviceNode = deviceTagAllocator.getTag();
|
|
|
|
|
auto hostNode = hostTagAllocator.getTag();
|
2024-02-28 12:46:21 +00:00
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
InOrderExecInfo inOrderExecInfo(deviceNode, hostNode, mockDevice, 1, false, false);
|
2024-02-28 12:46:21 +00:00
|
|
|
auto deviceAllocHostAddress = reinterpret_cast<uint64_t *>(deviceNode->getCpuBase());
|
2023-12-11 12:10:56 +00:00
|
|
|
EXPECT_EQ(0u, inOrderExecInfo.getCounterValue());
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo.getRegularCmdListSubmissionCounter());
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo.getAllocationOffset());
|
|
|
|
|
EXPECT_EQ(0u, *inOrderExecInfo.getBaseHostAddress());
|
|
|
|
|
EXPECT_EQ(0u, *deviceAllocHostAddress);
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo.addCounterValue(2);
|
|
|
|
|
inOrderExecInfo.addRegularCmdListSubmissionCounter(3);
|
2024-02-27 16:06:51 +00:00
|
|
|
inOrderExecInfo.setAllocationOffset(4);
|
2023-12-11 12:10:56 +00:00
|
|
|
*inOrderExecInfo.getBaseHostAddress() = 5;
|
|
|
|
|
*deviceAllocHostAddress = 6;
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(2u, inOrderExecInfo.getCounterValue());
|
|
|
|
|
EXPECT_EQ(3u, inOrderExecInfo.getRegularCmdListSubmissionCounter());
|
|
|
|
|
EXPECT_EQ(4u, inOrderExecInfo.getAllocationOffset());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo.reset();
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo.getCounterValue());
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo.getRegularCmdListSubmissionCounter());
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo.getAllocationOffset());
|
|
|
|
|
EXPECT_EQ(0u, *inOrderExecInfo.getBaseHostAddress());
|
|
|
|
|
EXPECT_EQ(0u, *deviceAllocHostAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2024-03-13 15:48:10 +00:00
|
|
|
auto deviceNode = deviceTagAllocator.getTag();
|
2023-12-11 12:10:56 +00:00
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
InOrderExecInfo inOrderExecInfo(deviceNode, nullptr, mockDevice, 2, true, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, InOrderPatchCommandHelpers::getAppendCounterValue(inOrderExecInfo));
|
|
|
|
|
inOrderExecInfo.addCounterValue(2);
|
|
|
|
|
EXPECT_EQ(0u, InOrderPatchCommandHelpers::getAppendCounterValue(inOrderExecInfo));
|
|
|
|
|
inOrderExecInfo.addRegularCmdListSubmissionCounter(1);
|
|
|
|
|
EXPECT_EQ(0u, InOrderPatchCommandHelpers::getAppendCounterValue(inOrderExecInfo));
|
|
|
|
|
inOrderExecInfo.addRegularCmdListSubmissionCounter(1);
|
|
|
|
|
EXPECT_EQ(2u, InOrderPatchCommandHelpers::getAppendCounterValue(inOrderExecInfo));
|
|
|
|
|
inOrderExecInfo.addRegularCmdListSubmissionCounter(1);
|
|
|
|
|
EXPECT_EQ(4u, InOrderPatchCommandHelpers::getAppendCounterValue(inOrderExecInfo));
|
|
|
|
|
}
|
2024-02-28 12:46:21 +00:00
|
|
|
|
2024-03-13 15:48:10 +00:00
|
|
|
tempNode1->returnTag();
|
|
|
|
|
tempNode2->returnTag();
|
2023-12-11 12:10:56 +00:00
|
|
|
}
|
|
|
|
|
|
2024-04-25 15:08:55 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenInOrderExecutionInfoWhenSetLastCounterValueIsCalledThenItReturnsProperQueries) {
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
|
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
|
|
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> tagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
auto node = tagAllocator.getTag();
|
|
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
auto inOrderExecInfo = std::make_unique<InOrderExecInfo>(node, nullptr, mockDevice, 2, true, false);
|
2024-04-25 15:08:55 +00:00
|
|
|
inOrderExecInfo->setLastWaitedCounterValue(1u);
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(2u));
|
|
|
|
|
EXPECT_TRUE(inOrderExecInfo->isCounterAlreadyDone(1u));
|
|
|
|
|
EXPECT_TRUE(inOrderExecInfo->isCounterAlreadyDone(0u));
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->setLastWaitedCounterValue(0u);
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(2u));
|
|
|
|
|
EXPECT_TRUE(inOrderExecInfo->isCounterAlreadyDone(1u));
|
|
|
|
|
EXPECT_TRUE(inOrderExecInfo->isCounterAlreadyDone(0u));
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->setLastWaitedCounterValue(3u);
|
|
|
|
|
EXPECT_TRUE(inOrderExecInfo->isCounterAlreadyDone(2u));
|
|
|
|
|
EXPECT_TRUE(inOrderExecInfo->isCounterAlreadyDone(3u));
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->setAllocationOffset(4u);
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(2u));
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(3u));
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(0u));
|
2025-02-19 15:24:13 +00:00
|
|
|
|
|
|
|
|
inOrderExecInfo = std::make_unique<InOrderExecInfo>(nullptr, nullptr, mockDevice, 2, true, false);
|
|
|
|
|
inOrderExecInfo->setLastWaitedCounterValue(2);
|
|
|
|
|
EXPECT_FALSE(inOrderExecInfo->isCounterAlreadyDone(1));
|
2024-04-25 15:08:55 +00:00
|
|
|
}
|
|
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenInOrderExecutionInfoWhenResetCalledThenUploadToTbx) {
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
auto &csr = mockDevice.getUltCommandStreamReceiver<FamilyType>();
|
|
|
|
|
csr.commandStreamReceiverType = CommandStreamReceiverType::tbx;
|
|
|
|
|
|
|
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> deviceTagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
MockTagAllocator<DeviceAllocNodeType<false>> hostTagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
auto deviceNode = deviceTagAllocator.getTag();
|
|
|
|
|
auto hostNode = hostTagAllocator.getTag();
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, csr.writeMemoryParams.totalCallCount);
|
|
|
|
|
|
|
|
|
|
auto inOrderExecInfo = std::make_unique<InOrderExecInfo>(deviceNode, hostNode, mockDevice, 2, true, false);
|
|
|
|
|
EXPECT_EQ(2u, csr.writeMemoryParams.totalCallCount);
|
|
|
|
|
EXPECT_EQ(0u, csr.writeMemoryParams.chunkWriteCallCount);
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->reset();
|
|
|
|
|
EXPECT_EQ(4u, csr.writeMemoryParams.totalCallCount);
|
|
|
|
|
EXPECT_EQ(2u, csr.writeMemoryParams.chunkWriteCallCount);
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo = std::make_unique<InOrderExecInfo>(deviceNode, nullptr, mockDevice, 2, true, false);
|
|
|
|
|
EXPECT_EQ(5u, csr.writeMemoryParams.totalCallCount);
|
|
|
|
|
EXPECT_EQ(3u, csr.writeMemoryParams.chunkWriteCallCount);
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->reset();
|
|
|
|
|
EXPECT_EQ(6u, csr.writeMemoryParams.totalCallCount);
|
|
|
|
|
EXPECT_EQ(4u, csr.writeMemoryParams.chunkWriteCallCount);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-11 12:10:56 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenInOrderExecInfoWhenPatchingThenSetCorrectValues) {
|
2024-02-28 12:46:21 +00:00
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
2023-12-11 12:10:56 +00:00
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
MockMemoryManager memoryManager(mockExecutionEnvironment);
|
|
|
|
|
|
2024-02-28 12:46:21 +00:00
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> tagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
auto node = tagAllocator.getTag();
|
2023-12-11 12:10:56 +00:00
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
auto inOrderExecInfo = std::make_shared<InOrderExecInfo>(node, nullptr, mockDevice, 2, true, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
inOrderExecInfo->addCounterValue(1);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
auto cmd = FamilyType::cmdInitStoreDataImm;
|
|
|
|
|
cmd.setDataDword0(1);
|
|
|
|
|
|
2023-12-21 13:48:32 +00:00
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmd(&inOrderExecInfo, reinterpret_cast<void *>(&cmd), nullptr, 1, InOrderPatchCommandHelpers::PatchCmdType::sdi, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
patchCmd.patch(2);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(3u, cmd.getDataDword0());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
auto cmd = FamilyType::cmdInitMiSemaphoreWait;
|
|
|
|
|
cmd.setSemaphoreDataDword(1);
|
|
|
|
|
|
2023-12-21 13:48:32 +00:00
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmd(&inOrderExecInfo, &cmd, nullptr, 1, InOrderPatchCommandHelpers::PatchCmdType::semaphore, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
patchCmd.patch(2);
|
|
|
|
|
EXPECT_EQ(1u, cmd.getSemaphoreDataDword());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->addRegularCmdListSubmissionCounter(3);
|
|
|
|
|
patchCmd.patch(3);
|
|
|
|
|
EXPECT_EQ(3u, cmd.getSemaphoreDataDword());
|
|
|
|
|
|
2023-12-21 13:48:32 +00:00
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmdInternal(nullptr, &cmd, nullptr, 1, InOrderPatchCommandHelpers::PatchCmdType::semaphore, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
patchCmdInternal.patch(3);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(4u, cmd.getSemaphoreDataDword());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
auto cmd1 = FamilyType::cmdInitLoadRegisterImm;
|
|
|
|
|
auto cmd2 = FamilyType::cmdInitLoadRegisterImm;
|
|
|
|
|
cmd1.setDataDword(1);
|
|
|
|
|
cmd2.setDataDword(1);
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->reset();
|
|
|
|
|
inOrderExecInfo->addCounterValue(1);
|
2023-12-21 13:48:32 +00:00
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmd(&inOrderExecInfo, &cmd1, &cmd2, 1, InOrderPatchCommandHelpers::PatchCmdType::lri64b, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
patchCmd.patch(3);
|
|
|
|
|
EXPECT_EQ(1u, cmd1.getDataDword());
|
|
|
|
|
EXPECT_EQ(1u, cmd2.getDataDword());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->addRegularCmdListSubmissionCounter(3);
|
|
|
|
|
patchCmd.patch(3);
|
|
|
|
|
EXPECT_EQ(3u, cmd1.getDataDword());
|
|
|
|
|
EXPECT_EQ(0u, cmd2.getDataDword());
|
|
|
|
|
|
2023-12-21 13:48:32 +00:00
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmdInternal(nullptr, &cmd1, &cmd2, 1, InOrderPatchCommandHelpers::PatchCmdType::lri64b, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
patchCmdInternal.patch(2);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(3u, cmd1.getDataDword());
|
|
|
|
|
EXPECT_EQ(0u, cmd2.getDataDword());
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-21 13:48:32 +00:00
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmd(&inOrderExecInfo, nullptr, nullptr, 1, InOrderPatchCommandHelpers::PatchCmdType::none, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
EXPECT_ANY_THROW(patchCmd.patch(1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWTEST_F(CommandEncoderTests, givenInOrderExecInfoWhenPatchingWalkerThenSetCorrectValues) {
|
2024-06-26 00:39:52 +00:00
|
|
|
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
2024-02-28 12:46:21 +00:00
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
2023-12-11 12:10:56 +00:00
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
MockMemoryManager memoryManager(mockExecutionEnvironment);
|
|
|
|
|
|
2024-02-28 12:46:21 +00:00
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> tagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
auto node = tagAllocator.getTag();
|
2023-12-11 12:10:56 +00:00
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
auto inOrderExecInfo = std::make_shared<InOrderExecInfo>(node, nullptr, mockDevice, 2, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
|
2024-06-26 00:39:52 +00:00
|
|
|
auto cmd = FamilyType::template getInitGpuWalker<DefaultWalkerType>();
|
2023-12-11 12:10:56 +00:00
|
|
|
|
2023-12-21 13:48:32 +00:00
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmd(&inOrderExecInfo, &cmd, nullptr, 1, InOrderPatchCommandHelpers::PatchCmdType::walker, false, false);
|
2023-12-11 12:10:56 +00:00
|
|
|
|
|
|
|
|
if constexpr (FamilyType::walkerPostSyncSupport) {
|
|
|
|
|
patchCmd.patch(2);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(3u, cmd.getPostSync().getImmediateData());
|
|
|
|
|
} else {
|
|
|
|
|
EXPECT_ANY_THROW(patchCmd.patch(2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-11 12:37:03 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenInOrderExecInfoWhenPatchingDisabledThenNoCmdBufferUpdated) {
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
|
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
MockMemoryManager memoryManager(mockExecutionEnvironment);
|
|
|
|
|
|
|
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> tagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
auto node = tagAllocator.getTag();
|
|
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
auto inOrderExecInfo = std::make_shared<InOrderExecInfo>(node, nullptr, mockDevice, 1, true, false);
|
2024-03-11 12:37:03 +00:00
|
|
|
inOrderExecInfo->addRegularCmdListSubmissionCounter(4);
|
|
|
|
|
inOrderExecInfo->addCounterValue(1);
|
|
|
|
|
|
|
|
|
|
auto cmd = FamilyType::cmdInitMiSemaphoreWait;
|
|
|
|
|
cmd.setSemaphoreDataDword(1);
|
|
|
|
|
|
|
|
|
|
constexpr uint64_t baseCounterValue = 1;
|
|
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmd(&inOrderExecInfo, &cmd, nullptr, baseCounterValue, InOrderPatchCommandHelpers::PatchCmdType::semaphore, false, false);
|
|
|
|
|
|
|
|
|
|
patchCmd.setSkipPatching(true);
|
|
|
|
|
patchCmd.patch(2);
|
|
|
|
|
EXPECT_EQ(1u, cmd.getSemaphoreDataDword());
|
|
|
|
|
|
|
|
|
|
patchCmd.setSkipPatching(false);
|
|
|
|
|
patchCmd.patch(2);
|
|
|
|
|
EXPECT_EQ(4u, cmd.getSemaphoreDataDword());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWTEST_F(CommandEncoderTests, givenNewInOrderExecInfoWhenChangingInOrderExecInfoThenNewValuePatched) {
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
|
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
MockMemoryManager memoryManager(mockExecutionEnvironment);
|
|
|
|
|
|
|
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> tagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
auto node = tagAllocator.getTag();
|
|
|
|
|
|
2024-09-20 14:53:27 +00:00
|
|
|
auto inOrderExecInfo = std::make_shared<InOrderExecInfo>(node, nullptr, mockDevice, 1, true, false);
|
2024-03-11 12:37:03 +00:00
|
|
|
inOrderExecInfo->addRegularCmdListSubmissionCounter(4);
|
|
|
|
|
inOrderExecInfo->addCounterValue(1);
|
|
|
|
|
|
|
|
|
|
auto cmd = FamilyType::cmdInitMiSemaphoreWait;
|
|
|
|
|
cmd.setSemaphoreDataDword(1);
|
|
|
|
|
|
|
|
|
|
constexpr uint64_t baseCounterValue = 1;
|
|
|
|
|
InOrderPatchCommandHelpers::PatchCmd<FamilyType> patchCmd(&inOrderExecInfo, &cmd, nullptr, baseCounterValue, InOrderPatchCommandHelpers::PatchCmdType::semaphore, false, false);
|
|
|
|
|
|
|
|
|
|
patchCmd.patch(2);
|
|
|
|
|
EXPECT_EQ(4u, cmd.getSemaphoreDataDword());
|
|
|
|
|
|
|
|
|
|
auto node2 = tagAllocator.getTag();
|
2024-09-20 14:53:27 +00:00
|
|
|
auto inOrderExecInfo2 = std::make_shared<InOrderExecInfo>(node2, nullptr, mockDevice, 1, true, false);
|
2024-03-11 12:37:03 +00:00
|
|
|
inOrderExecInfo2->addRegularCmdListSubmissionCounter(6);
|
|
|
|
|
inOrderExecInfo2->addCounterValue(1);
|
|
|
|
|
|
|
|
|
|
patchCmd.updateInOrderExecInfo(&inOrderExecInfo2);
|
|
|
|
|
patchCmd.patch(2);
|
|
|
|
|
EXPECT_EQ(6u, cmd.getSemaphoreDataDword());
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-21 15:35:08 +01:00
|
|
|
HWTEST_F(CommandEncoderTests, givenImmDataWriteWhenProgrammingMiFlushDwThenSetAllRequiredFields) {
|
|
|
|
|
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
|
|
|
|
|
uint8_t buffer[2 * sizeof(MI_FLUSH_DW)] = {};
|
|
|
|
|
LinearStream linearStream(buffer, sizeof(buffer));
|
|
|
|
|
|
|
|
|
|
uint64_t gpuAddress = 0x1230000;
|
|
|
|
|
uint64_t immData = 456;
|
2023-01-25 19:28:09 +00:00
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
2023-03-10 19:21:59 +00:00
|
|
|
NEO::EncodeDummyBlitWaArgs waArgs{false, mockExecutionEnvironment.rootDeviceEnvironments[0].get()};
|
|
|
|
|
MiFlushArgs args{waArgs};
|
2021-06-17 11:55:28 +00:00
|
|
|
args.commandWithPostSync = true;
|
2023-01-25 19:28:09 +00:00
|
|
|
|
2023-03-06 12:42:09 +00:00
|
|
|
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, gpuAddress, immData, args);
|
2020-02-21 15:35:08 +01:00
|
|
|
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
|
|
|
|
|
|
2020-03-12 10:49:20 +01:00
|
|
|
unsigned int sizeMultiplier = 1;
|
|
|
|
|
if (UnitTestHelper<FamilyType>::additionalMiFlushDwRequired) {
|
|
|
|
|
sizeMultiplier = 2;
|
|
|
|
|
uint64_t gpuAddress = 0x0;
|
|
|
|
|
uint64_t immData = 0;
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(MI_FLUSH_DW::POST_SYNC_OPERATION_NO_WRITE, miFlushDwCmd->getPostSyncOperation());
|
|
|
|
|
EXPECT_EQ(gpuAddress, miFlushDwCmd->getDestinationAddress());
|
|
|
|
|
EXPECT_EQ(immData, miFlushDwCmd->getImmediateData());
|
|
|
|
|
miFlushDwCmd++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(sizeMultiplier * sizeof(MI_FLUSH_DW), linearStream.getUsed());
|
2020-02-21 15:35:08 +01:00
|
|
|
EXPECT_EQ(MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD, miFlushDwCmd->getPostSyncOperation());
|
|
|
|
|
EXPECT_EQ(gpuAddress, miFlushDwCmd->getDestinationAddress());
|
|
|
|
|
EXPECT_EQ(immData, miFlushDwCmd->getImmediateData());
|
2021-06-17 11:55:28 +00:00
|
|
|
EXPECT_EQ(0u, static_cast<uint32_t>(miFlushDwCmd->getNotifyEnable()));
|
2020-02-21 15:35:08 +01:00
|
|
|
}
|
2020-04-03 17:38:09 +02:00
|
|
|
|
2022-10-29 08:39:41 +00:00
|
|
|
HWTEST2_F(CommandEncoderTests, given57bitVaForDestinationAddressWhenProgrammingMiFlushDwThenVerifyAll57bitsAreUsed, IsPVC) {
|
|
|
|
|
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
|
|
|
|
|
uint8_t buffer[2 * sizeof(MI_FLUSH_DW)] = {};
|
|
|
|
|
LinearStream linearStream(buffer, sizeof(buffer));
|
|
|
|
|
|
|
|
|
|
const uint64_t setGpuAddress = 0xffffffffffffffff;
|
|
|
|
|
const uint64_t verifyGpuAddress = 0xfffffffffffffff8;
|
2023-01-25 19:28:09 +00:00
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
2023-03-10 19:21:59 +00:00
|
|
|
NEO::EncodeDummyBlitWaArgs waArgs{false, mockExecutionEnvironment.rootDeviceEnvironments[0].get()};
|
|
|
|
|
MiFlushArgs args{waArgs};
|
2022-10-29 08:39:41 +00:00
|
|
|
args.commandWithPostSync = true;
|
2023-03-10 19:21:59 +00:00
|
|
|
|
2023-03-06 12:42:09 +00:00
|
|
|
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, setGpuAddress, 0, args);
|
2022-10-29 08:39:41 +00:00
|
|
|
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(verifyGpuAddress, miFlushDwCmd->getDestinationAddress());
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-03 17:38:09 +02:00
|
|
|
HWTEST_F(CommandEncoderTests, whenEncodeMemoryPrefetchCalledThenDoNothing) {
|
2023-01-25 19:28:09 +00:00
|
|
|
|
|
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
|
2020-04-03 17:38:09 +02:00
|
|
|
uint8_t buffer[MemoryConstants::pageSize] = {};
|
|
|
|
|
LinearStream linearStream(buffer, sizeof(buffer));
|
|
|
|
|
|
2024-06-18 14:45:50 +00:00
|
|
|
GraphicsAllocation allocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, 123, 456, 789, MemoryPool::localMemory, MemoryManager::maxOsContextCount);
|
2020-04-08 17:44:12 +02:00
|
|
|
|
2023-01-25 19:28:09 +00:00
|
|
|
EncodeMemoryPrefetch<FamilyType>::programMemoryPrefetch(linearStream, allocation, 2, 0, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
|
2020-04-03 17:38:09 +02:00
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, linearStream.getUsed());
|
2023-01-25 19:28:09 +00:00
|
|
|
EXPECT_EQ(0u, EncodeMemoryPrefetch<FamilyType>::getSizeForMemoryPrefetch(2, *mockExecutionEnvironment.rootDeviceEnvironments[0]));
|
2020-04-03 17:38:09 +02:00
|
|
|
}
|
2020-06-05 16:12:49 +02:00
|
|
|
|
2024-09-19 13:06:41 +00:00
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, WhenAnyParameterIsProvidedThenRuntimeGenerationLocalIdsIsRequired) {
|
2020-06-05 16:12:49 +02:00
|
|
|
uint32_t workDim = 1;
|
|
|
|
|
uint32_t simd = 8;
|
|
|
|
|
size_t lws[3] = {16, 1, 1};
|
|
|
|
|
std::array<uint8_t, 3> walkOrder = {};
|
|
|
|
|
uint32_t requiredWalkOrder = 0u;
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(EncodeDispatchKernel<FamilyType>::isRuntimeLocalIdsGenerationRequired(
|
|
|
|
|
workDim, lws, walkOrder, true, requiredWalkOrder, simd));
|
|
|
|
|
}
|
2021-06-17 11:55:28 +00:00
|
|
|
|
2025-03-03 16:54:09 +00:00
|
|
|
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, GivenWorkDimensionsAreZeroWhenAnyParameterIsProvidedThenVerifyRuntimeGenerationLocalIdsIsNotRequired) {
|
|
|
|
|
uint32_t workDim = 0;
|
|
|
|
|
uint32_t simd = 8;
|
|
|
|
|
std::array<uint8_t, 3> walkOrder = {};
|
|
|
|
|
uint32_t requiredWalkOrder = 0u;
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(EncodeDispatchKernel<FamilyType>::isRuntimeLocalIdsGenerationRequired(
|
|
|
|
|
workDim, nullptr, walkOrder, false, requiredWalkOrder, simd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, GivenSimdSizeIsOneWhenAnyParameterIsProvidedThenVerifyRuntimeGenerationLocalIdsIsRequired) {
|
|
|
|
|
uint32_t workDim = 3;
|
|
|
|
|
uint32_t simd = 1;
|
|
|
|
|
size_t lws[3] = {7, 7, 5};
|
|
|
|
|
std::array<uint8_t, 3> walkOrder = {0, 1, 2};
|
|
|
|
|
uint32_t requiredWalkOrder = 0u;
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(EncodeDispatchKernel<FamilyType>::isRuntimeLocalIdsGenerationRequired(
|
|
|
|
|
workDim, lws, walkOrder, false, requiredWalkOrder, simd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, GivenhwGenerationOfLocalIdsDebugFlagIsDisabledWhenAnyParameterIsProvidedThenVerifyRuntimeGenerationLocalIdsIsRequired) {
|
|
|
|
|
DebugManagerStateRestore restore;
|
|
|
|
|
debugManager.flags.EnableHwGenerationLocalIds.set(0);
|
|
|
|
|
|
|
|
|
|
uint32_t workDim = 3;
|
|
|
|
|
uint32_t simd = 8;
|
|
|
|
|
size_t lws[3] = {7, 7, 5};
|
|
|
|
|
std::array<uint8_t, 3> walkOrder = {0, 1, 2};
|
|
|
|
|
uint32_t requiredWalkOrder = 0u;
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(EncodeDispatchKernel<FamilyType>::isRuntimeLocalIdsGenerationRequired(
|
|
|
|
|
workDim, lws, walkOrder, false, requiredWalkOrder, simd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenLocalWorkgroupSizeGreaterThen1024ThenRuntimeMustGenerateLocalIds) {
|
|
|
|
|
uint32_t workDim = 3;
|
|
|
|
|
uint32_t simd = 8;
|
|
|
|
|
std::array<size_t, 3> lws = {1025, 1, 1};
|
|
|
|
|
|
|
|
|
|
std::array<uint8_t, 3> walkOrder = {{0, 1, 2}};
|
|
|
|
|
uint32_t requiredWalkOrder = 77u;
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(EncodeDispatchKernel<FamilyType>::isRuntimeLocalIdsGenerationRequired(
|
|
|
|
|
workDim, lws.data(), walkOrder, false, requiredWalkOrder, simd));
|
|
|
|
|
|
|
|
|
|
lws = {1, 1, 1025};
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(EncodeDispatchKernel<FamilyType>::isRuntimeLocalIdsGenerationRequired(
|
|
|
|
|
workDim, lws.data(), walkOrder, false, requiredWalkOrder, simd));
|
|
|
|
|
|
|
|
|
|
lws = {32, 32, 4};
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(EncodeDispatchKernel<FamilyType>::isRuntimeLocalIdsGenerationRequired(
|
|
|
|
|
workDim, lws.data(), walkOrder, false, requiredWalkOrder, simd));
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-17 11:55:28 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenNotify) {
|
|
|
|
|
using MI_FLUSH_DW = typename FamilyType::MI_FLUSH_DW;
|
|
|
|
|
uint8_t buffer[2 * sizeof(MI_FLUSH_DW)] = {};
|
|
|
|
|
LinearStream linearStream(buffer, sizeof(buffer));
|
|
|
|
|
|
|
|
|
|
uint64_t gpuAddress = 0x1230000;
|
|
|
|
|
uint64_t immData = 456;
|
2023-01-25 19:28:09 +00:00
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
2023-03-10 19:21:59 +00:00
|
|
|
NEO::EncodeDummyBlitWaArgs waArgs{false, mockExecutionEnvironment.rootDeviceEnvironments[0].get()};
|
|
|
|
|
MiFlushArgs args{waArgs};
|
2021-06-17 11:55:28 +00:00
|
|
|
args.commandWithPostSync = true;
|
|
|
|
|
args.notifyEnable = true;
|
2023-03-10 19:21:59 +00:00
|
|
|
|
2023-03-06 12:42:09 +00:00
|
|
|
EncodeMiFlushDW<FamilyType>::programWithWa(linearStream, gpuAddress, immData, args);
|
2021-06-17 11:55:28 +00:00
|
|
|
auto miFlushDwCmd = reinterpret_cast<MI_FLUSH_DW *>(buffer);
|
|
|
|
|
|
|
|
|
|
unsigned int sizeMultiplier = 1;
|
|
|
|
|
if (UnitTestHelper<FamilyType>::additionalMiFlushDwRequired) {
|
|
|
|
|
sizeMultiplier = 2;
|
|
|
|
|
uint64_t gpuAddress = 0x0;
|
|
|
|
|
uint64_t immData = 0;
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(MI_FLUSH_DW::POST_SYNC_OPERATION_NO_WRITE, miFlushDwCmd->getPostSyncOperation());
|
|
|
|
|
EXPECT_EQ(gpuAddress, miFlushDwCmd->getDestinationAddress());
|
|
|
|
|
EXPECT_EQ(immData, miFlushDwCmd->getImmediateData());
|
|
|
|
|
miFlushDwCmd++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(sizeMultiplier * sizeof(MI_FLUSH_DW), linearStream.getUsed());
|
|
|
|
|
EXPECT_EQ(MI_FLUSH_DW::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA_QWORD, miFlushDwCmd->getPostSyncOperation());
|
|
|
|
|
EXPECT_EQ(gpuAddress, miFlushDwCmd->getDestinationAddress());
|
|
|
|
|
EXPECT_EQ(immData, miFlushDwCmd->getImmediateData());
|
|
|
|
|
EXPECT_EQ(1u, static_cast<uint32_t>(miFlushDwCmd->getNotifyEnable()));
|
|
|
|
|
}
|
2021-06-23 15:26:56 +00:00
|
|
|
|
2024-09-19 13:06:41 +00:00
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, whenAppendParamsForImageFromBufferThenNothingChanges) {
|
2021-06-23 15:26:56 +00:00
|
|
|
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
|
|
|
|
auto expectedState = surfaceState;
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0, memcmp(&expectedState, &surfaceState, sizeof(surfaceState)));
|
|
|
|
|
EncodeSurfaceState<FamilyType>::appendParamsForImageFromBuffer(&surfaceState);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0, memcmp(&expectedState, &surfaceState, sizeof(surfaceState)));
|
2022-03-09 15:17:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenDebugFlagSetWhenProgrammingMiArbThenSetPreparserDisabledValue) {
|
|
|
|
|
DebugManagerStateRestore restore;
|
|
|
|
|
|
|
|
|
|
using MI_ARB_CHECK = typename FamilyType::MI_ARB_CHECK;
|
|
|
|
|
|
2025-07-31 12:54:10 +00:00
|
|
|
alignas(4) uint8_t arbCheckBuffer[sizeof(MI_ARB_CHECK)];
|
|
|
|
|
void *arbCheckBufferPtr = arbCheckBuffer;
|
|
|
|
|
|
2022-03-09 15:17:47 +00:00
|
|
|
for (int32_t value : {-1, 0, 1}) {
|
2023-11-30 08:32:25 +00:00
|
|
|
debugManager.flags.ForcePreParserEnabledForMiArbCheck.set(value);
|
2022-03-09 15:17:47 +00:00
|
|
|
|
2025-07-31 12:54:10 +00:00
|
|
|
memset(arbCheckBuffer, 0, sizeof(arbCheckBuffer));
|
|
|
|
|
|
2022-03-09 15:17:47 +00:00
|
|
|
MI_ARB_CHECK buffer[2] = {};
|
|
|
|
|
LinearStream linearStream(buffer, sizeof(buffer));
|
2023-02-28 21:08:09 +00:00
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
|
|
|
|
rootDeviceEnvironment.initGmm();
|
2022-03-09 15:17:47 +00:00
|
|
|
|
2024-02-27 14:36:13 +00:00
|
|
|
EncodeMiArbCheck<FamilyType>::program(linearStream, false);
|
2025-07-31 12:54:10 +00:00
|
|
|
EncodeMiArbCheck<FamilyType>::program(arbCheckBufferPtr, false);
|
2022-03-09 15:17:47 +00:00
|
|
|
|
|
|
|
|
if (value == 0) {
|
|
|
|
|
EXPECT_TRUE(buffer[0].getPreParserDisable());
|
|
|
|
|
} else {
|
|
|
|
|
EXPECT_FALSE(buffer[0].getPreParserDisable());
|
|
|
|
|
}
|
2025-07-31 12:54:10 +00:00
|
|
|
EXPECT_EQ(0, memcmp(arbCheckBufferPtr, &buffer[0], sizeof(MI_ARB_CHECK)));
|
2022-03-09 15:17:47 +00:00
|
|
|
}
|
2022-03-25 11:24:00 +00:00
|
|
|
}
|
|
|
|
|
|
2024-09-19 13:06:41 +00:00
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, givenPreXeHpPlatformWhenSetupPostSyncMocsThenNothingHappen) {
|
2022-03-25 11:24:00 +00:00
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
2025-04-09 15:09:27 +00:00
|
|
|
uint32_t mocs = EncodePostSync<FamilyType>::getPostSyncMocs(*executionEnvironment.rootDeviceEnvironments[0], false);
|
2025-03-27 14:02:20 +00:00
|
|
|
EXPECT_EQ(0u, mocs);
|
2022-03-25 11:24:00 +00:00
|
|
|
}
|
|
|
|
|
|
2025-04-16 17:46:09 +00:00
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, givenPreXeHpPlatformWhenCallingAdjustTimestampPacketThenNothingHappen) {
|
|
|
|
|
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
DefaultWalkerType walkerCmd{};
|
|
|
|
|
DefaultWalkerType walkerOnStart{};
|
|
|
|
|
|
|
|
|
|
EncodePostSyncArgs args = {.isTimestampEvent = true};
|
|
|
|
|
EncodePostSync<FamilyType>::template adjustTimestampPacket<DefaultWalkerType>(walkerCmd, args);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, givenPreXeHpPlatformWhenCallingEncodeL3FlushThenNothingHappen) {
|
|
|
|
|
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
DefaultWalkerType walkerCmd{};
|
|
|
|
|
DefaultWalkerType walkerOnStart{};
|
|
|
|
|
|
|
|
|
|
EncodePostSyncArgs args = {.isFlushL3ForExternalAllocationRequired = true};
|
|
|
|
|
EncodePostSync<FamilyType>::template encodeL3Flush<DefaultWalkerType>(walkerCmd, args);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
|
|
|
|
|
|
|
|
|
args = {.isFlushL3ForHostUsmRequired = true};
|
|
|
|
|
EncodePostSync<FamilyType>::template encodeL3Flush<DefaultWalkerType>(walkerCmd, args);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, givenPreXeHpPlatformWhenCallingSetupPostSyncForRegularEventThenNothingHappen) {
|
|
|
|
|
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
DefaultWalkerType walkerCmd{};
|
|
|
|
|
DefaultWalkerType walkerOnStart{};
|
|
|
|
|
|
|
|
|
|
EncodePostSyncArgs args = {.eventAddress = 0x1234};
|
|
|
|
|
EncodePostSync<FamilyType>::template setupPostSyncForRegularEvent<DefaultWalkerType>(walkerCmd, args);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, givenPreXeHpPlatformWhenCallingSetupPostSyncForInOrderExecThenNothingHappen) {
|
|
|
|
|
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
DefaultWalkerType walkerCmd{};
|
|
|
|
|
DefaultWalkerType walkerOnStart{};
|
|
|
|
|
|
|
|
|
|
MockTagAllocator<DeviceAllocNodeType<true>> deviceTagAllocator(0, mockDevice.getMemoryManager());
|
|
|
|
|
auto deviceNode = deviceTagAllocator.getTag();
|
|
|
|
|
|
|
|
|
|
InOrderExecInfo inOrderExecInfo(deviceNode, nullptr, mockDevice, 2, true, true);
|
|
|
|
|
EncodePostSyncArgs args = {.inOrderExecInfo = &inOrderExecInfo};
|
|
|
|
|
EncodePostSync<FamilyType>::template setupPostSyncForInOrderExec<DefaultWalkerType>(walkerCmd, args);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 11:24:00 +00:00
|
|
|
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenAtLeastXeHpPlatformWhenSetupPostSyncMocsThenCorrect) {
|
2023-12-04 12:20:54 +00:00
|
|
|
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
2022-03-25 11:24:00 +00:00
|
|
|
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
|
|
|
|
rootDeviceEnvironment.initGmm();
|
2023-01-20 03:04:15 +00:00
|
|
|
bool dcFlush = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, rootDeviceEnvironment);
|
2022-03-25 11:24:00 +00:00
|
|
|
|
|
|
|
|
{
|
2023-12-04 12:20:54 +00:00
|
|
|
DefaultWalkerType walkerCmd{};
|
2025-03-27 14:02:20 +00:00
|
|
|
uint32_t mocs = 0;
|
|
|
|
|
EXPECT_NO_THROW(mocs = EncodePostSync<FamilyType>::getPostSyncMocs(*executionEnvironment.rootDeviceEnvironments[0], dcFlush));
|
|
|
|
|
EXPECT_NO_THROW(walkerCmd.getPostSync().setMocs(mocs));
|
2022-03-25 11:24:00 +00:00
|
|
|
|
|
|
|
|
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
|
2025-04-14 12:15:51 +00:00
|
|
|
auto expectedMocs = dcFlush ? gmmHelper->getUncachedMOCS() : gmmHelper->getL3EnabledMOCS();
|
2022-03-25 11:24:00 +00:00
|
|
|
|
|
|
|
|
EXPECT_EQ(expectedMocs, walkerCmd.getPostSync().getMocs());
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
DebugManagerStateRestore restorer{};
|
|
|
|
|
auto expectedMocs = 9u;
|
2023-11-30 08:32:25 +00:00
|
|
|
debugManager.flags.OverridePostSyncMocs.set(expectedMocs);
|
2023-12-04 12:20:54 +00:00
|
|
|
DefaultWalkerType walkerCmd{};
|
2025-03-27 14:02:20 +00:00
|
|
|
uint32_t mocs = 0;
|
|
|
|
|
EXPECT_NO_THROW(mocs = EncodePostSync<FamilyType>::getPostSyncMocs(*executionEnvironment.rootDeviceEnvironments[0], false));
|
|
|
|
|
EXPECT_NO_THROW(walkerCmd.getPostSync().setMocs(mocs));
|
2022-03-25 11:24:00 +00:00
|
|
|
EXPECT_EQ(expectedMocs, walkerCmd.getPostSync().getMocs());
|
|
|
|
|
}
|
2022-05-27 16:11:07 +00:00
|
|
|
}
|
|
|
|
|
|
2025-06-17 20:07:10 +00:00
|
|
|
HWTEST2_F(CommandEncoderTests, givenRequiredWorkGroupOrderWhenCallAdjustWalkOrderThenWalkerIsNotChanged, IsAtMostXeCore) {
|
2023-12-04 12:20:54 +00:00
|
|
|
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
|
2023-01-30 00:09:45 +00:00
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
2023-12-04 12:20:54 +00:00
|
|
|
DefaultWalkerType walkerCmd{};
|
|
|
|
|
DefaultWalkerType walkerOnStart{};
|
2022-05-27 16:11:07 +00:00
|
|
|
|
|
|
|
|
uint32_t yOrder = 2u;
|
2023-12-04 12:20:54 +00:00
|
|
|
EncodeDispatchKernel<FamilyType>::template adjustWalkOrder<DefaultWalkerType>(walkerCmd, yOrder, rootDeviceEnvironment);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
2022-05-27 16:11:07 +00:00
|
|
|
|
|
|
|
|
uint32_t linearOrder = 0u;
|
2023-12-04 12:20:54 +00:00
|
|
|
EncodeDispatchKernel<FamilyType>::template adjustWalkOrder<DefaultWalkerType>(walkerCmd, linearOrder, rootDeviceEnvironment);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
2022-05-27 16:11:07 +00:00
|
|
|
|
|
|
|
|
uint32_t fakeOrder = 5u;
|
2023-12-04 12:20:54 +00:00
|
|
|
EncodeDispatchKernel<FamilyType>::template adjustWalkOrder<DefaultWalkerType>(walkerCmd, fakeOrder, rootDeviceEnvironment);
|
|
|
|
|
EXPECT_EQ(0, memcmp(&walkerOnStart, &walkerCmd, sizeof(DefaultWalkerType))); // no change
|
2022-05-30 15:22:17 +00:00
|
|
|
}
|
2022-10-11 10:37:19 +00:00
|
|
|
|
|
|
|
|
HWTEST_F(CommandEncoderTests, givenDcFlushNotRequiredWhenGettingDcFlushValueThenReturnValueIsFalse) {
|
2023-01-20 03:04:15 +00:00
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
|
|
|
|
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
2022-10-11 10:37:19 +00:00
|
|
|
constexpr bool requiredFlag = false;
|
2023-01-20 03:04:15 +00:00
|
|
|
bool helperValue = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(requiredFlag, rootDeviceEnvironment);
|
2022-10-11 10:37:19 +00:00
|
|
|
EXPECT_FALSE(helperValue);
|
|
|
|
|
}
|
2023-03-16 00:12:49 +00:00
|
|
|
|
|
|
|
|
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenXeHpPlatformsWhenGettingDefaultSshSizeThenExpectTwoMegabytes) {
|
|
|
|
|
constexpr size_t expectedSize = 2 * MemoryConstants::megaByte;
|
|
|
|
|
EXPECT_EQ(expectedSize, EncodeStates<FamilyType>::getSshHeapSize());
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-19 13:06:41 +00:00
|
|
|
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncoderTests, givenPreXeHpPlatformsWhenGettingDefaultSshSizeThenExpectSixtyFourKilobytes) {
|
2023-03-16 00:12:49 +00:00
|
|
|
constexpr size_t expectedSize = 64 * MemoryConstants::kiloByte;
|
|
|
|
|
EXPECT_EQ(expectedSize, EncodeStates<FamilyType>::getSshHeapSize());
|
|
|
|
|
}
|
2023-08-30 14:23:02 +00:00
|
|
|
|
2025-11-21 11:05:52 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, whenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter) {
|
2023-11-30 08:32:25 +00:00
|
|
|
EXPECT_FALSE(debugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
2023-08-30 14:23:02 +00:00
|
|
|
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
|
|
|
|
|
|
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getProductHelper();
|
|
|
|
|
|
|
|
|
|
auto state = FamilyType::cmdInitSamplerState;
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
|
|
|
|
productHelper.adjustSamplerState(&state, *defaultHwInfo);
|
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-21 11:05:52 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenMiStoreRegisterMemWhenEncodeAndIsBcsThenRegisterOffsetsBcs0Base) {
|
2024-09-09 17:09:52 +00:00
|
|
|
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
|
|
|
|
|
|
|
|
|
|
uint64_t baseAddr = 0x10;
|
|
|
|
|
uint32_t offset = 0x2000;
|
|
|
|
|
|
|
|
|
|
constexpr size_t bufferSize = 2100;
|
|
|
|
|
uint8_t buffer[bufferSize];
|
|
|
|
|
LinearStream cmdStream(buffer, bufferSize);
|
|
|
|
|
auto buf = cmdStream.getSpaceForCmd<MI_STORE_REGISTER_MEM>();
|
|
|
|
|
|
|
|
|
|
bool isBcs = true;
|
|
|
|
|
EncodeStoreMMIO<FamilyType>::encode(buf, offset, baseAddr, true, isBcs);
|
|
|
|
|
auto storeRegMem = genCmdCast<MI_STORE_REGISTER_MEM *>(buffer);
|
|
|
|
|
ASSERT_NE(nullptr, storeRegMem);
|
|
|
|
|
EXPECT_EQ(storeRegMem->getRegisterAddress(), RegisterOffsets::bcs0Base + offset);
|
|
|
|
|
|
|
|
|
|
isBcs = false;
|
|
|
|
|
EncodeStoreMMIO<FamilyType>::encode(buf, offset, baseAddr, true, isBcs);
|
|
|
|
|
storeRegMem = genCmdCast<MI_STORE_REGISTER_MEM *>(buffer);
|
|
|
|
|
ASSERT_NE(nullptr, storeRegMem);
|
|
|
|
|
EXPECT_EQ(storeRegMem->getRegisterAddress(), offset);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-21 11:05:52 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenMiLoadRegisterMemWhenEncodememAndIsBcsThenRegisterOffsetsBcs0Base) {
|
2024-09-09 17:09:52 +00:00
|
|
|
using MI_LOAD_REGISTER_MEM = typename FamilyType::MI_LOAD_REGISTER_MEM;
|
|
|
|
|
|
|
|
|
|
uint64_t baseAddr = 0x10;
|
|
|
|
|
uint32_t offset = 0x2000;
|
|
|
|
|
|
|
|
|
|
constexpr size_t bufferSize = 2100;
|
|
|
|
|
uint8_t buffer[bufferSize];
|
|
|
|
|
LinearStream cmdStream(buffer, bufferSize);
|
|
|
|
|
uint8_t *ptr = buffer;
|
|
|
|
|
bool isBcs = true;
|
|
|
|
|
|
|
|
|
|
EncodeSetMMIO<FamilyType>::encodeMEM(cmdStream, offset, baseAddr, isBcs);
|
|
|
|
|
auto loadRegMem = genCmdCast<MI_LOAD_REGISTER_MEM *>(ptr);
|
|
|
|
|
ASSERT_NE(nullptr, loadRegMem);
|
|
|
|
|
EXPECT_EQ(loadRegMem->getRegisterAddress(), RegisterOffsets::bcs0Base + offset);
|
|
|
|
|
|
|
|
|
|
isBcs = false;
|
|
|
|
|
ptr += sizeof(MI_LOAD_REGISTER_MEM);
|
|
|
|
|
EncodeSetMMIO<FamilyType>::encodeMEM(cmdStream, offset, baseAddr, isBcs);
|
|
|
|
|
loadRegMem = genCmdCast<MI_LOAD_REGISTER_MEM *>(ptr);
|
|
|
|
|
ASSERT_NE(nullptr, loadRegMem);
|
|
|
|
|
EXPECT_EQ(loadRegMem->getRegisterAddress(), offset);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-21 11:05:52 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenMiLoadRegisterRegwhenencoderegAndIsBcsThenRegisterOffsetsBcs0Base) {
|
2024-09-09 17:09:52 +00:00
|
|
|
using MI_LOAD_REGISTER_REG = typename FamilyType::MI_LOAD_REGISTER_REG;
|
|
|
|
|
|
|
|
|
|
uint32_t srcOffset = 0x2000;
|
|
|
|
|
uint32_t dstOffset = 0x2004;
|
|
|
|
|
|
|
|
|
|
constexpr size_t bufferSize = 2100;
|
|
|
|
|
uint8_t buffer[bufferSize];
|
|
|
|
|
LinearStream cmdStream(buffer, bufferSize);
|
|
|
|
|
uint8_t *ptr = buffer;
|
|
|
|
|
bool isBcs = true;
|
|
|
|
|
|
|
|
|
|
EncodeSetMMIO<FamilyType>::encodeREG(cmdStream, dstOffset, srcOffset, isBcs);
|
|
|
|
|
auto storeRegReg = genCmdCast<MI_LOAD_REGISTER_REG *>(buffer);
|
|
|
|
|
ASSERT_NE(nullptr, storeRegReg);
|
|
|
|
|
EXPECT_EQ(storeRegReg->getSourceRegisterAddress(), RegisterOffsets::bcs0Base + srcOffset);
|
|
|
|
|
EXPECT_EQ(storeRegReg->getDestinationRegisterAddress(), RegisterOffsets::bcs0Base + dstOffset);
|
|
|
|
|
|
|
|
|
|
isBcs = false;
|
|
|
|
|
ptr += sizeof(MI_LOAD_REGISTER_REG);
|
|
|
|
|
EncodeSetMMIO<FamilyType>::encodeREG(cmdStream, dstOffset, srcOffset, isBcs);
|
|
|
|
|
storeRegReg = genCmdCast<MI_LOAD_REGISTER_REG *>(ptr);
|
|
|
|
|
EXPECT_EQ(storeRegReg->getSourceRegisterAddress(), srcOffset);
|
|
|
|
|
EXPECT_EQ(storeRegReg->getDestinationRegisterAddress(), dstOffset);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-21 11:05:52 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, whenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter) {
|
2023-08-30 14:23:02 +00:00
|
|
|
|
|
|
|
|
DebugManagerStateRestore dbgRestore;
|
2023-11-30 08:32:25 +00:00
|
|
|
debugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
|
|
|
|
|
EXPECT_TRUE(debugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
2023-08-30 14:23:02 +00:00
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
|
|
|
|
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getProductHelper();
|
|
|
|
|
|
|
|
|
|
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
|
|
|
|
|
|
|
|
|
auto state = FamilyType::cmdInitSamplerState;
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
|
|
|
|
productHelper.adjustSamplerState(&state, *defaultHwInfo);
|
|
|
|
|
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
|
2023-12-22 15:59:55 +00:00
|
|
|
}
|
|
|
|
|
|
2025-11-21 11:05:52 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenSdiCommandWhenProgrammingThenForceWriteCompletionCheck) {
|
2024-04-24 10:13:00 +00:00
|
|
|
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
|
|
|
|
|
|
|
|
|
|
constexpr size_t bufferSize = sizeof(MI_STORE_DATA_IMM);
|
|
|
|
|
uint8_t buffer[bufferSize];
|
|
|
|
|
LinearStream cmdStream(buffer, bufferSize);
|
|
|
|
|
|
|
|
|
|
EncodeStoreMemory<FamilyType>::programStoreDataImm(cmdStream, 0, 0, 0, false, false, nullptr);
|
|
|
|
|
|
|
|
|
|
auto storeDataImm = genCmdCast<MI_STORE_DATA_IMM *>(buffer);
|
|
|
|
|
ASSERT_NE(nullptr, storeDataImm);
|
|
|
|
|
EXPECT_TRUE(storeDataImm->getForceWriteCompletionCheck());
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-17 11:32:35 +00:00
|
|
|
HWTEST2_F(CommandEncoderTests, whenAskingForImplicitScalingValuesThenAlwaysReturnStubs, IsGen12LP) {
|
2023-12-22 15:59:55 +00:00
|
|
|
using WalkerType = typename FamilyType::DefaultWalkerType;
|
|
|
|
|
|
|
|
|
|
MockExecutionEnvironment executionEnvironment{};
|
2024-11-25 12:02:39 +00:00
|
|
|
executionEnvironment.incRefInternal();
|
2023-12-22 15:59:55 +00:00
|
|
|
auto rootExecEnv = executionEnvironment.rootDeviceEnvironments[0].get();
|
|
|
|
|
|
|
|
|
|
uint8_t buffer[128] = {};
|
|
|
|
|
LinearStream linearStream(buffer, sizeof(buffer));
|
|
|
|
|
|
|
|
|
|
WalkerType walkerCmd = {};
|
|
|
|
|
|
|
|
|
|
DeviceBitfield deviceBitField = 1;
|
|
|
|
|
uint32_t partitionCount = 1;
|
|
|
|
|
|
|
|
|
|
Vec3<size_t> vec3 = {1, 1, 1};
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::template getSize<WalkerType>(false, false, deviceBitField, vec3, vec3));
|
|
|
|
|
|
|
|
|
|
void *ptr = nullptr;
|
2024-07-29 13:37:30 +00:00
|
|
|
|
2024-11-25 12:02:39 +00:00
|
|
|
auto device = std::make_unique<MockDevice>(&executionEnvironment, 0);
|
|
|
|
|
|
2024-07-29 13:37:30 +00:00
|
|
|
ImplicitScalingDispatchCommandArgs args{
|
|
|
|
|
0, // workPartitionAllocationGpuVa
|
2024-11-25 12:02:39 +00:00
|
|
|
device.get(), // device
|
2024-07-29 13:37:30 +00:00
|
|
|
&ptr, // outWalkerPtr
|
|
|
|
|
RequiredPartitionDim::x, // requiredPartitionDim
|
|
|
|
|
partitionCount, // partitionCount
|
2025-01-17 15:03:50 +00:00
|
|
|
1, // workgroupSize
|
|
|
|
|
1, // threadGroupCount
|
|
|
|
|
1, // maxWgCountPerTile
|
2024-07-29 13:37:30 +00:00
|
|
|
false, // useSecondaryBatchBuffer
|
|
|
|
|
false, // apiSelfCleanup
|
|
|
|
|
false, // dcFlush
|
|
|
|
|
false, // forceExecutionOnSingleTile
|
2025-01-17 15:03:50 +00:00
|
|
|
false, // blockDispatchToCommandBuffer
|
|
|
|
|
false}; // isRequiredDispatchWorkGroupOrder
|
2024-07-29 13:37:30 +00:00
|
|
|
|
|
|
|
|
ImplicitScalingDispatch<FamilyType>::dispatchCommands(linearStream, walkerCmd, deviceBitField, args);
|
2023-12-22 15:59:55 +00:00
|
|
|
EXPECT_EQ(0u, linearStream.getUsed());
|
|
|
|
|
|
|
|
|
|
EXPECT_TRUE(ImplicitScalingDispatch<FamilyType>::getPipeControlStallRequired());
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::getBarrierSize(*rootExecEnv, false, false));
|
|
|
|
|
|
|
|
|
|
PipeControlArgs pcArgs = {};
|
|
|
|
|
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(linearStream, deviceBitField, pcArgs, *rootExecEnv, 0, 0, false, false);
|
|
|
|
|
EXPECT_EQ(0u, linearStream.getUsed());
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::getRegisterConfigurationSize());
|
|
|
|
|
|
2024-04-19 14:20:27 +00:00
|
|
|
ImplicitScalingDispatch<FamilyType>::dispatchRegisterConfiguration(linearStream, 0, 0, false);
|
2023-12-22 15:59:55 +00:00
|
|
|
EXPECT_EQ(0u, linearStream.getUsed());
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::getOffsetRegisterSize());
|
|
|
|
|
|
2024-04-19 14:20:27 +00:00
|
|
|
ImplicitScalingDispatch<FamilyType>::dispatchOffsetRegister(linearStream, 0, 0);
|
2023-12-22 15:59:55 +00:00
|
|
|
EXPECT_EQ(0u, linearStream.getUsed());
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(static_cast<uint32_t>(sizeof(uint64_t)), ImplicitScalingDispatch<FamilyType>::getImmediateWritePostSyncOffset());
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(static_cast<uint32_t>(GfxCoreHelperHw<FamilyType>::getSingleTimestampPacketSizeHw()), ImplicitScalingDispatch<FamilyType>::getTimeStampPostSyncOffset());
|
|
|
|
|
|
|
|
|
|
EXPECT_FALSE(ImplicitScalingDispatch<FamilyType>::platformSupportsImplicitScaling(*rootExecEnv));
|
2024-05-15 10:25:49 +00:00
|
|
|
}
|
|
|
|
|
|
2025-02-25 14:11:01 +00:00
|
|
|
HWTEST2_F(CommandEncoderTests, givenInterfaceDescriptorWhenEncodeEuSchedulingPolicyIsCalledThenChanged, IsAtLeastXe3Core) {
|
2025-03-18 00:28:35 +00:00
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename EncodeDispatchKernel<FamilyType>::INTERFACE_DESCRIPTOR_DATA;
|
2025-02-25 14:11:01 +00:00
|
|
|
|
2025-03-18 00:28:35 +00:00
|
|
|
auto idd = FamilyType::template getInitInterfaceDescriptor<INTERFACE_DESCRIPTOR_DATA>();
|
2025-02-25 14:11:01 +00:00
|
|
|
|
|
|
|
|
KernelDescriptor kernelDescriptor;
|
|
|
|
|
kernelDescriptor.kernelAttributes.threadArbitrationPolicy = ThreadArbitrationPolicy::AgeBased;
|
|
|
|
|
int32_t defaultPipelinedThreadArbitrationPolicy = ThreadArbitrationPolicy::RoundRobin;
|
|
|
|
|
EncodeDispatchKernel<FamilyType>::encodeEuSchedulingPolicy(&idd, kernelDescriptor, defaultPipelinedThreadArbitrationPolicy);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(idd.getEuThreadSchedulingModeOverride(), INTERFACE_DESCRIPTOR_DATA::EU_THREAD_SCHEDULING_MODE_OVERRIDE::EU_THREAD_SCHEDULING_MODE_OVERRIDE_OLDEST_FIRST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HWTEST2_F(CommandEncoderTests, givenInterfaceDescriptorWhenEncodeEuSchedulingPolicyIsCalledThenNothingIsChanged, IsAtMostXe2HpgCore) {
|
2025-02-13 16:59:36 +00:00
|
|
|
|
2024-05-15 10:25:49 +00:00
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
|
|
|
|
|
|
|
|
|
INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData;
|
|
|
|
|
auto expectedIdd = idd;
|
|
|
|
|
|
|
|
|
|
KernelDescriptor kernelDescriptor;
|
|
|
|
|
kernelDescriptor.kernelAttributes.threadArbitrationPolicy = ThreadArbitrationPolicy::AgeBased;
|
2024-05-20 10:35:21 +00:00
|
|
|
int32_t defaultPipelinedThreadArbitrationPolicy = ThreadArbitrationPolicy::RoundRobin;
|
|
|
|
|
EncodeDispatchKernel<FamilyType>::encodeEuSchedulingPolicy(&idd, kernelDescriptor, defaultPipelinedThreadArbitrationPolicy);
|
2024-05-15 10:25:49 +00:00
|
|
|
|
|
|
|
|
constexpr uint32_t iddSizeInDW = 8;
|
|
|
|
|
for (uint32_t i = 0u; i < iddSizeInDW; i++) {
|
|
|
|
|
EXPECT_EQ(expectedIdd.getRawData(i), idd.getRawData(i));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-18 11:03:36 +00:00
|
|
|
|
2025-11-14 02:26:46 +00:00
|
|
|
HWTEST_F(CommandEncoderTests, givenInOrderExecInfoWhenAggregatedEventUsageCounterIsUsedThenVerifyCorrectBehavior) {
|
|
|
|
|
MockDevice mockDevice;
|
|
|
|
|
|
|
|
|
|
uint64_t counterValue = 20;
|
|
|
|
|
uint64_t *hostAddress = &counterValue;
|
|
|
|
|
uint64_t gpuAddress = castToUint64(ptrOffset(&counterValue, 64));
|
|
|
|
|
|
|
|
|
|
MockGraphicsAllocation deviceAlloc(nullptr, gpuAddress, 1);
|
|
|
|
|
|
|
|
|
|
auto inOrderExecInfo = InOrderExecInfo::createFromExternalAllocation(mockDevice, &deviceAlloc, gpuAddress, nullptr, hostAddress, counterValue, 1, 1);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo->getAggregatedEventUsageCounter());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->addAggregatedEventUsageCounter(5);
|
|
|
|
|
EXPECT_EQ(5u, inOrderExecInfo->getAggregatedEventUsageCounter());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->addAggregatedEventUsageCounter(10);
|
|
|
|
|
EXPECT_EQ(15u, inOrderExecInfo->getAggregatedEventUsageCounter());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->resetAggregatedEventUsageCounter();
|
|
|
|
|
EXPECT_EQ(0u, inOrderExecInfo->getAggregatedEventUsageCounter());
|
|
|
|
|
|
|
|
|
|
inOrderExecInfo->addAggregatedEventUsageCounter(7);
|
|
|
|
|
EXPECT_EQ(7u, inOrderExecInfo->getAggregatedEventUsageCounter());
|
|
|
|
|
}
|
2025-12-03 17:12:39 +00:00
|
|
|
|
|
|
|
|
HWTEST_F(CommandEncoderTests, givenMiSemaphoreWaitCommandWhenSettingSemaphoreValueThenValueIsSet) {
|
|
|
|
|
auto semaphoreCmd = FamilyType::cmdInitMiSemaphoreWait;
|
|
|
|
|
const uint32_t testValue = 0x12345678ul;
|
|
|
|
|
|
|
|
|
|
EncodeSemaphore<FamilyType>::setMiSemaphoreWaitValue(reinterpret_cast<void *>(&semaphoreCmd), testValue);
|
|
|
|
|
EXPECT_EQ(testValue, semaphoreCmd.getSemaphoreDataDword());
|
|
|
|
|
}
|