mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-13 18:23:03 +08:00
AubHelper: Local memory support
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5e408e5e6e
commit
83db85cf86
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 Intel Corporation
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -7,8 +7,7 @@
|
||||
set(IGDRCL_SRCS_aub_helper_tests
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_center_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/aub_helper_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_tests.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_tests.cpp
|
||||
)
|
||||
|
||||
if(NOT DEFINED AUB_STREAM_PROJECT_NAME)
|
||||
|
||||
@@ -5,8 +5,188 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/test/unit_test/aub/aub_helper_tests.inl"
|
||||
#include "shared/source/aub/aub_helper.h"
|
||||
#include "shared/source/aub_mem_dump/page_table_entry_bits.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/tbx/tbx_proto.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
TEST(AubHelper, GivenHwInfoWhenGetMemBankSizeIsCalledThenItReturnsCorrectValue) {
|
||||
EXPECT_EQ(2 * MemoryConstants::gigaByte, AubHelper::getMemBankSize(defaultHwInfo.get()));
|
||||
#include "opencl/source/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_lrca_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "aub_mem_dump.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(AubHelper, GivenZeroPdEntryBitsWhenGetMemTraceIsCalledThenTraceNonLocalIsReturned) {
|
||||
int hint = AubHelper::getMemTrace(0u);
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceNonlocal, hint);
|
||||
}
|
||||
|
||||
TEST(AubHelper, WhenGetPtEntryBitsIsCalledThenEntryBitsAreNotMasked) {
|
||||
uint64_t entryBits = BIT(PageTableEntry::presentBit) |
|
||||
BIT(PageTableEntry::writableBit) |
|
||||
BIT(PageTableEntry::userSupervisorBit);
|
||||
uint64_t maskedEntryBits = AubHelper::getPTEntryBits(entryBits);
|
||||
EXPECT_EQ(entryBits, maskedEntryBits);
|
||||
}
|
||||
|
||||
TEST(AubHelper, GivenMultipleSubDevicesWhenGettingDeviceCountThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
FeatureTable featureTable = {};
|
||||
WorkaroundTable workaroundTable = {};
|
||||
RuntimeCapabilityTable capTable = {};
|
||||
GT_SYSTEM_INFO sysInfo = {};
|
||||
PLATFORM platform = {};
|
||||
HardwareInfo hwInfo{&platform, &featureTable, &workaroundTable, &sysInfo, capTable};
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
|
||||
uint32_t devicesCount = HwHelper::getSubDevicesCount(&hwInfo);
|
||||
EXPECT_EQ(devicesCount, 2u);
|
||||
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(0);
|
||||
devicesCount = HwHelper::getSubDevicesCount(&hwInfo);
|
||||
EXPECT_EQ(devicesCount, 1u);
|
||||
}
|
||||
|
||||
TEST(AubHelper, WhenGetMemTraceIsCalledWithLocalMemoryPDEntryBitsThenTraceLocalIsReturned) {
|
||||
int hint = AubHelper::getMemTrace(BIT(PageTableEntry::localMemoryBit));
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, hint);
|
||||
}
|
||||
|
||||
TEST(AubHelper, WhenMaskPTEntryBitsIsCalledThenLocalMemoryBitIsMasked) {
|
||||
uint64_t entryBits = BIT(PageTableEntry::presentBit) |
|
||||
BIT(PageTableEntry::writableBit) |
|
||||
BIT(PageTableEntry::userSupervisorBit) |
|
||||
BIT(PageTableEntry::localMemoryBit);
|
||||
uint64_t maskedEntryBits = AubHelper::getPTEntryBits(entryBits);
|
||||
EXPECT_EQ(entryBits & ~BIT(PageTableEntry::localMemoryBit), maskedEntryBits);
|
||||
}
|
||||
|
||||
TEST(AubHelper, WhenGetMemTypeIsCalledWithAGivenAddressSpaceThenCorrectMemTypeIsReturned) {
|
||||
uint32_t addressSpace = AubHelper::getMemType(AubMemDump::AddressSpaceValues::TraceLocal);
|
||||
EXPECT_EQ(mem_types::MEM_TYPE_LOCALMEM, addressSpace);
|
||||
|
||||
addressSpace = AubHelper::getMemType(AubMemDump::AddressSpaceValues::TraceNonlocal);
|
||||
EXPECT_EQ(mem_types::MEM_TYPE_SYSTEM, addressSpace);
|
||||
}
|
||||
|
||||
TEST(AubHelper, WhenHBMSizePerTileInGigabytesIsSetThenGetMemBankSizeReturnsCorrectValue) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.HBMSizePerTileInGigabytes.set(8);
|
||||
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &sysInfo = hwInfo.gtSystemInfo;
|
||||
|
||||
sysInfo.MultiTileArchInfo.IsValid = true;
|
||||
sysInfo.MultiTileArchInfo.TileCount = 1;
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, AubHelper::getMemBankSize(&hwInfo));
|
||||
|
||||
sysInfo.MultiTileArchInfo.TileCount = 2;
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, AubHelper::getMemBankSize(&hwInfo));
|
||||
|
||||
sysInfo.MultiTileArchInfo.TileCount = 4;
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, AubHelper::getMemBankSize(&hwInfo));
|
||||
}
|
||||
|
||||
TEST(AubHelper, WhenHBMSizePerTileInGigabytesIsNotSetThenGetMemBankSizeReturnsCorrectValue) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO &sysInfo = hwInfo.gtSystemInfo;
|
||||
|
||||
sysInfo.MultiTileArchInfo.IsValid = true;
|
||||
sysInfo.MultiTileArchInfo.TileCount = 1;
|
||||
EXPECT_EQ(32 * MemoryConstants::gigaByte, AubHelper::getMemBankSize(&hwInfo));
|
||||
|
||||
sysInfo.MultiTileArchInfo.TileCount = 2;
|
||||
EXPECT_EQ(16 * MemoryConstants::gigaByte, AubHelper::getMemBankSize(&hwInfo));
|
||||
|
||||
sysInfo.MultiTileArchInfo.TileCount = 4;
|
||||
EXPECT_EQ(8 * MemoryConstants::gigaByte, AubHelper::getMemBankSize(&hwInfo));
|
||||
}
|
||||
|
||||
using AubHelperHwTest = Test<ClDeviceFixture>;
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPml4EntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPml4Entry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdpEntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPdpEntry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdEntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPdEntry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPtEntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPtEntry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTracePml4EntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPml4Entry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePml4Entry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTracePhysicalPdpEntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPdpEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePhysicalPdpEntry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTracePpgttPdEntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPdEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttPdEntry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTracePpgttEntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPtEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttEntry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPml4Entry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPdpEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPdEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPtEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, givenLrcaHelperWhenContextIsInitializedThenContextFlagsAreSet) {
|
||||
const auto &csTraits = CommandStreamReceiverSimulatedCommonHw<FamilyType>::getCsTraits(aub_stream::ENGINE_RCS);
|
||||
MockLrcaHelper lrcaHelper(csTraits.mmioBase);
|
||||
|
||||
std::unique_ptr<void, std::function<void(void *)>> lrcaBase(alignedMalloc(csTraits.sizeLRCA, csTraits.alignLRCA), alignedFree);
|
||||
|
||||
lrcaHelper.initialize(lrcaBase.get());
|
||||
ASSERT_NE(0u, lrcaHelper.setContextSaveRestoreFlagsCalled);
|
||||
}
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub/aub_helper.h"
|
||||
#include "shared/source/aub_mem_dump/page_table_entry_bits.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/command_stream/aub_command_stream_receiver_hw.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_lrca_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "aub_mem_dump.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(AubHelper, GivenZeroPdEntryBitsWhenGetMemTraceIsCalledThenTraceNonLocalIsReturned) {
|
||||
int hint = AubHelper::getMemTrace(0u);
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceNonlocal, hint);
|
||||
}
|
||||
|
||||
TEST(AubHelper, WhenGetPtEntryBitsIsCalledThenEntryBitsAreNotMasked) {
|
||||
uint64_t entryBits = BIT(PageTableEntry::presentBit) |
|
||||
BIT(PageTableEntry::writableBit) |
|
||||
BIT(PageTableEntry::userSupervisorBit);
|
||||
uint64_t maskedEntryBits = AubHelper::getPTEntryBits(entryBits);
|
||||
EXPECT_EQ(entryBits, maskedEntryBits);
|
||||
}
|
||||
|
||||
TEST(AubHelper, GivenMultipleSubDevicesWhenGettingDeviceCountThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
FeatureTable featureTable = {};
|
||||
WorkaroundTable workaroundTable = {};
|
||||
RuntimeCapabilityTable capTable = {};
|
||||
GT_SYSTEM_INFO sysInfo = {};
|
||||
PLATFORM platform = {};
|
||||
HardwareInfo hwInfo{&platform, &featureTable, &workaroundTable, &sysInfo, capTable};
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
|
||||
uint32_t devicesCount = HwHelper::getSubDevicesCount(&hwInfo);
|
||||
EXPECT_EQ(devicesCount, 2u);
|
||||
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(0);
|
||||
devicesCount = HwHelper::getSubDevicesCount(&hwInfo);
|
||||
EXPECT_EQ(devicesCount, 1u);
|
||||
}
|
||||
|
||||
typedef Test<ClDeviceFixture> AubHelperHwTest;
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPml4EntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPml4Entry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdpEntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPdpEntry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdEntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPdEntry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPtEntryIsCalledThenTraceNotypeIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int dataHint = aubHelper.getDataHintForPtEntry();
|
||||
EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTracePml4EntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPml4Entry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePml4Entry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTracePhysicalPdpEntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPdpEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePhysicalPdpEntry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTracePpgttPdEntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPdEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttPdEntry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTracePpgttEntryIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(false);
|
||||
int addressSpace = aubHelper.getMemTraceForPtEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttEntry, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPml4Entry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPdpEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPdEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTraceLocalIsReturned) {
|
||||
AubHelperHw<FamilyType> aubHelper(true);
|
||||
int addressSpace = aubHelper.getMemTraceForPtEntry();
|
||||
EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace);
|
||||
}
|
||||
|
||||
HWTEST_F(AubHelperHwTest, givenLrcaHelperWhenContextIsInitializedThenContextFlagsAreSet) {
|
||||
const auto &csTraits = CommandStreamReceiverSimulatedCommonHw<FamilyType>::getCsTraits(aub_stream::ENGINE_RCS);
|
||||
MockLrcaHelper lrcaHelper(csTraits.mmioBase);
|
||||
|
||||
std::unique_ptr<void, std::function<void(void *)>> lrcaBase(alignedMalloc(csTraits.sizeLRCA, csTraits.alignLRCA), alignedFree);
|
||||
|
||||
lrcaHelper.initialize(lrcaBase.get());
|
||||
ASSERT_NE(0u, lrcaHelper.setContextSaveRestoreFlagsCalled);
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/tbx_command_stream_receiver_hw.h"
|
||||
#include "shared/source/tbx/tbx_proto.h"
|
||||
#include "shared/test/common/mocks/mock_tbx_sockets.h"
|
||||
#include "shared/test/common/mocks/mock_tbx_stream.h"
|
||||
|
||||
@@ -13,16 +14,26 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(TbxStreamTests, givenTbxStreamWhenWriteMemoryIsCalledThenTypeIsZero) {
|
||||
TEST(TbxStreamTests, givenTbxStreamWhenWriteMemoryIsCalledThenMemTypeIsSetCorrectly) {
|
||||
std::unique_ptr<TbxCommandStreamReceiver::TbxStream> mockTbxStream(new MockTbxStream());
|
||||
MockTbxStream *mockTbxStreamPtr = static_cast<MockTbxStream *>(mockTbxStream.get());
|
||||
|
||||
MockTbxSockets *mockTbxSocket = new MockTbxSockets();
|
||||
mockTbxStreamPtr->socket = mockTbxSocket;
|
||||
|
||||
mockTbxStream->writeMemory(0, nullptr, 0, 0, 0);
|
||||
EXPECT_EQ(0u, mockTbxSocket->typeCapturedFromWriteMemory);
|
||||
uint32_t addressSpace = AubMemDump::AddressSpaceValues::TraceLocal;
|
||||
mockTbxStream->writeMemory(0, nullptr, 0, addressSpace, 0);
|
||||
EXPECT_EQ(mem_types::MEM_TYPE_LOCALMEM, mockTbxSocket->typeCapturedFromWriteMemory);
|
||||
|
||||
mockTbxStream->writePTE(0, 0, 0);
|
||||
EXPECT_EQ(0u, mockTbxSocket->typeCapturedFromWriteMemory);
|
||||
addressSpace = AubMemDump::AddressSpaceValues::TraceNonlocal;
|
||||
mockTbxStream->writeMemory(0, nullptr, 0, addressSpace, 0);
|
||||
EXPECT_EQ(mem_types::MEM_TYPE_SYSTEM, mockTbxSocket->typeCapturedFromWriteMemory);
|
||||
|
||||
addressSpace = AubMemDump::AddressSpaceValues::TraceLocal;
|
||||
mockTbxStream->writePTE(0, 0, addressSpace);
|
||||
EXPECT_EQ(mem_types::MEM_TYPE_LOCALMEM, mockTbxSocket->typeCapturedFromWriteMemory);
|
||||
|
||||
addressSpace = AubMemDump::AddressSpaceValues::TraceNonlocal;
|
||||
mockTbxStream->writePTE(0, 0, addressSpace);
|
||||
EXPECT_EQ(mem_types::MEM_TYPE_SYSTEM, mockTbxSocket->typeCapturedFromWriteMemory);
|
||||
}
|
||||
|
||||
@@ -302,3 +302,4 @@ OverrideNotifyEnableForTagUpdatePostSync = -1
|
||||
EnableCacheFlushAfterWalkerForAllQueues = -1
|
||||
Force32BitDriverSupport = -1
|
||||
OverrideCmdQueueSynchronousMode = -1
|
||||
HBMSizePerTileInGigabytes = 0
|
||||
Reference in New Issue
Block a user