AubHelper: Local memory support
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
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
|
|
@ -8,11 +8,12 @@ set(NEO_CORE_AUB
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_center.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_center.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/aub_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_add_mmio.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_bdw_plus.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/aub_helper_extra.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_mapper_base.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_stream_provider.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_subcapture.cpp
|
||||
|
|
|
@ -7,8 +7,12 @@
|
|||
|
||||
#include "shared/source/aub/aub_helper.h"
|
||||
|
||||
#include "shared/source/aub_mem_dump/page_table_entry_bits.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/tbx/tbx_proto.h"
|
||||
|
||||
#include "aub_mem_dump.h"
|
||||
#include "third_party/aub_stream/headers/aubstream.h"
|
||||
|
@ -16,28 +20,32 @@
|
|||
namespace NEO {
|
||||
|
||||
uint64_t AubHelper::getTotalMemBankSize() {
|
||||
return 2 * GB;
|
||||
return 32ull * MemoryConstants::gigaByte;
|
||||
}
|
||||
|
||||
int AubHelper::getMemTrace(uint64_t pdEntryBits) {
|
||||
if (pdEntryBits & BIT(PageTableEntry::localMemoryBit)) {
|
||||
return AubMemDump::AddressSpaceValues::TraceLocal;
|
||||
}
|
||||
return AubMemDump::AddressSpaceValues::TraceNonlocal;
|
||||
}
|
||||
|
||||
uint64_t AubHelper::getPTEntryBits(uint64_t pdEntryBits) {
|
||||
pdEntryBits &= ~BIT(PageTableEntry::localMemoryBit);
|
||||
return pdEntryBits;
|
||||
}
|
||||
|
||||
uint32_t AubHelper::getMemType(uint32_t addressSpace) {
|
||||
return 0;
|
||||
if (addressSpace == AubMemDump::AddressSpaceValues::TraceLocal) {
|
||||
return mem_types::MEM_TYPE_LOCALMEM;
|
||||
}
|
||||
return mem_types::MEM_TYPE_SYSTEM;
|
||||
}
|
||||
|
||||
uint64_t AubHelper::getMemBankSize(const HardwareInfo *pHwInfo) {
|
||||
return getTotalMemBankSize();
|
||||
}
|
||||
|
||||
void AubHelper::setTbxConfiguration() {
|
||||
aub_stream::setTbxServerIp(DebugManager.flags.TbxServer.get());
|
||||
aub_stream::setTbxServerPort(DebugManager.flags.TbxPort.get());
|
||||
aub_stream::setTbxFrontdoorMode(DebugManager.flags.TbxFrontdoorMode.get());
|
||||
if (DebugManager.flags.HBMSizePerTileInGigabytes.get() > 0) {
|
||||
return DebugManager.flags.HBMSizePerTileInGigabytes.get() * MemoryConstants::gigaByte;
|
||||
}
|
||||
return getTotalMemBankSize() / HwHelper::getSubDevicesCount(pHwInfo);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/aub/aub_helper.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
|
||||
#include "aub_mem_dump.h"
|
||||
#include "third_party/aub_stream/headers/aubstream.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
void AubHelper::setTbxConfiguration() {
|
||||
aub_stream::setTbxServerIp(DebugManager.flags.TbxServer.get());
|
||||
aub_stream::setTbxServerPort(DebugManager.flags.TbxPort.get());
|
||||
aub_stream::setTbxFrontdoorMode(DebugManager.flags.TbxFrontdoorMode.get());
|
||||
}
|
||||
} // namespace NEO
|
|
@ -28,6 +28,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, AubDumpOverrideMmioRegisterValue, 0, "Value to o
|
|||
DECLARE_DEBUG_VARIABLE(int32_t, ClDeviceGlobalMemSizeAvailablePercent, -1, "Percent of total GPU memory available; CL_DEVICE_GLOBAL_MEM_SIZE")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, SetCommandStreamReceiver, -1, "Set command stream receiver to: 0 - HW, 1 - AUB, 2 - TBX, 3 - HW & AUB, 4 - TBX & AUB")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, TbxPort, 4321, "TCP-IP port of TBX server")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, HBMSizePerTileInGigabytes, 0, "Size of HBM memory in GigaBytes per tile.")
|
||||
DECLARE_DEBUG_VARIABLE(bool, TbxFrontdoorMode, false, "Set TBX frontdoor mode for read and write memory accesses (the default mode is via backdoor)")
|
||||
DECLARE_DEBUG_VARIABLE(bool, FlattenBatchBufferForAUBDump, false, "Dump multi-level batch buffers to AUB as single, flat batch buffer")
|
||||
DECLARE_DEBUG_VARIABLE(bool, AddPatchInfoCommentsForAUBDump, false, "Dump comments containing allocations and patching information")
|
||||
|
|
|
@ -456,3 +456,9 @@ struct HAS_MSG {
|
|||
struct HAS_HDR hdr;
|
||||
union HAS_MSG_BODY u;
|
||||
};
|
||||
|
||||
enum mem_types : uint32_t {
|
||||
MEM_TYPE_SYSTEM = 0,
|
||||
MEM_TYPE_LOCALMEM = 1,
|
||||
MEM_TYPE_MAX = 4
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue