mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 00:59:38 +08:00
Move command stream tests to shared
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2647d563c7
commit
1df68ad71f
@@ -6,11 +6,6 @@
|
||||
|
||||
set(IGDRCL_SRCS_tests_command_stream
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_command_stream_receiver_1_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_command_stream_receiver_2_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_command_stream_receiver_3_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_file_stream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_subcapture_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_command_stream_receiver_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cl_tbx_command_stream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmd_parse_tests.cpp
|
||||
@@ -26,13 +21,11 @@ set(IGDRCL_SRCS_tests_command_stream
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_flush_task_4_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_flush_task_gmock_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_with_aub_dump_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/create_command_stream_receiver_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/get_devices_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/experimental_command_buffer_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_ocl_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/submissions_aggregator_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread_arbitration_policy_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/thread_arbitration_policy_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests.h
|
||||
@@ -40,12 +33,9 @@ set(IGDRCL_SRCS_tests_command_stream
|
||||
|
||||
if(TESTS_XEHP_AND_LATER)
|
||||
list(APPEND IGDRCL_SRCS_tests_command_stream
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_command_stream_receiver_tests_xehp_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_flush_task_tests_xehp_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_xehp_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw_tests_xehp_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_xehp_and_later.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tbx_command_stream_receiver_tests_xehp_and_later.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,579 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub_mem_dump/aub_alloc_dump.h"
|
||||
#include "shared/source/helpers/hardware_context_controller.h"
|
||||
#include "shared/test/common/fixtures/aub_command_stream_receiver_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/mocks/mock_aub_csr.h"
|
||||
#include "shared/test/common/mocks/mock_aub_manager.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_os_context.h"
|
||||
#include "shared/test/common/mocks/mock_svm_manager.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using AubCsrTest = ::testing::Test;
|
||||
|
||||
HWTEST_F(AubCsrTest, givenLocalMemoryEnabledWhenGettingAddressSpaceForRingDataTypeThenTraceLocalIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
|
||||
std::unique_ptr<ExecutionEnvironment> executionEnvironment(new ExecutionEnvironment);
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
uint32_t rootDeviceIndex = 0u;
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(&hwInfo);
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->aubCenter.reset(new AubCenter());
|
||||
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
|
||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>("", false, *executionEnvironment, rootDeviceIndex, deviceBitfield));
|
||||
|
||||
int types[] = {AubMemDump::DataTypeHintValues::TraceLogicalRingContextRcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextCcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextBcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVecs,
|
||||
AubMemDump::DataTypeHintValues::TraceCommandBuffer};
|
||||
|
||||
for (uint32_t i = 0; i < 6; i++) {
|
||||
auto addressSpace = aubCsr->getAddressSpace(types[i]);
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
auto addressSpace = aubCsr->getAddressSpace(AubMemDump::DataTypeHintValues::TraceNotype);
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceNonlocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCsrTest, givenAUBDumpForceAllToLocalMemoryWhenGettingAddressSpaceForAnyDataTypeThenTraceLocalIsReturned) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(1);
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
|
||||
std::unique_ptr<ExecutionEnvironment> executionEnvironment(new ExecutionEnvironment);
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
uint32_t rootDeviceIndex = 0u;
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(&hwInfo);
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->aubCenter.reset(new AubCenter());
|
||||
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
|
||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>("", false, *executionEnvironment, rootDeviceIndex, deviceBitfield));
|
||||
|
||||
int types[] = {AubMemDump::DataTypeHintValues::TraceLogicalRingContextRcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextCcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextBcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVecs,
|
||||
AubMemDump::DataTypeHintValues::TraceCommandBuffer};
|
||||
|
||||
for (uint32_t i = 0; i < 6; i++) {
|
||||
auto addressSpace = aubCsr->getAddressSpace(types[i]);
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
auto addressSpace = aubCsr->getAddressSpace(AubMemDump::DataTypeHintValues::TraceNotype);
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCsrTest, WhenWriteWithAubManagerIsCalledThenAubManagerIsInvokedWithCorrectHint) {
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
|
||||
std::unique_ptr<ExecutionEnvironment> executionEnvironment(new ExecutionEnvironment);
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
uint32_t rootDeviceIndex = 0u;
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(&hwInfo);
|
||||
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->aubCenter.reset(new AubCenter());
|
||||
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
auto allocation = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::COMMAND_BUFFER});
|
||||
|
||||
MockAubManager aubManager;
|
||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>("", false, *executionEnvironment, rootDeviceIndex, deviceBitfield));
|
||||
aubCsr->aubManager = &aubManager;
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(aubCsr.get(),
|
||||
EngineDescriptorHelper::getDefaultDescriptor({getChosenEngineType(hwInfo), EngineUsage::Regular},
|
||||
PreemptionHelper::getDefaultPreemptionMode(hwInfo)));
|
||||
aubCsr->setupContext(*osContext);
|
||||
|
||||
aubCsr->writeMemoryWithAubManager(*allocation);
|
||||
EXPECT_TRUE(aubManager.writeMemory2Called);
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceBatchBuffer, aubManager.hintToWriteMemory);
|
||||
|
||||
aubManager.writeMemory2Called = false;
|
||||
|
||||
auto allocation2 = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::LINEAR_STREAM});
|
||||
|
||||
aubCsr->writeMemoryWithAubManager(*allocation2);
|
||||
EXPECT_TRUE(aubManager.writeMemory2Called);
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, aubManager.hintToWriteMemory);
|
||||
|
||||
executionEnvironment->memoryManager->freeGraphicsMemory(allocation);
|
||||
executionEnvironment->memoryManager->freeGraphicsMemory(allocation2);
|
||||
}
|
||||
|
||||
using HardwareContextContainerTests = ::testing::Test;
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupportedThenInitialzeHwContextsWithValidIndexes) {
|
||||
MockAubManager aubManager;
|
||||
MockOsContext osContext(1, EngineDescriptorHelper::getDefaultDescriptor(0b11));
|
||||
|
||||
HardwareContextController hwContextControler(aubManager, osContext, 0);
|
||||
EXPECT_EQ(2u, hwContextControler.hardwareContexts.size());
|
||||
EXPECT_EQ(2u, osContext.getNumSupportedDevices());
|
||||
auto mockHwContext0 = static_cast<MockHardwareContext *>(hwContextControler.hardwareContexts[0].get());
|
||||
auto mockHwContext1 = static_cast<MockHardwareContext *>(hwContextControler.hardwareContexts[1].get());
|
||||
EXPECT_EQ(0u, mockHwContext0->deviceIndex);
|
||||
EXPECT_EQ(1u, mockHwContext1->deviceIndex);
|
||||
}
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCalledOnHwContextControllerThenSubmitIsCalled) {
|
||||
MockAubManager aubManager;
|
||||
MockOsContext osContext(1, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
HardwareContextController hwContextContainer(aubManager, osContext, 0);
|
||||
EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size());
|
||||
|
||||
auto mockHwContext0 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[0].get());
|
||||
|
||||
EXPECT_FALSE(mockHwContext0->writeAndSubmitCalled);
|
||||
EXPECT_FALSE(mockHwContext0->writeMemory2Called);
|
||||
|
||||
hwContextContainer.submit(1, reinterpret_cast<const void *>(0x123), 2, 0, 1, false);
|
||||
|
||||
EXPECT_TRUE(mockHwContext0->submitCalled);
|
||||
EXPECT_FALSE(mockHwContext0->writeAndSubmitCalled);
|
||||
EXPECT_FALSE(mockHwContext0->writeMemory2Called);
|
||||
}
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalledThenWholeMemoryBanksArePassed) {
|
||||
MockAubManager aubManager;
|
||||
MockOsContext osContext(1, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
HardwareContextController hwContextContainer(aubManager, osContext, 0);
|
||||
EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size());
|
||||
|
||||
auto mockHwContext0 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[0].get());
|
||||
|
||||
aub_stream::AllocationParams params(1, reinterpret_cast<const void *>(0x123), 2, 3u, 4, 5);
|
||||
hwContextContainer.writeMemory(params);
|
||||
|
||||
EXPECT_TRUE(mockHwContext0->writeMemory2Called);
|
||||
EXPECT_EQ(3u, mockHwContext0->memoryBanksPassed);
|
||||
}
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseAllContexts) {
|
||||
MockAubManager aubManager;
|
||||
MockOsContext osContext(1, EngineDescriptorHelper::getDefaultDescriptor(0b11));
|
||||
HardwareContextController hwContextContainer(aubManager, osContext, 0);
|
||||
EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size());
|
||||
|
||||
auto mockHwContext0 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[0].get());
|
||||
auto mockHwContext1 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[1].get());
|
||||
|
||||
EXPECT_FALSE(mockHwContext0->initializeCalled);
|
||||
EXPECT_FALSE(mockHwContext1->initializeCalled);
|
||||
EXPECT_FALSE(mockHwContext0->pollForCompletionCalled);
|
||||
EXPECT_FALSE(mockHwContext1->pollForCompletionCalled);
|
||||
EXPECT_FALSE(mockHwContext0->expectMemoryCalled);
|
||||
EXPECT_FALSE(mockHwContext1->expectMemoryCalled);
|
||||
EXPECT_FALSE(mockHwContext0->submitCalled);
|
||||
EXPECT_FALSE(mockHwContext1->submitCalled);
|
||||
EXPECT_FALSE(mockHwContext0->writeMemory2Called);
|
||||
EXPECT_FALSE(mockHwContext1->writeMemory2Called);
|
||||
|
||||
aub_stream::AllocationParams params(1, reinterpret_cast<const void *>(0x123), 2, 3u, 4, 5);
|
||||
|
||||
hwContextContainer.initialize();
|
||||
hwContextContainer.pollForCompletion();
|
||||
hwContextContainer.expectMemory(1, reinterpret_cast<const void *>(0x123), 2, 0);
|
||||
hwContextContainer.submit(1, reinterpret_cast<const void *>(0x123), 2, 0, 1, false);
|
||||
hwContextContainer.writeMemory(params);
|
||||
|
||||
EXPECT_TRUE(mockHwContext0->initializeCalled);
|
||||
EXPECT_TRUE(mockHwContext1->initializeCalled);
|
||||
EXPECT_TRUE(mockHwContext0->pollForCompletionCalled);
|
||||
EXPECT_TRUE(mockHwContext1->pollForCompletionCalled);
|
||||
EXPECT_TRUE(mockHwContext0->expectMemoryCalled);
|
||||
EXPECT_TRUE(mockHwContext1->expectMemoryCalled);
|
||||
EXPECT_TRUE(mockHwContext0->submitCalled);
|
||||
EXPECT_TRUE(mockHwContext1->submitCalled);
|
||||
EXPECT_TRUE(mockHwContext0->writeMemory2Called);
|
||||
EXPECT_TRUE(mockHwContext1->writeMemory2Called);
|
||||
EXPECT_EQ(1u, mockHwContext0->memoryBanksPassed);
|
||||
EXPECT_EQ(2u, mockHwContext1->memoryBanksPassed);
|
||||
}
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenHwContextWhenWriteMMIOIsCalledThenUseFirstContext) {
|
||||
MockAubManager aubManager;
|
||||
MockOsContext osContext(1, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
HardwareContextController hwContextContainer(aubManager, osContext, 0);
|
||||
EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size());
|
||||
|
||||
auto mockHwContext = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[0].get());
|
||||
|
||||
EXPECT_FALSE(mockHwContext->writeMMIOCalled);
|
||||
|
||||
hwContextContainer.writeMMIO(0x01234567, 0x89ABCDEF);
|
||||
|
||||
EXPECT_TRUE(mockHwContext->writeMMIOCalled);
|
||||
}
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseFirstContext) {
|
||||
MockAubManager aubManager;
|
||||
MockOsContext osContext(1, EngineDescriptorHelper::getDefaultDescriptor(0b11));
|
||||
HardwareContextController hwContextContainer(aubManager, osContext, 0);
|
||||
EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size());
|
||||
|
||||
auto mockHwContext0 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[0].get());
|
||||
auto mockHwContext1 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[1].get());
|
||||
|
||||
EXPECT_FALSE(mockHwContext0->dumpBufferBINCalled);
|
||||
EXPECT_FALSE(mockHwContext1->dumpBufferBINCalled);
|
||||
EXPECT_FALSE(mockHwContext0->dumpSurfaceCalled);
|
||||
EXPECT_FALSE(mockHwContext1->dumpSurfaceCalled);
|
||||
EXPECT_FALSE(mockHwContext0->readMemoryCalled);
|
||||
EXPECT_FALSE(mockHwContext1->readMemoryCalled);
|
||||
|
||||
hwContextContainer.dumpBufferBIN(1, 2);
|
||||
hwContextContainer.dumpSurface({1, 2, 3, 4, 5, 6, 7, false, 0});
|
||||
hwContextContainer.readMemory(1, reinterpret_cast<void *>(0x123), 1, 2, 0);
|
||||
|
||||
EXPECT_TRUE(mockHwContext0->dumpBufferBINCalled);
|
||||
EXPECT_FALSE(mockHwContext1->dumpBufferBINCalled);
|
||||
EXPECT_TRUE(mockHwContext0->dumpSurfaceCalled);
|
||||
EXPECT_FALSE(mockHwContext1->dumpSurfaceCalled);
|
||||
EXPECT_TRUE(mockHwContext0->readMemoryCalled);
|
||||
EXPECT_FALSE(mockHwContext1->readMemoryCalled);
|
||||
}
|
||||
|
||||
using AubCommandStreamReceiverTests = Test<AubCommandStreamReceiverFixture>;
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpAllocationIsCalledAndDumpFormatIsSpecifiedThenGraphicsAllocationShouldBeDumped) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(mockHardwareContext->dumpSurfaceCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenBcsEngineWhenDumpAllocationCalledThenIgnore) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::Regular}));
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritableWhenDumpAllocationIsCalledAndDumpFormatIsSpecifiedThenGraphicsAllocationShouldBeDumped) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("TRE");
|
||||
|
||||
auto gmmHelper = pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(defaultHwInfo.get(), *gmmHelper, false, "aubfile", CommandStreamReceiverType::CSR_AUB);
|
||||
mockAubCenter->aubManager = std::make_unique<MockAubManager>();
|
||||
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
AllocationProperties properties(pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield());
|
||||
properties.flags.preferCompressed = true;
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(mockHardwareContext->dumpSurfaceCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpAllocationIsCalledButDumpFormatIsNotSpecifiedThenGraphicsAllocationShouldNotBeDumped) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDumpAllocationIsCalledAndFormatIsSpecifiedThenGraphicsAllocationShouldNotBeDumped) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(false);
|
||||
EXPECT_FALSE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDumpAllocationIsCalledAndAUBDumpAllocsOnEnqueueReadOnlyIsSetThenGraphicsAllocationShouldNotBeDumpedAndRemainNonDumpable) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpAllocsOnEnqueueReadOnly.set(true);
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
gfxAllocation->setAllocDumpable(false, false);
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_FALSE(gfxAllocation->isAllocDumpable());
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpAllocationIsCalledAndAUBDumpAllocsOnEnqueueReadOnlyIsOnThenGraphicsAllocationShouldBeDumpedAndMarkedNonDumpable) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpAllocsOnEnqueueReadOnly.set(true);
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
|
||||
auto &csrOsContext = aubCsr.getOsContext();
|
||||
|
||||
{
|
||||
// Non-BCS engine, BCS dump
|
||||
EXPECT_FALSE(EngineHelpers::isBcs(csrOsContext.getEngineType()));
|
||||
gfxAllocation->setAllocDumpable(true, true);
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(gfxAllocation->isAllocDumpable());
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
}
|
||||
|
||||
{
|
||||
// Non-BCS engine, Non-BCS dump
|
||||
EXPECT_FALSE(EngineHelpers::isBcs(csrOsContext.getEngineType()));
|
||||
gfxAllocation->setAllocDumpable(true, false);
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_FALSE(gfxAllocation->isAllocDumpable());
|
||||
EXPECT_TRUE(mockHardwareContext->dumpSurfaceCalled);
|
||||
mockHardwareContext->dumpSurfaceCalled = false;
|
||||
}
|
||||
|
||||
{
|
||||
// BCS engine, Non-BCS dump
|
||||
csrOsContext.getEngineType() = aub_stream::EngineType::ENGINE_BCS;
|
||||
EXPECT_TRUE(EngineHelpers::isBcs(csrOsContext.getEngineType()));
|
||||
gfxAllocation->setAllocDumpable(true, false);
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(gfxAllocation->isAllocDumpable());
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
}
|
||||
|
||||
{
|
||||
// BCS engine, BCS dump
|
||||
csrOsContext.getEngineType() = aub_stream::EngineType::ENGINE_BCS;
|
||||
EXPECT_TRUE(EngineHelpers::isBcs(csrOsContext.getEngineType()));
|
||||
gfxAllocation->setAllocDumpable(true, true);
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_FALSE(gfxAllocation->isAllocDumpable());
|
||||
EXPECT_TRUE(mockHardwareContext->dumpSurfaceCalled);
|
||||
}
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenDumpAllocationIsCalledAndAUBDumpAllocsOnEnqueueSVMMemcpyOnlyIsSetThenDumpableFlagShouldBeRespected) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpAllocsOnEnqueueSVMMemcpyOnly.set(true);
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
gfxAllocation->setAllocDumpable(false, false);
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
|
||||
EXPECT_FALSE(gfxAllocation->isAllocDumpable());
|
||||
|
||||
gfxAllocation->setAllocDumpable(true, false);
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
EXPECT_FALSE(gfxAllocation->isAllocDumpable());
|
||||
EXPECT_TRUE(mockHardwareContext->dumpSurfaceCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpAllocationIsCalledAndDumpFormatIsSpecifiedThenPollForCompletionShouldBeCalledBeforeGraphicsAllocationIsDumped) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
aubCsr.latestSentTaskCount = 1;
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = pDevice->getMemoryManager();
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER, pDevice->getDeviceBitfield()});
|
||||
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(mockHardwareContext->pollForCompletionCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCalledAndDumpFormatIsSpecifiedThenUsmAllocationIsDumped) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpBufferFormat.set("BIN");
|
||||
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
auto memoryManager = std::make_unique<MockMemoryManager>(false, true, *pDevice->executionEnvironment);
|
||||
auto svmManager = std::make_unique<MockSVMAllocsManager>(memoryManager.get(), false);
|
||||
|
||||
std::set<uint32_t> rootDeviceIndices{rootDeviceIndex};
|
||||
std::map<uint32_t, DeviceBitfield> deviceBitfields{{rootDeviceIndex, pDevice->getDeviceBitfield()}};
|
||||
|
||||
SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::DEVICE_UNIFIED_MEMORY, rootDeviceIndices, deviceBitfields);
|
||||
unifiedMemoryProperties.device = pDevice;
|
||||
auto ptr = svmManager->createUnifiedMemoryAllocation(4096, unifiedMemoryProperties);
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
|
||||
auto gfxAllocation = svmManager->getSVMAlloc(ptr)->gpuAllocations.getGraphicsAllocation(0);
|
||||
ASSERT_NE(nullptr, gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
|
||||
|
||||
aubCsr.dumpAllocation(*gfxAllocation);
|
||||
|
||||
EXPECT_TRUE(mockHardwareContext->dumpSurfaceCalled);
|
||||
|
||||
svmManager->freeSVMAlloc(ptr);
|
||||
}
|
||||
|
||||
using SimulatedCsrTest = ::testing::Test;
|
||||
HWTEST_F(SimulatedCsrTest, givenAubCsrTypeWhenCreateCommandStreamReceiverThenProperAubCenterIsInitalized) {
|
||||
uint32_t expectedRootDeviceIndex = 10;
|
||||
MockExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
executionEnvironment.prepareRootDeviceEnvironments(expectedRootDeviceIndex + 2);
|
||||
|
||||
auto rootDeviceEnvironment = new MockRootDeviceEnvironment(executionEnvironment);
|
||||
executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex].reset(rootDeviceEnvironment);
|
||||
rootDeviceEnvironment->setHwInfo(defaultHwInfo.get());
|
||||
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
EXPECT_FALSE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
auto csr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, executionEnvironment, expectedRootDeviceIndex, deviceBitfield);
|
||||
EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
}
|
||||
@@ -1,376 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub_mem_dump/page_table_entry_bits.h"
|
||||
#include "shared/source/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "shared/source/helpers/engine_node_helper.h"
|
||||
#include "shared/source/memory_manager/memory_banks.h"
|
||||
#include "shared/source/memory_manager/memory_pool.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/hw_helper_tests.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/libult/ult_aub_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_aub_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_os_context.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct XeHPAndLaterAubCommandStreamReceiverTests : DeviceFixture, ::testing::Test {
|
||||
template <typename FamilyType>
|
||||
void setUpImpl() {
|
||||
hardwareInfo = *defaultHwInfo;
|
||||
hardwareInfoSetup[hardwareInfo.platform.eProductFamily](&hardwareInfo, true, 0);
|
||||
hardwareInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
|
||||
DeviceFixture::SetUpImpl(&hardwareInfo);
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FamilyType>
|
||||
class MockAubCsrXeHPAndLater : public AUBCommandStreamReceiverHw<FamilyType> {
|
||||
public:
|
||||
using AUBCommandStreamReceiverHw<FamilyType>::getAddressSpace;
|
||||
using CommandStreamReceiverHw<FamilyType>::localMemoryEnabled;
|
||||
using CommandStreamReceiverSimulatedHw<FamilyType>::createPhysicalAddressAllocator;
|
||||
|
||||
MockAubCsrXeHPAndLater(const std::string &fileName,
|
||||
bool standalone, ExecutionEnvironment &executionEnvironment,
|
||||
uint32_t rootDeviceIndex,
|
||||
const DeviceBitfield deviceBitfield)
|
||||
: AUBCommandStreamReceiverHw<FamilyType>(fileName, standalone, executionEnvironment, rootDeviceIndex, deviceBitfield) {}
|
||||
|
||||
uint32_t getDeviceIndex() const override {
|
||||
return deviceIndex;
|
||||
}
|
||||
|
||||
uint32_t deviceIndex = 0u;
|
||||
};
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetGUCWorkQueueItemHeaderIsCalledThenAppropriateValueDependingOnEngineTypeIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
MockOsContext rcsOsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}));
|
||||
MockOsContext ccs0OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::Regular}));
|
||||
MockOsContext ccs1OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS1, EngineUsage::Regular}));
|
||||
MockOsContext ccs2OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS2, EngineUsage::Regular}));
|
||||
MockOsContext ccs3OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS3, EngineUsage::Regular}));
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
|
||||
aubCsr->setupContext(ccs0OsContext);
|
||||
EXPECT_EQ(0x00030401u, aubCsr->getGUCWorkQueueItemHeader());
|
||||
aubCsr->setupContext(ccs1OsContext);
|
||||
EXPECT_EQ(0x00030401u, aubCsr->getGUCWorkQueueItemHeader());
|
||||
aubCsr->setupContext(ccs2OsContext);
|
||||
EXPECT_EQ(0x00030401u, aubCsr->getGUCWorkQueueItemHeader());
|
||||
aubCsr->setupContext(ccs3OsContext);
|
||||
EXPECT_EQ(0x00030401u, aubCsr->getGUCWorkQueueItemHeader());
|
||||
aubCsr->setupContext(rcsOsContext);
|
||||
EXPECT_EQ(0x00030001u, aubCsr->getGUCWorkQueueItemHeader());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenGraphicsAlloctionWithNonLocalMemoryPoolWhenGetPPGTTAdditionalBitsIsCalledThenAppropriateValueIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(false);
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
MockGraphicsAllocation allocation(nullptr, 0);
|
||||
auto bits = aubCsr->getPPGTTAdditionalBits(&allocation);
|
||||
|
||||
EXPECT_EQ(3u, bits);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenGraphicsAlloctionWithLocalMemoryPoolWhenGetPPGTTAdditionalBitsIsCalledThenAppropriateValueIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(false);
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
MockGraphicsAllocation allocation(nullptr, 0);
|
||||
allocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
auto bits = aubCsr->getPPGTTAdditionalBits(&allocation);
|
||||
|
||||
EXPECT_EQ(3u | (1 << 11), bits);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenAubDumpForceAllToLocalMemoryPoolWhenGetPPGTTAdditionalBitsIsCalledThenLocalBitIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true);
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
MockGraphicsAllocation allocation(nullptr, 0);
|
||||
|
||||
auto bits = aubCsr->getPPGTTAdditionalBits(&allocation);
|
||||
|
||||
EXPECT_EQ(3u | (1 << 11), bits);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenAubDumpForceAllToLocalMemoryEnabledWhenGetAddressSpaceIsCalledThenTraceLocalIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true);
|
||||
|
||||
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
|
||||
auto addressSpace = aubCsr->getAddressSpace(AubMemDump::DataTypeHintValues::TraceNotype);
|
||||
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenAubDumpForceAllToLocalMemoryDisabledWhenGetAddressSpaceIsCalledThenTraceNonlocalIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(false);
|
||||
|
||||
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
|
||||
auto addressSpace = aubCsr->getAddressSpace(AubMemDump::DataTypeHintValues::TraceNotype);
|
||||
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceNonlocal, addressSpace);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenCCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::Regular}));
|
||||
AUBCommandStreamReceiverHw<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr.stream = stream.get();
|
||||
|
||||
aubCsr.initEngineMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0xB234, 0xA0000000u)));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenRCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
AUBCommandStreamReceiverHw<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr.stream = stream.get();
|
||||
|
||||
aubCsr.initEngineMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0xB134, 0xA0000000u)));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenLocaLMemoryBitWhenGetAddressSpaceFromPTEBitsIsCalledThenTraceLocalIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
|
||||
uint64_t bits = BIT(PageTableEntry::presentBit) | BIT(PageTableEntry::writableBit) | BIT(PageTableEntry::localMemoryBit);
|
||||
auto addressSpace = aubCsr->getAddressSpaceFromPTEBits(bits);
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenLocalMemoryEnabledWhenGetMemoryBankForGttIsCalledThenCorrectBankForDeviceIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
aubCsr->localMemoryEnabled = true;
|
||||
|
||||
auto bank = aubCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(0), bank);
|
||||
|
||||
aubCsr->deviceIndex = 1u;
|
||||
bank = aubCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(1), bank);
|
||||
|
||||
aubCsr->deviceIndex = 2u;
|
||||
bank = aubCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(2), bank);
|
||||
|
||||
aubCsr->deviceIndex = 3u;
|
||||
bank = aubCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(3), bank);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, whenPhysicalAllocatorIsCreatedThenItHasCorrectBankSzieAndNumberOfBanks) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
|
||||
auto physicalAddressAllocator = std::unique_ptr<PhysicalAddressAllocator>(aubCsr->createPhysicalAddressAllocator(&pDevice->getHardwareInfo()));
|
||||
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator.get());
|
||||
|
||||
EXPECT_EQ(32 * MemoryConstants::gigaByte, allocator->getBankSize());
|
||||
EXPECT_EQ(1u, allocator->getNumberOfBanks());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, whenPhysicalAllocatorIsCreatedWith4TileConfigThenItHasCorrectBankSzieAndNumberOfBanks) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(4);
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(new MockAubCsrXeHPAndLater<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
|
||||
auto physicalAddressAllocator = std::unique_ptr<PhysicalAddressAllocator>(aubCsr->createPhysicalAddressAllocator(&pDevice->getHardwareInfo()));
|
||||
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator.get());
|
||||
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, allocator->getBankSize());
|
||||
EXPECT_EQ(4u, allocator->getNumberOfBanks());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenInitEngineMMIOIsCalledForGivenEngineTypeThenCorrespondingMmiosAreInitialized) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
MockOsContext rcsOsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular}));
|
||||
MockOsContext ccs0OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::Regular}));
|
||||
MockOsContext ccs1OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS1, EngineUsage::Regular}));
|
||||
MockOsContext ccs2OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS2, EngineUsage::Regular}));
|
||||
MockOsContext ccs3OsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS3, EngineUsage::Regular}));
|
||||
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
|
||||
auto stream = std::make_unique<MockAubFileStreamMockMmioWrite>();
|
||||
aubCsr->stream = stream.get();
|
||||
|
||||
aubCsr->setupContext(rcsOsContext);
|
||||
aubCsr->initEngineMMIO();
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0002000 + 0x000058, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0002000 + 0x00029c, 0xffff8280)));
|
||||
|
||||
aubCsr->setupContext(ccs0OsContext);
|
||||
aubCsr->initEngineMMIO();
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000ce90, 0x00030003)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x1a000 + 0x000029c, 0xffff8280)));
|
||||
|
||||
aubCsr->setupContext(ccs1OsContext);
|
||||
aubCsr->initEngineMMIO();
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000ce90, 0x00030003)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x1c000 + 0x000029c, 0xffff8280)));
|
||||
|
||||
aubCsr->setupContext(ccs2OsContext);
|
||||
aubCsr->initEngineMMIO();
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000ce90, 0x00030003)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x1e000 + 0x000029c, 0xffff8280)));
|
||||
|
||||
aubCsr->setupContext(ccs3OsContext);
|
||||
aubCsr->initEngineMMIO();
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000ce90, 0x00030003)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x26000 + 0x000029c, 0xffff8280)));
|
||||
}
|
||||
|
||||
template <class FamilyType>
|
||||
static void checkCcsEngineMMIO(aub_stream::EngineType engineType, uint32_t mmioBase) {
|
||||
auto &mmioList = *AUBFamilyMapper<FamilyType>::perEngineMMIO[engineType];
|
||||
|
||||
EXPECT_EQ(mmioList[0], MMIOPair(0x0000ce90, 0x00030003));
|
||||
EXPECT_EQ(mmioList[1], MMIOPair(0x0000b170, 0x00030003));
|
||||
EXPECT_EQ(mmioList[2], MMIOPair(0x00014800, 0xFFFF0001));
|
||||
EXPECT_EQ(mmioList[3], MMIOPair(mmioBase + 0x000029c, 0xffff8280));
|
||||
|
||||
EXPECT_EQ(mmioList[4], MMIOPair(mmioBase + 0x00004d0, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[5], MMIOPair(mmioBase + 0x00004d4, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[6], MMIOPair(mmioBase + 0x00004d8, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[7], MMIOPair(mmioBase + 0x00004dc, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[8], MMIOPair(mmioBase + 0x00004e0, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[9], MMIOPair(mmioBase + 0x00004e4, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[10], MMIOPair(mmioBase + 0x00004e8, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[11], MMIOPair(mmioBase + 0x00004ec, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[12], MMIOPair(mmioBase + 0x00004f0, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[13], MMIOPair(mmioBase + 0x00004f4, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[14], MMIOPair(mmioBase + 0x00004f8, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[15], MMIOPair(mmioBase + 0x00004fc, 0x0000e000));
|
||||
|
||||
EXPECT_EQ(mmioList[16], MMIOPair(0x0000B234, 0xA0000000));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenCcsEngineMmioListForSpecificCcsInstanceIsReadThenItIsInitializedWithProperValues) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
checkCcsEngineMMIO<FamilyType>(aub_stream::ENGINE_CCS, 0x1a000);
|
||||
checkCcsEngineMMIO<FamilyType>(aub_stream::ENGINE_CCS1, 0x1c000);
|
||||
checkCcsEngineMMIO<FamilyType>(aub_stream::ENGINE_CCS2, 0x1e000);
|
||||
checkCcsEngineMMIO<FamilyType>(aub_stream::ENGINE_CCS3, 0x26000);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenRcsEngineMmioListIsReadThenItIsInitializedWithProperValues) {
|
||||
setUpImpl<FamilyType>();
|
||||
|
||||
auto &mmioList = *AUBFamilyMapper<FamilyType>::perEngineMMIO[aub_stream::ENGINE_RCS];
|
||||
auto mmioBase = 0x002000;
|
||||
|
||||
EXPECT_EQ(mmioList[0], MMIOPair(mmioBase + 0x000058, 0x00000000));
|
||||
EXPECT_EQ(mmioList[1], MMIOPair(mmioBase + 0x0000a8, 0x00000000));
|
||||
EXPECT_EQ(mmioList[2], MMIOPair(mmioBase + 0x000029c, 0xffff8280));
|
||||
|
||||
EXPECT_EQ(mmioList[3], MMIOPair(0x00002090, 0xffff0000));
|
||||
EXPECT_EQ(mmioList[4], MMIOPair(0x000020e0, 0xffff4000));
|
||||
EXPECT_EQ(mmioList[5], MMIOPair(0x000020e4, 0xffff0000));
|
||||
EXPECT_EQ(mmioList[6], MMIOPair(0x000020ec, 0xffff0051));
|
||||
|
||||
EXPECT_EQ(mmioList[7], MMIOPair(mmioBase + 0x00004d0, 0x00007014));
|
||||
EXPECT_EQ(mmioList[8], MMIOPair(mmioBase + 0x00004d4, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[9], MMIOPair(mmioBase + 0x00004d8, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[10], MMIOPair(mmioBase + 0x00004dc, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[11], MMIOPair(mmioBase + 0x00004e0, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[12], MMIOPair(mmioBase + 0x00004e4, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[13], MMIOPair(mmioBase + 0x00004e8, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[14], MMIOPair(mmioBase + 0x00004ec, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[15], MMIOPair(mmioBase + 0x00004f0, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[16], MMIOPair(mmioBase + 0x00004f4, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[17], MMIOPair(mmioBase + 0x00004f8, 0x0000e000));
|
||||
EXPECT_EQ(mmioList[18], MMIOPair(mmioBase + 0x00004fc, 0x0000e000));
|
||||
|
||||
EXPECT_EQ(mmioList[19], MMIOPair(0x00002580, 0xffff0005));
|
||||
EXPECT_EQ(mmioList[20], MMIOPair(0x0000e194, 0xffff0002));
|
||||
|
||||
EXPECT_EQ(mmioList[21], MMIOPair(0x0000B134, 0xA0000000));
|
||||
}
|
||||
|
||||
using XeHPAndLaterAubCommandStreamReceiverTests2 = HwHelperTest;
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests2, givenLocalMemoryEnabledInCSRWhenGetGTTDataIsCalledThenLocalMemoryIsSet) {
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo));
|
||||
std::unique_ptr<MockAubCsrXeHPAndLater<FamilyType>> aubCsr(std::make_unique<MockAubCsrXeHPAndLater<FamilyType>>("", true, *device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield()));
|
||||
EXPECT_TRUE(aubCsr->localMemoryEnabled);
|
||||
|
||||
AubGTTData data = {false, false};
|
||||
aubCsr->getGTTData(nullptr, data);
|
||||
EXPECT_TRUE(data.localMemory);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,465 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub/aub_subcapture.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_aub_subcapture_manager.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct AubSubCaptureTest : public DeviceFixture,
|
||||
public ::testing::Test {
|
||||
void SetUp() override {
|
||||
DeviceFixture::SetUp();
|
||||
dbgRestore = new DebugManagerStateRestore();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
DeviceFixture::TearDown();
|
||||
delete dbgRestore;
|
||||
}
|
||||
static constexpr const char *kernelName = "kernel_name";
|
||||
DebugManagerStateRestore *dbgRestore;
|
||||
AubSubCaptureCommon subCaptureCommon;
|
||||
};
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureToggleCaptureOnOffIsUnspecifiedThenSubCaptureIsToggledOffByDefault) {
|
||||
struct AubSubCaptureManagerWithToggleActiveMock : public AubSubCaptureManager {
|
||||
using AubSubCaptureManager::AubSubCaptureManager;
|
||||
using AubSubCaptureManager::isSubCaptureToggleActive;
|
||||
} aubSubCaptureManagerWithToggleActiveMock("", subCaptureCommon, "");
|
||||
|
||||
EXPECT_FALSE(aubSubCaptureManagerWithToggleActiveMock.isSubCaptureToggleActive());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureToggleFileNameIsUnspecifiedThenEmptyToggleFileNameIsReturnedByDefault) {
|
||||
struct AubSubCaptureManagerWithToggleFileNameMock : public AubSubCaptureManager {
|
||||
using AubSubCaptureManager::AubSubCaptureManager;
|
||||
using AubSubCaptureManager::getToggleFileName;
|
||||
} aubSubCaptureManagerWithToggleFileNameMock("", subCaptureCommon, "");
|
||||
|
||||
EXPECT_STREQ("", aubSubCaptureManagerWithToggleFileNameMock.getToggleFileName().c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenAubCaptureFileNameIsUnspecifiedThenEmptyFileNameIsReturnedByDefault) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("file_name.aub", subCaptureCommon);
|
||||
|
||||
EXPECT_STREQ("", aubSubCaptureManager.getAubCaptureFileName().c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenItIsCreatedThenItIsInitializedWithDefaults) {
|
||||
std::string initialFileName = "initial_file_name.aub";
|
||||
AubSubCaptureManagerMock aubSubCaptureManager(initialFileName, subCaptureCommon);
|
||||
|
||||
EXPECT_EQ(AubSubCaptureCommon::SubCaptureMode::Off, subCaptureCommon.subCaptureMode);
|
||||
EXPECT_STREQ("", subCaptureCommon.subCaptureFilter.dumpKernelName.c_str());
|
||||
EXPECT_EQ(0u, subCaptureCommon.subCaptureFilter.dumpKernelStartIdx);
|
||||
EXPECT_EQ(static_cast<uint32_t>(-1), subCaptureCommon.subCaptureFilter.dumpKernelEndIdx);
|
||||
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureMode());
|
||||
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive());
|
||||
EXPECT_FALSE(aubSubCaptureManager.wasSubCaptureActiveInPreviousEnqueue());
|
||||
EXPECT_EQ(0u, aubSubCaptureManager.getKernelCurrentIndex());
|
||||
EXPECT_TRUE(aubSubCaptureManager.getUseToggleFileName());
|
||||
EXPECT_STREQ(initialFileName.c_str(), aubSubCaptureManager.getInitialFileName().c_str());
|
||||
EXPECT_STREQ("", aubSubCaptureManager.getCurrentFileName().c_str());
|
||||
EXPECT_NE(nullptr, aubSubCaptureManager.getSettingsReader());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenCheckAndActivateSubCaptureIsCalledWithEmptyDispatchInfoThenSubCaptureIsInactive) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenCheckAndActivateSubCaptureIsCalledWithNonEmptyDispatchInfoThenKernelCurrentIndexIsIncremented) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
uint32_t kernelCurrentIndex = aubSubCaptureManager.getKernelCurrentIndex();
|
||||
ASSERT_EQ(0u, kernelCurrentIndex);
|
||||
|
||||
aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_EQ(kernelCurrentIndex + 0, aubSubCaptureManager.getKernelCurrentIndex());
|
||||
|
||||
aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_EQ(kernelCurrentIndex + 1, aubSubCaptureManager.getKernelCurrentIndex());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenCheckAndActivateSubCaptureIsCalledButSubCaptureModeIsOffThenSubCaptureIsInactive) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Off;
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenCheckAndActivateSubCaptureIsCalledAndSubCaptureIsToggledOnThenSubCaptureGetsAndRemainsActivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
aubSubCaptureManager.setSubCaptureToggleActive(true);
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_TRUE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
|
||||
status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_TRUE(status.isActive);
|
||||
EXPECT_TRUE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenCheckAndActivateSubCaptureIsCalledButSubCaptureIsToggledOffThenSubCaptureRemainsDeactivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
aubSubCaptureManager.setSubCaptureToggleActive(false);
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
|
||||
status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenCheckAndActivateSubCaptureIsCalledButSubCaptureIsToggledOnAndOffThenSubCaptureGetsActivatedAndDeactivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
aubSubCaptureManager.setSubCaptureToggleActive(true);
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_TRUE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
|
||||
aubSubCaptureManager.setSubCaptureToggleActive(false);
|
||||
status = aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_TRUE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivateSubCaptureIsCalledAndSubCaptureFilterIsDefaultThenSubCaptureIsActive) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_TRUE(status.isActive);
|
||||
EXPECT_TRUE(aubSubCaptureManager.isSubCaptureActive());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivateSubCaptureIsCalledAndSubCaptureFilterWithValidKernelStartIndexIsSpecifiedThenSubCaptureGetsActivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelStartIdx = 0;
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_TRUE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivateSubCaptureIsCalledAndSubCaptureFilterWithInvalidKernelStartIndexIsSpecifiedThenSubCaptureRemainsDeactivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelStartIdx = 1;
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivateSubCaptureIsCalledAndSubCaptureFilterWithInvalidKernelEndIndexIsSpecifiedThenSubCaptureRemainsDeactivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelEndIdx = 0;
|
||||
subCaptureCommon.getKernelCurrentIndexAndIncrement();
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivateSubCaptureIsCalledAndSubCaptureFilterWithValidKernelNameIsSpecifiedThenSubCaptureGetsActivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelName = "kernel_name";
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_TRUE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivateSubCaptureIsCalledAndSubCaptureFilterWithInvalidKernelNameIsSpecifiedThenSubCaptureRemainsDeactivated) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelName = "invalid_kernel_name";
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenDeactivateSubCaptureIsCalledThenSubCaptureActiveStatesAreCleared) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
aubSubCaptureManager.setSubCaptureIsActive(true);
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(true);
|
||||
|
||||
aubSubCaptureManager.disableSubCapture();
|
||||
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive());
|
||||
EXPECT_FALSE(aubSubCaptureManager.wasSubCaptureActiveInPreviousEnqueue());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureActiveStatesAreDeterminedThenIsSubCaptureFunctionReturnCorrectValues) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(false);
|
||||
aubSubCaptureManager.setSubCaptureIsActive(false);
|
||||
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureEnabled());
|
||||
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(false);
|
||||
aubSubCaptureManager.setSubCaptureIsActive(true);
|
||||
EXPECT_TRUE(aubSubCaptureManager.isSubCaptureEnabled());
|
||||
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(true);
|
||||
aubSubCaptureManager.setSubCaptureIsActive(false);
|
||||
EXPECT_TRUE(aubSubCaptureManager.isSubCaptureEnabled());
|
||||
|
||||
aubSubCaptureManager.setSubCaptureIsActive(true);
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(true);
|
||||
EXPECT_TRUE(aubSubCaptureManager.isSubCaptureEnabled());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureActiveStatesAreDeterminedThenGetSubCaptureStatusReturnsCorrectValues) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
AubSubCaptureStatus aubSubCaptureStatus{};
|
||||
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(false);
|
||||
aubSubCaptureManager.setSubCaptureIsActive(false);
|
||||
aubSubCaptureStatus = aubSubCaptureManager.getSubCaptureStatus();
|
||||
EXPECT_FALSE(aubSubCaptureStatus.wasActiveInPreviousEnqueue);
|
||||
EXPECT_FALSE(aubSubCaptureStatus.isActive);
|
||||
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(false);
|
||||
aubSubCaptureManager.setSubCaptureIsActive(true);
|
||||
aubSubCaptureStatus = aubSubCaptureManager.getSubCaptureStatus();
|
||||
EXPECT_FALSE(aubSubCaptureStatus.wasActiveInPreviousEnqueue);
|
||||
EXPECT_TRUE(aubSubCaptureStatus.isActive);
|
||||
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(true);
|
||||
aubSubCaptureManager.setSubCaptureIsActive(false);
|
||||
aubSubCaptureStatus = aubSubCaptureManager.getSubCaptureStatus();
|
||||
EXPECT_TRUE(aubSubCaptureStatus.wasActiveInPreviousEnqueue);
|
||||
EXPECT_FALSE(aubSubCaptureStatus.isActive);
|
||||
|
||||
aubSubCaptureManager.setSubCaptureIsActive(true);
|
||||
aubSubCaptureManager.setSubCaptureWasActiveInPreviousEnqueue(true);
|
||||
aubSubCaptureStatus = aubSubCaptureManager.getSubCaptureStatus();
|
||||
EXPECT_TRUE(aubSubCaptureStatus.wasActiveInPreviousEnqueue);
|
||||
EXPECT_TRUE(aubSubCaptureStatus.isActive);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenGetSubCaptureFileNameIsCalledAndAubCaptureFileNameIsSpecifiedThenItReturnsTheSpecifiedFileName) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpCaptureFileName.set("aubcapture_file_name.aub");
|
||||
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
EXPECT_STREQ("aubcapture_file_name.aub", aubSubCaptureManager.getSubCaptureFileName("kernelName").c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInOffModeWhenGetSubCaptureFileNameIsCalledThenItReturnsEmptyFileName) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
EXPECT_STREQ("", aubSubCaptureManager.getSubCaptureFileName("kernelName").c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenGetSubCaptureFileNameIsCalledAndToggleFileNameIsSpecifiedThenItReturnsItsName) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
std::string toggleFileName = "toggle_file_name.aub";
|
||||
aubSubCaptureManager.setToggleFileName(toggleFileName);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
EXPECT_STREQ(toggleFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName("kernelName").c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFileNameIsCalledAndToggleFileNameIsSpecifiedThenItReturnsItsName) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
std::string toggleFileName = "toggle_file_name.aub";
|
||||
aubSubCaptureManager.setToggleFileName(toggleFileName);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
EXPECT_STREQ(toggleFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName("kernelName").c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFileNameIsCalledAndBothToggleAndAubCaptureFileNamesAreSpecifiedThenToggleNameTakesPrecedence) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpCaptureFileName.set("aubcapture_file_name.aub");
|
||||
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
std::string toggleFileName = "toggle_file_name.aub";
|
||||
aubSubCaptureManager.setToggleFileName(toggleFileName);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
EXPECT_STREQ(toggleFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName("kernelName").c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenGetSubCaptureFileNameIsCalledAndToggleFileNameIsNotSpecifiedThenItGeneratesFilterFileName) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
|
||||
aubSubCaptureManager.setToggleFileName("");
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
std::string filterFileName = aubSubCaptureManager.generateFilterFileName();
|
||||
EXPECT_STREQ(filterFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName("kernelName").c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFileNameIsCalledAndToggleFileNameIsNotSpecifiedThenItGeneratesToggleFileName) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
|
||||
aubSubCaptureManager.setToggleFileName("");
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
std::string toggleFileName = aubSubCaptureManager.generateToggleFileName(kernelName);
|
||||
EXPECT_STREQ(toggleFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName(kernelName).c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFileNameIsCalledForEmptyDispatchInfoThenGenerateToggleFileNameWithoutKernelName) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
auto toggleFileName = aubSubCaptureManager.generateToggleFileName("kernelName");
|
||||
EXPECT_STREQ(toggleFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName("kernelName").c_str());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenGetSubCaptureFileNameIsCalledManyTimesAndToggleFileNameIsNotSpecifiedThenItGeneratesFilterFileNameOnceOnly) {
|
||||
struct AubSubCaptureManagerMockWithFilterFileNameGenerationCount : AubSubCaptureManager {
|
||||
using AubSubCaptureManager::AubSubCaptureManager;
|
||||
std::string generateFilterFileName() const override {
|
||||
generateFilterFileNameCount++;
|
||||
return "aubfile_filter.aub";
|
||||
}
|
||||
mutable uint32_t generateFilterFileNameCount = 0;
|
||||
} aubSubCaptureManager("", subCaptureCommon, "");
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
aubSubCaptureManager.getSubCaptureFileName("kernelName");
|
||||
aubSubCaptureManager.getSubCaptureFileName("kernelName");
|
||||
aubSubCaptureManager.getSubCaptureFileName("kernelName");
|
||||
EXPECT_EQ(1u, aubSubCaptureManager.generateFilterFileNameCount);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFileNameIsCalledManyTimesAndToggleFileNameIsNotSpecifiedThenItGeneratesToggleFileNameOnceOnly) {
|
||||
struct AubSubCaptureManagerMockWithToggleFileNameGenerationCount : AubSubCaptureManager {
|
||||
using AubSubCaptureManager::AubSubCaptureManager;
|
||||
std::string generateToggleFileName(const std::string &kernelName) const override {
|
||||
generateToggleFileNameCount++;
|
||||
return "aubfile_toggle.aub";
|
||||
}
|
||||
mutable uint32_t generateToggleFileNameCount = 0;
|
||||
} aubSubCaptureManager("", subCaptureCommon, "");
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
aubSubCaptureManager.getSubCaptureFileName("kernelName");
|
||||
aubSubCaptureManager.getSubCaptureFileName("kernelName");
|
||||
aubSubCaptureManager.getSubCaptureFileName("kernelName");
|
||||
EXPECT_EQ(1u, aubSubCaptureManager.generateToggleFileNameCount);
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenGenerateFilterFileNameIsCalledThenItGeneratesFileNameWithStartAndEndIndexes) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelStartIdx = 123;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelEndIdx = 456;
|
||||
std::string filterFileName = aubSubCaptureManager.generateFilterFileName();
|
||||
EXPECT_NE(std::string::npos, filterFileName.find("from_123_to_456"));
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenGenerateFilterFileNameIsCalledAndKernelNameIsSpecifiedInFilterThenItGeneratesFileNameWithNameOfKernel) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
std::string kernelName = "kernel_name";
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelName = kernelName;
|
||||
std::string filterFileName = aubSubCaptureManager.generateFilterFileName();
|
||||
EXPECT_NE(std::string::npos, filterFileName.find(kernelName));
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenGenerateFilterFileNameIsCalledAndKernelNameIsSpecifiedInFilterThenItGeneratesFileNameWithStartAndEndIndexesOfKernel) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
std::string kernelName = "kernel_name";
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelName = kernelName;
|
||||
subCaptureCommon.subCaptureFilter.dumpNamedKernelStartIdx = 12;
|
||||
subCaptureCommon.subCaptureFilter.dumpNamedKernelEndIdx = 17;
|
||||
std::string filterFileName = aubSubCaptureManager.generateFilterFileName();
|
||||
EXPECT_NE(std::string::npos, filterFileName.find("from_12_to_17"));
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGenerateToggleFileNameIsCalledThenItGeneratesFileNameWithKernelCurrentIndex) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
std::string kernelCurrentIndex = "from_" + std::to_string(aubSubCaptureManager.getKernelCurrentIndex());
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
std::string filterFileName = aubSubCaptureManager.generateToggleFileName("kernelName");
|
||||
EXPECT_NE(std::string::npos, filterFileName.find(kernelCurrentIndex));
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGenerateToggleFileNameIsCalledAndDispatchInfoIsEmptyThenItGeneratesFileNameWithoutNameOfKernel) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
std::string kernelName = "kernel_name";
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelName = kernelName;
|
||||
std::string toggleFileName = aubSubCaptureManager.generateToggleFileName("kernelName");
|
||||
EXPECT_EQ(std::string::npos, toggleFileName.find(kernelName));
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenKernelNameIsSpecifiedThenNamedKernelIndexesShouldApplyToTheSpecifiedKernel) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("aubfile.aub", subCaptureCommon);
|
||||
std::string kernelName = "kernel_name";
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
subCaptureCommon.subCaptureFilter.dumpNamedKernelStartIdx = 1;
|
||||
subCaptureCommon.subCaptureFilter.dumpNamedKernelEndIdx = 1;
|
||||
subCaptureCommon.subCaptureFilter.dumpKernelName = kernelName;
|
||||
|
||||
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
|
||||
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive());
|
||||
|
||||
status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_TRUE(status.isActive);
|
||||
EXPECT_TRUE(aubSubCaptureManager.isSubCaptureActive());
|
||||
|
||||
status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
|
||||
EXPECT_FALSE(status.isActive);
|
||||
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive());
|
||||
}
|
||||
|
||||
TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenPublicInterfaceIsCalledThenLockShouldBeAcquired) {
|
||||
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
|
||||
|
||||
aubSubCaptureManager.isLocked = false;
|
||||
aubSubCaptureManager.isSubCaptureEnabled();
|
||||
EXPECT_TRUE(aubSubCaptureManager.isLocked);
|
||||
|
||||
aubSubCaptureManager.isLocked = false;
|
||||
aubSubCaptureManager.disableSubCapture();
|
||||
EXPECT_TRUE(aubSubCaptureManager.isLocked);
|
||||
|
||||
aubSubCaptureManager.isLocked = false;
|
||||
aubSubCaptureManager.checkAndActivateSubCapture("kernelName");
|
||||
EXPECT_TRUE(aubSubCaptureManager.isLocked);
|
||||
|
||||
aubSubCaptureManager.isLocked = false;
|
||||
aubSubCaptureManager.getSubCaptureStatus();
|
||||
EXPECT_TRUE(aubSubCaptureManager.isLocked);
|
||||
|
||||
aubSubCaptureManager.isLocked = false;
|
||||
aubSubCaptureManager.getSubCaptureFileName("kernelName");
|
||||
EXPECT_TRUE(aubSubCaptureManager.isLocked);
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub/aub_helper.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver_simulated_common_hw.h"
|
||||
#include "shared/source/helpers/hardware_context_controller.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_aub_stream.h"
|
||||
#include "shared/test/common/mocks/mock_csr_simulated_common_hw.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
|
||||
using XeHPAndLaterMockSimulatedCsrHwTests = Test<ClDeviceFixture>;
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterMockSimulatedCsrHwTests, givenLocalMemoryEnabledWhenGlobalMmiosAreInitializedThenLmemIsInitializedAndLmemCfgMmioIsWritten) {
|
||||
std::unique_ptr<MockSimulatedCsrHw<FamilyType>> csrSimulatedCommonHw(new MockSimulatedCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
csrSimulatedCommonHw->localMemoryEnabled = true;
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw->stream = stream.get();
|
||||
csrSimulatedCommonHw->initGlobalMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00101010, 0x00000080u)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000cf58, 0x80000000u)));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterMockSimulatedCsrHwTests, givenAUBDumpForceAllToLocalMemoryWhenGlobalMmiosAreInitializedThenLmemIsInitializedAndLmemCfgMmioIsWritten) {
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true);
|
||||
|
||||
std::unique_ptr<MockSimulatedCsrHw<FamilyType>> csrSimulatedCommonHw(new MockSimulatedCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw->stream = stream.get();
|
||||
csrSimulatedCommonHw->initGlobalMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00101010, 0x00000080u)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000cf58, 0x80000000u)));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterMockSimulatedCsrHwTests, givenAubCommandStreamReceiverWhenGlobalMmiosAreInitializedThenMOCSRegistersAreConfigured) {
|
||||
MockSimulatedCsrHw<FamilyType> csrSimulatedCommonHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw.stream = stream.get();
|
||||
|
||||
csrSimulatedCommonHw.initGlobalMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004000, 0x00000008)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004004, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004008, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000400C, 0x00000008)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004010, 0x00000018)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004014, 0x00060038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004018, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000401C, 0x00000033)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004020, 0x00060037)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004024, 0x0000003B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004028, 0x00000032)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000402C, 0x00000036)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004030, 0x0000003A)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004034, 0x00000033)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004038, 0x00000037)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000403C, 0x0000003B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004040, 0x00000030)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004044, 0x00000034)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004048, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000404C, 0x00000031)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004050, 0x00000032)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004054, 0x00000036)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004058, 0x0000003A)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000405C, 0x00000033)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004060, 0x00000037)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004064, 0x0000003B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004068, 0x00000032)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000406C, 0x00000036)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004070, 0x0000003A)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004074, 0x00000033)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004078, 0x00000037)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000407C, 0x0000003B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004080, 0x00000030)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004084, 0x00000034)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004088, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000408C, 0x00000031)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004090, 0x00000032)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004094, 0x00000036)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004098, 0x0000003A)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000409C, 0x00000033)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040A0, 0x00000037)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040A4, 0x0000003B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040A8, 0x00000032)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040AC, 0x00000036)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040B0, 0x0000003A)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040B4, 0x00000033)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040B8, 0x00000037)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040BC, 0x0000003B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040C0, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040C4, 0x00000034)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040C8, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040CC, 0x00000031)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040D0, 0x00000032)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040D4, 0x00000036)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040D8, 0x0000003A)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040DC, 0x00000033)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040E0, 0x00000037)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040E4, 0x0000003B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040E8, 0x00000032)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040EC, 0x00000036)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040F0, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040F4, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040F8, 0x00000038)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x000040FC, 0x00000038)));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterMockSimulatedCsrHwTests, givenAubCommandStreamReceiverWhenGlobalMmiosAreInitializedThenLNCFRegistersAreConfigured) {
|
||||
MockSimulatedCsrHw<FamilyType> csrSimulatedCommonHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw.stream = stream.get();
|
||||
|
||||
csrSimulatedCommonHw.initGlobalMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B020, 0x00300010)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B024, 0x00300010)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B028, 0x00300030)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B02C, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B030, 0x0030001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B034, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B038, 0x0000001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B03C, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B040, 0x00100000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B044, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B048, 0x0010001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B04C, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B050, 0x0030001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B054, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B058, 0x0000001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B05C, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B060, 0x00100000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B064, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B068, 0x0010001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B06C, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B070, 0x0030001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B074, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B078, 0x0000001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B07C, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B080, 0x00300030)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B084, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B088, 0x0010001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B08C, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B090, 0x0030001F)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B094, 0x00170013)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B098, 0x00300010)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B09C, 0x00300010)));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterMockSimulatedCsrHwTests, givenAubCommandStreamReceiverWhenGlobalMmiosAreInitializedThenPerfMmioRegistersAreConfigured) {
|
||||
MockSimulatedCsrHw<FamilyType> csrSimulatedCommonHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw.stream = stream.get();
|
||||
|
||||
csrSimulatedCommonHw.initGlobalMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B004, 0x2FC0100B)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000B404, 0x00000160)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00008708, 0x00000000)));
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterMockSimulatedCsrHwTests, givenAubCommandStreamReceiverWhenGlobalMmiosAreInitializedThenTRTTRegistersAreConfigured) {
|
||||
MockSimulatedCsrHw<FamilyType> csrSimulatedCommonHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw.stream = stream.get();
|
||||
|
||||
csrSimulatedCommonHw.initGlobalMMIO();
|
||||
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004410, 0xffffffff)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004414, 0xfffffffe)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004404, 0x000000ff)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004408, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x0000440C, 0x00000000)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004400, 0x00000001)));
|
||||
EXPECT_TRUE(stream->isOnMmioList(MMIOPair(0x00004DFC, 0x00000000)));
|
||||
}
|
||||
|
||||
class XeHPAndLaterTileRangeRegisterTest : public ClDeviceFixture, public ::testing::Test {
|
||||
public:
|
||||
template <typename FamilyType>
|
||||
void setUpImpl() {
|
||||
hardwareInfo = *defaultHwInfo;
|
||||
hardwareInfoSetup[hardwareInfo.platform.eProductFamily](&hardwareInfo, true, 0);
|
||||
hardwareInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
|
||||
ClDeviceFixture::SetUpImpl(&hardwareInfo);
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
ClDeviceFixture::TearDown();
|
||||
}
|
||||
|
||||
void checkMMIOs(MMIOList &list, uint32_t tilesNumber, uint32_t localMemorySizeTotalInGB) {
|
||||
const uint32_t numberOfTiles = tilesNumber;
|
||||
const uint32_t totalLocalMemorySizeGB = localMemorySizeTotalInGB;
|
||||
|
||||
MMIOPair tileAddrRegisters[] = {{0x00004900, 0x0001},
|
||||
{0x00004904, 0x0001},
|
||||
{0x00004908, 0x0001},
|
||||
{0x0000490c, 0x0001}};
|
||||
|
||||
uint32_t localMemoryBase = 0x0;
|
||||
for (uint32_t i = 0; i < sizeof(tileAddrRegisters) / sizeof(MMIOPair); i++) {
|
||||
tileAddrRegisters[i].second |= localMemoryBase << 1;
|
||||
tileAddrRegisters[i].second |= (totalLocalMemorySizeGB / numberOfTiles) << 8;
|
||||
localMemoryBase += (totalLocalMemorySizeGB / numberOfTiles);
|
||||
}
|
||||
|
||||
uint32_t mmiosFound = 0;
|
||||
for (auto &mmioPair : list) {
|
||||
for (uint32_t i = 0; i < numberOfTiles; i++) {
|
||||
if (mmioPair.first == tileAddrRegisters[i].first && mmioPair.second == tileAddrRegisters[i].second) {
|
||||
mmiosFound++;
|
||||
}
|
||||
}
|
||||
}
|
||||
EXPECT_EQ(numberOfTiles, mmiosFound);
|
||||
}
|
||||
};
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenLocalMemoryEnabledWhenGlobalMmiosAreInitializedThenTileRangeRegistersAreProgrammed) {
|
||||
setUpImpl<FamilyType>();
|
||||
std::unique_ptr<MockSimulatedCsrHw<FamilyType>> csrSimulatedCommonHw(new MockSimulatedCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
csrSimulatedCommonHw->localMemoryEnabled = true;
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw->stream = stream.get();
|
||||
csrSimulatedCommonHw->initGlobalMMIO();
|
||||
|
||||
checkMMIOs(stream->mmioList, 1, 32);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenLocalMemoryEnabledAnd4TileConfigWhenGlobalMmiosAreInitializedThenTileRangeRegistersAreProgrammed) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(4);
|
||||
setUpImpl<FamilyType>();
|
||||
std::unique_ptr<MockSimulatedCsrHw<FamilyType>> csrSimulatedCommonHw(new MockSimulatedCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
csrSimulatedCommonHw->localMemoryEnabled = true;
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw->stream = stream.get();
|
||||
csrSimulatedCommonHw->initGlobalMMIO();
|
||||
|
||||
checkMMIOs(stream->mmioList, 4, 32);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTileRangeRegisterTest, givenAUBDumpForceAllToLocalMemoryWhenGlobalMmiosAreInitializedThenTileRangeRegistersAreProgrammed) {
|
||||
setUpImpl<FamilyType>();
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true);
|
||||
|
||||
std::unique_ptr<MockSimulatedCsrHw<FamilyType>> csrSimulatedCommonHw(new MockSimulatedCsrHw<FamilyType>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()));
|
||||
csrSimulatedCommonHw->localMemoryEnabled = true;
|
||||
|
||||
auto stream = std::make_unique<MockAubStreamMockMmioWrite>();
|
||||
csrSimulatedCommonHw->stream = stream.get();
|
||||
csrSimulatedCommonHw->initGlobalMMIO();
|
||||
|
||||
checkMMIOs(stream->mmioList, 1, 32);
|
||||
}
|
||||
@@ -1,526 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver_simulated_hw.h"
|
||||
#include "shared/source/helpers/array_count.h"
|
||||
#include "shared/source/helpers/hardware_context_controller.h"
|
||||
#include "shared/source/memory_manager/memory_pool.h"
|
||||
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/hw_helper_tests.h"
|
||||
#include "shared/test/common/mocks/mock_aub_manager.h"
|
||||
#include "shared/test/common/mocks/mock_csr_simulated_common_hw.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/mock_os_context.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
using namespace NEO;
|
||||
|
||||
using CommandStreamSimulatedTests = HwHelperTest;
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndAllocationWithStorageInfoNonZeroWhenMemoryBankIsQueriedThenBankForAllocationDeviceIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x2u;
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, 1);
|
||||
|
||||
if (csr->localMemoryEnabled) {
|
||||
auto bank = csr->getMemoryBank(&allocation);
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(1), bank);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndNonLocalMemoryAllocationWithStorageInfoNonZeroWhenMemoryBankIsQueriedThenMainBankIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::System4KBPages, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x2u;
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, 1);
|
||||
auto bank = csr->getMemoryBank(&allocation);
|
||||
EXPECT_EQ(MemoryBanks::MainBank, bank);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndAllocationWithStorageInfoZeroWhenMemoryBankIsQueriedThenBankForCsrIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x0u;
|
||||
|
||||
DeviceBitfield deviceBitfield(0b100);
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, deviceBitfield);
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor(deviceBitfield));
|
||||
csr->setupContext(*osContext);
|
||||
auto bank = csr->getMemoryBank(&allocation);
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(2), bank);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndNonLocalMemoryAllocationWithStorageInfoNonZeroWhenMemoryBanksBitfieldIsQueriedThenBanksBitfieldForSystemMemoryIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::System64KBPages, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x3u;
|
||||
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, deviceBitfield);
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor());
|
||||
csr->setupContext(*osContext);
|
||||
auto banksBitfield = csr->getMemoryBanksBitfield(&allocation);
|
||||
EXPECT_TRUE(banksBitfield.none());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryNoncloneableAllocationWithManyBanksWhenMemoryBanksBitfieldIsQueriedThenSingleMemoryBankIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x3u;
|
||||
allocation.storageInfo.cloningOfPageTables = false;
|
||||
|
||||
DeviceBitfield deviceBitfield(0x1u);
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, deviceBitfield);
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor());
|
||||
csr->setupContext(*osContext);
|
||||
EXPECT_FALSE(csr->isMultiOsContextCapable());
|
||||
|
||||
if (csr->localMemoryEnabled) {
|
||||
auto banksBitfield = csr->getMemoryBanksBitfield(&allocation);
|
||||
EXPECT_EQ(0x1lu, banksBitfield.to_ulong());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryCloneableAllocationWithManyBanksWhenMemoryBanksBitfieldIsQueriedThenAllMemoryBanksAreReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x3u;
|
||||
allocation.storageInfo.cloningOfPageTables = true;
|
||||
|
||||
DeviceBitfield deviceBitfield(1);
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, deviceBitfield);
|
||||
EXPECT_FALSE(csr->isMultiOsContextCapable());
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor());
|
||||
csr->setupContext(*osContext);
|
||||
|
||||
if (csr->localMemoryEnabled) {
|
||||
auto banksBitfield = csr->getMemoryBanksBitfield(&allocation);
|
||||
EXPECT_EQ(0x3lu, banksBitfield.to_ulong());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryNoncloneableAllocationWithManyBanksWhenMemoryBanksBitfieldIsQueriedOnSpecialCsrThenAllMemoryBanksAreReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x3u;
|
||||
allocation.storageInfo.cloningOfPageTables = false;
|
||||
|
||||
DeviceBitfield deviceBitfield(0b11);
|
||||
MockSimulatedCsrHw<FamilyType> csr(executionEnvironment, 0, deviceBitfield);
|
||||
csr.multiOsContextCapable = true;
|
||||
EXPECT_TRUE(csr.isMultiOsContextCapable());
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, EngineDescriptorHelper::getDefaultDescriptor(deviceBitfield));
|
||||
csr.setupContext(*osContext);
|
||||
|
||||
if (csr.localMemoryEnabled) {
|
||||
auto banksBitfield = csr.getMemoryBanksBitfield(&allocation);
|
||||
EXPECT_EQ(0x3lu, banksBitfield.to_ulong());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryAndAllocationWithStorageInfoZeroWhenMemoryBanksBitfieldIsQueriedThenBanksBitfieldForCsrDeviceIndexIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
MemoryAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, reinterpret_cast<void *>(0x1000), 0x1000u,
|
||||
MemoryConstants::pageSize, 0, MemoryPool::LocalMemory, false, false, MemoryManager::maxOsContextCount);
|
||||
allocation.storageInfo.memoryBanks = 0x0u;
|
||||
|
||||
DeviceBitfield deviceBitfield(0b100);
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, deviceBitfield);
|
||||
auto deviceIndex = 2u;
|
||||
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor(deviceBitfield));
|
||||
csr->setupContext(*osContext);
|
||||
auto banksBitfield = csr->getMemoryBanksBitfield(&allocation);
|
||||
EXPECT_EQ(1u, banksBitfield.count());
|
||||
EXPECT_TRUE(banksBitfield.test(deviceIndex));
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryWhenSimulatedCsrGetAddressSpaceIsCalledWithDifferentHintsThenCorrectSpaceIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
std::array<uint32_t, 6> localMemoryHints = {AubMemDump::DataTypeHintValues::TraceLogicalRingContextRcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextCcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextBcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVecs,
|
||||
AubMemDump::DataTypeHintValues::TraceCommandBuffer};
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, 1);
|
||||
|
||||
if (csr->localMemoryEnabled) {
|
||||
for (const uint32_t hint : localMemoryHints) {
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, csr->getAddressSpace(hint));
|
||||
}
|
||||
}
|
||||
std::array<uint32_t, 1> nonLocalMemoryHints = {AubMemDump::DataTypeHintValues::TraceNotype};
|
||||
|
||||
for (const uint32_t hint : nonLocalMemoryHints) {
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceNonlocal, csr->getAddressSpace(hint));
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenLocalMemoryDisabledWhenSimulatedCsrGetAddressSpaceIsCalledWithDifferentHintsThenCorrectSpaceIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = false;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
std::array<uint32_t, 7> nonLocalMemoryHints = {AubMemDump::DataTypeHintValues::TraceNotype,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextRcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextCcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextBcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVecs,
|
||||
AubMemDump::DataTypeHintValues::TraceCommandBuffer};
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, 1);
|
||||
|
||||
for (const uint32_t hint : nonLocalMemoryHints) {
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceNonlocal, csr->getAddressSpace(hint));
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenAUBDumpForceAllToLocalMemoryWhenSimulatedCsrGetAddressSpaceIsCalledWithDifferentHintsThenTraceLocalIsReturned) {
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true);
|
||||
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = false;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(&hardwareInfo);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
std::array<uint32_t, 7> localMemoryHints = {AubMemDump::DataTypeHintValues::TraceNotype,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextRcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextCcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextBcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVcs,
|
||||
AubMemDump::DataTypeHintValues::TraceLogicalRingContextVecs,
|
||||
AubMemDump::DataTypeHintValues::TraceCommandBuffer};
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(executionEnvironment, 0, 1);
|
||||
|
||||
if (csr->localMemoryEnabled) {
|
||||
for (const uint32_t hint : localMemoryHints) {
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, csr->getAddressSpace(hint));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenMultipleBitsInStorageInfoWhenQueryingDeviceIndexThenLowestDeviceIndexIsReturned) {
|
||||
StorageInfo storageInfo;
|
||||
|
||||
storageInfo.memoryBanks = {1u | (1u << 2u)};
|
||||
auto deviceIndex = CommandStreamReceiverSimulatedHw<FamilyType>::getDeviceIndexFromStorageInfo(storageInfo);
|
||||
EXPECT_EQ(0u, deviceIndex);
|
||||
|
||||
storageInfo.memoryBanks = (1u << 2u) | (1u << 3u);
|
||||
|
||||
deviceIndex = CommandStreamReceiverSimulatedHw<FamilyType>::getDeviceIndexFromStorageInfo(storageInfo);
|
||||
EXPECT_EQ(2u, deviceIndex);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenSingleBitInStorageInfoWhenQueryingDeviceIndexThenCorrectDeviceIndexIsReturned) {
|
||||
|
||||
StorageInfo storageInfo;
|
||||
|
||||
for (uint32_t i = 0; i < 4u; i++) {
|
||||
storageInfo.memoryBanks.reset();
|
||||
storageInfo.memoryBanks.set(i);
|
||||
auto deviceIndex = CommandStreamReceiverSimulatedHw<FamilyType>::getDeviceIndexFromStorageInfo(storageInfo);
|
||||
EXPECT_EQ(i, deviceIndex);
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenSimulatedCommandStreamReceiverWhenCloningPageTableIsRequiredThenAubManagerIsUsedForWriteMemory) {
|
||||
auto mockManager = std::make_unique<MockAubManager>();
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
csr->aubManager = mockManager.get();
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
csr->setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
int dummy = 1;
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
|
||||
&dummy, 0, 0, sizeof(dummy), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = true;
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(mockHardwareContext->writeMemory2Called);
|
||||
EXPECT_TRUE(mockManager->writeMemory2Called);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenCompressedAllocationWhenCloningPageTableIsRequiredThenAubManagerIsUsedForWriteMemory) {
|
||||
auto mockManager = std::make_unique<MockAubManager>();
|
||||
mockManager->storeAllocationParams = true;
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
csr->aubManager = mockManager.get();
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
csr->setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
gmm.isCompressionEnabled = true;
|
||||
|
||||
int dummy = 1;
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
|
||||
&dummy, 0, 0, sizeof(dummy), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = true;
|
||||
|
||||
graphicsAllocation.setDefaultGmm(&gmm);
|
||||
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
EXPECT_FALSE(mockHardwareContext->writeMemory2Called);
|
||||
EXPECT_TRUE(mockManager->writeMemory2Called);
|
||||
|
||||
EXPECT_EQ(1u, mockManager->storedAllocationParams.size());
|
||||
EXPECT_TRUE(mockManager->storedAllocationParams[0].additionalParams.compressionEnabled);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenTileInstancedAllocationWhenWriteMemoryWithAubManagerThenEachHardwareContextGetsDifferentMemoryBank) {
|
||||
auto mockManager = std::make_unique<MockAubManager>();
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
csr->aubManager = mockManager.get();
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(0b11));
|
||||
csr->hardwareContextController = std::make_unique<HardwareContextController>(*mockManager, osContext, 0);
|
||||
auto firstMockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
|
||||
auto secondMockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[1].get());
|
||||
csr->multiOsContextCapable = true;
|
||||
|
||||
int dummy = 1;
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
|
||||
&dummy, 0, 0, sizeof(dummy), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = false;
|
||||
graphicsAllocation.storageInfo.tileInstanced = true;
|
||||
graphicsAllocation.storageInfo.memoryBanks = 0b11u;
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
EXPECT_TRUE(firstMockHardwareContext->writeMemory2Called);
|
||||
EXPECT_EQ(0b01u, firstMockHardwareContext->memoryBanksPassed);
|
||||
EXPECT_TRUE(secondMockHardwareContext->writeMemory2Called);
|
||||
EXPECT_EQ(0b10u, secondMockHardwareContext->memoryBanksPassed);
|
||||
EXPECT_FALSE(mockManager->writeMemory2Called);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenCompressedTileInstancedAllocationWhenWriteMemoryWithAubManagerThenEachHardwareContextGetsCompressionInfo) {
|
||||
auto mockManager = std::make_unique<MockAubManager>();
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
csr->aubManager = mockManager.get();
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(0b11));
|
||||
csr->hardwareContextController = std::make_unique<HardwareContextController>(*mockManager, osContext, 0);
|
||||
auto firstMockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
|
||||
firstMockHardwareContext->storeAllocationParams = true;
|
||||
auto secondMockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[1].get());
|
||||
secondMockHardwareContext->storeAllocationParams = true;
|
||||
|
||||
csr->multiOsContextCapable = true;
|
||||
|
||||
MockGmm gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
gmm.isCompressionEnabled = true;
|
||||
|
||||
int dummy = 1;
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
|
||||
&dummy, 0, 0, sizeof(dummy), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = false;
|
||||
graphicsAllocation.storageInfo.tileInstanced = true;
|
||||
graphicsAllocation.storageInfo.memoryBanks = 0b11u;
|
||||
|
||||
graphicsAllocation.setDefaultGmm(&gmm);
|
||||
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
EXPECT_TRUE(firstMockHardwareContext->writeMemory2Called);
|
||||
EXPECT_EQ(1u, firstMockHardwareContext->storedAllocationParams.size());
|
||||
EXPECT_TRUE(firstMockHardwareContext->storedAllocationParams[0].additionalParams.compressionEnabled);
|
||||
|
||||
EXPECT_TRUE(secondMockHardwareContext->writeMemory2Called);
|
||||
EXPECT_EQ(1u, secondMockHardwareContext->storedAllocationParams.size());
|
||||
EXPECT_TRUE(secondMockHardwareContext->storedAllocationParams[0].additionalParams.compressionEnabled);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenTileInstancedAllocationWithMissingMemoryBankWhenWriteMemoryWithAubManagerThenAbortIsCalled) {
|
||||
auto mockManager = std::make_unique<MockAubManager>();
|
||||
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
csr->aubManager = mockManager.get();
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(0b11));
|
||||
csr->hardwareContextController = std::make_unique<HardwareContextController>(*mockManager, osContext, 0);
|
||||
auto firstMockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
|
||||
auto secondMockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[1].get());
|
||||
csr->multiOsContextCapable = true;
|
||||
|
||||
int dummy = 1;
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::UNKNOWN,
|
||||
&dummy, 0, 0, sizeof(dummy), MemoryPool::LocalMemory, MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = false;
|
||||
graphicsAllocation.storageInfo.tileInstanced = true;
|
||||
graphicsAllocation.storageInfo.memoryBanks = 2u;
|
||||
EXPECT_THROW(csr->writeMemoryWithAubManager(graphicsAllocation), std::exception);
|
||||
EXPECT_FALSE(firstMockHardwareContext->writeMemory2Called);
|
||||
EXPECT_FALSE(secondMockHardwareContext->writeMemory2Called);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenCommandBufferAllocationWhenWriteMemoryCalledThenHintIsPassed) {
|
||||
auto mockManager = std::make_unique<MockAubManager>();
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
csr->aubManager = mockManager.get();
|
||||
|
||||
int dummy = 1;
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
|
||||
&dummy, 0, 0, sizeof(dummy), MemoryPool::MemoryNull, MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = true;
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceBatchBuffer, mockManager->hintToWriteMemory);
|
||||
EXPECT_TRUE(mockManager->writeMemory2Called);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamSimulatedTests, givenSpecificMemoryPoolAllocationWhenWriteMemoryByAubManagerOrHardwareContextIsCalledThenCorrectPageSizeIsPassed) {
|
||||
auto mockManager = std::make_unique<MockAubManager>();
|
||||
auto csr = std::make_unique<MockSimulatedCsrHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
csr->aubManager = mockManager.get();
|
||||
|
||||
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
csr->hardwareContextController = std::make_unique<HardwareContextController>(*mockManager, osContext, 0);
|
||||
csr->setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(csr->hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
int dummy = 1;
|
||||
|
||||
MemoryPool::Type poolsWith4kPages[] = {
|
||||
MemoryPool::System4KBPages,
|
||||
MemoryPool::System4KBPagesWith32BitGpuAddressing,
|
||||
MemoryPool::SystemCpuInaccessible};
|
||||
|
||||
for (size_t i = 0; i < arrayCount(poolsWith4kPages); i++) {
|
||||
|
||||
mockManager->writeMemoryPageSizePassed = 0;
|
||||
mockManager->writeMemory2Called = false;
|
||||
|
||||
mockHardwareContext->writeMemoryPageSizePassed = 0;
|
||||
mockHardwareContext->writeMemory2Called = false;
|
||||
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
|
||||
&dummy, 0, 0, sizeof(dummy), poolsWith4kPages[i], MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = true;
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
EXPECT_TRUE(mockManager->writeMemory2Called);
|
||||
EXPECT_EQ(MemoryConstants::pageSize, mockManager->writeMemoryPageSizePassed);
|
||||
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = false;
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
if (graphicsAllocation.isAllocatedInLocalMemoryPool()) {
|
||||
EXPECT_TRUE(mockHardwareContext->writeMemory2Called);
|
||||
EXPECT_EQ(MemoryConstants::pageSize, mockHardwareContext->writeMemoryPageSizePassed);
|
||||
} else {
|
||||
EXPECT_TRUE(mockManager->writeMemory2Called);
|
||||
EXPECT_EQ(MemoryConstants::pageSize, mockManager->writeMemoryPageSizePassed);
|
||||
}
|
||||
}
|
||||
|
||||
MemoryPool::Type poolsWith64kPages[] = {
|
||||
MemoryPool::System64KBPages,
|
||||
MemoryPool::System64KBPagesWith32BitGpuAddressing,
|
||||
MemoryPool::LocalMemory};
|
||||
|
||||
for (size_t i = 0; i < arrayCount(poolsWith64kPages); i++) {
|
||||
|
||||
mockManager->writeMemoryPageSizePassed = 0;
|
||||
mockManager->writeMemory2Called = false;
|
||||
|
||||
mockHardwareContext->writeMemoryPageSizePassed = 0;
|
||||
mockHardwareContext->writeMemory2Called = false;
|
||||
|
||||
GraphicsAllocation graphicsAllocation{0, GraphicsAllocation::AllocationType::COMMAND_BUFFER,
|
||||
&dummy, 0, 0, sizeof(dummy), poolsWith64kPages[i], MemoryManager::maxOsContextCount};
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = true;
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
EXPECT_TRUE(mockManager->writeMemory2Called);
|
||||
EXPECT_EQ(MemoryConstants::pageSize64k, mockManager->writeMemoryPageSizePassed);
|
||||
|
||||
graphicsAllocation.storageInfo.cloningOfPageTables = false;
|
||||
csr->writeMemoryWithAubManager(graphicsAllocation);
|
||||
|
||||
if (graphicsAllocation.isAllocatedInLocalMemoryPool()) {
|
||||
EXPECT_TRUE(mockHardwareContext->writeMemory2Called);
|
||||
EXPECT_EQ(MemoryConstants::pageSize64k, mockHardwareContext->writeMemoryPageSizePassed);
|
||||
} else {
|
||||
EXPECT_TRUE(mockManager->writeMemory2Called);
|
||||
EXPECT_EQ(MemoryConstants::pageSize64k, mockManager->writeMemoryPageSizePassed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "shared/source/memory_manager/memory_banks.h"
|
||||
#include "shared/source/memory_manager/memory_pool.h"
|
||||
#include "shared/source/memory_manager/physical_address_allocator.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/hw_helper_tests.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct XeHPAndLaterTbxCommandStreamReceiverTests : DeviceFixture, ::testing::Test {
|
||||
template <typename FamilyType>
|
||||
void setUpImpl() {
|
||||
hardwareInfo = *defaultHwInfo;
|
||||
hardwareInfoSetup[hardwareInfo.platform.eProductFamily](&hardwareInfo, true, 0);
|
||||
hardwareInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
|
||||
DeviceFixture::SetUpImpl(&hardwareInfo);
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
DeviceFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FamilyType>
|
||||
struct MockTbxCommandStreamReceiverHw : TbxCommandStreamReceiverHw<FamilyType> {
|
||||
using TbxCommandStreamReceiverHw<FamilyType>::TbxCommandStreamReceiverHw;
|
||||
|
||||
uint32_t getDeviceIndex() const override {
|
||||
return deviceIndex;
|
||||
}
|
||||
|
||||
uint32_t deviceIndex = 0u;
|
||||
};
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, givenNullPtrGraphicsAlloctionWhenGetPPGTTAdditionalBitsIsCalledThenAppropriateValueIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
GraphicsAllocation *allocation = nullptr;
|
||||
auto bits = tbxCsr->getPPGTTAdditionalBits(allocation);
|
||||
|
||||
EXPECT_EQ(3u, bits);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, givenGraphicsAlloctionWithNonLocalMemoryPoolWhenGetPPGTTAdditionalBitsIsCalledThenAppropriateValueIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockGraphicsAllocation allocation(nullptr, 0);
|
||||
auto bits = tbxCsr->getPPGTTAdditionalBits(&allocation);
|
||||
|
||||
EXPECT_EQ(3u, bits);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, givenGraphicsAlloctionWithLocalMemoryPoolWhenGetPPGTTAdditionalBitsIsCalledThenAppropriateValueIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockGraphicsAllocation allocation(nullptr, 0);
|
||||
allocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
auto bits = tbxCsr->getPPGTTAdditionalBits(&allocation);
|
||||
|
||||
EXPECT_EQ(3u | (1 << 11), bits);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, givenAubDumpForceAllToLocalMemoryPoolWhenGetPPGTTAdditionalBitsIsCalledThenLocalBitIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.AUBDumpForceAllToLocalMemory.set(true);
|
||||
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield());
|
||||
MockGraphicsAllocation allocation(nullptr, 0);
|
||||
|
||||
auto bits = tbxCsr->getPPGTTAdditionalBits(&allocation);
|
||||
|
||||
EXPECT_EQ(3u | (1 << 11), bits);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, givenLocalMemoryFeatureWhenGetGTTDataIsCalledThenLocalMemoryIsSet) {
|
||||
setUpImpl<FamilyType>();
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo));
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
|
||||
tbxCsr->setupContext(*device->getDefaultEngine().osContext);
|
||||
|
||||
AubGTTData data = {false, false};
|
||||
tbxCsr->getGTTData(nullptr, data);
|
||||
EXPECT_TRUE(data.localMemory);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, givenLocalMemoryEnabledWhenGetMemoryBankForGttIsCalledThenCorrectBankForDeviceIsReturned) {
|
||||
setUpImpl<FamilyType>();
|
||||
DebugManagerStateRestore debugRestorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
hardwareInfo.featureTable.flags.ftrLocalMemory = true;
|
||||
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo));
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
|
||||
|
||||
auto bank = tbxCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(0), bank);
|
||||
|
||||
tbxCsr->deviceIndex = 1u;
|
||||
bank = tbxCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(1), bank);
|
||||
|
||||
tbxCsr->deviceIndex = 2u;
|
||||
bank = tbxCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(2), bank);
|
||||
|
||||
tbxCsr->deviceIndex = 3u;
|
||||
bank = tbxCsr->getMemoryBankForGtt();
|
||||
EXPECT_EQ(MemoryBanks::getBankForLocalMemory(3), bank);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, whenPhysicalAllocatorIsCreatedThenItHasCorrectBankSzieAndNumberOfBanks) {
|
||||
setUpImpl<FamilyType>();
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo));
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
|
||||
auto physicalAddressAllocator = tbxCsr->physicalAddressAllocator.get();
|
||||
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator);
|
||||
|
||||
EXPECT_EQ(32 * MemoryConstants::gigaByte, allocator->getBankSize());
|
||||
EXPECT_EQ(1u, allocator->getNumberOfBanks());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, whenPhysicalAllocatorIsCreatedFor4TilesThenItHasCorrectBankSzieAndNumberOfBanks) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(4);
|
||||
setUpImpl<FamilyType>();
|
||||
std::unique_ptr<MockDevice> device(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo));
|
||||
auto tbxCsr = std::make_unique<MockTbxCommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
|
||||
auto physicalAddressAllocator = tbxCsr->physicalAddressAllocator.get();
|
||||
auto allocator = reinterpret_cast<PhysicalAddressAllocatorHw<FamilyType> *>(physicalAddressAllocator);
|
||||
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, allocator->getBankSize());
|
||||
EXPECT_EQ(4u, allocator->getNumberOfBanks());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterTbxCommandStreamReceiverTests, whenAskedForPollForCompletionParametersThenReturnCorrectValues) {
|
||||
setUpImpl<FamilyType>();
|
||||
class MyMockTbxHw : public TbxCommandStreamReceiverHw<FamilyType> {
|
||||
public:
|
||||
MyMockTbxHw(ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield)
|
||||
: TbxCommandStreamReceiverHw<FamilyType>(executionEnvironment, 0, deviceBitfield) {}
|
||||
using TbxCommandStreamReceiverHw<FamilyType>::getpollNotEqualValueForPollForCompletion;
|
||||
using TbxCommandStreamReceiverHw<FamilyType>::getMaskAndValueForPollForCompletion;
|
||||
};
|
||||
|
||||
MyMockTbxHw myMockTbxHw(*pDevice->executionEnvironment, pDevice->getDeviceBitfield());
|
||||
EXPECT_EQ(0x80u, myMockTbxHw.getMaskAndValueForPollForCompletion());
|
||||
EXPECT_TRUE(myMockTbxHw.getpollNotEqualValueForPollForCompletion());
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user