From 83db85cf8674df9bb910d84ade308ae4e4deef9c Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Mon, 5 Jul 2021 14:52:03 +0000 Subject: [PATCH] AubHelper: Local memory support Signed-off-by: Bartosz Dunajski --- opencl/test/unit_test/aub/CMakeLists.txt | 5 +- .../test/unit_test/aub/aub_helper_tests.cpp | 186 +++++++++++++++++- .../test/unit_test/aub/aub_helper_tests.inl | 137 ------------- .../command_stream/tbx_stream_tests.cpp | 21 +- .../test/unit_test/test_files/igdrcl.config | 1 + shared/source/aub/CMakeLists.txt | 3 +- shared/source/aub/aub_helper.cpp | 26 ++- shared/source/aub/aub_helper_extra.cpp | 21 ++ .../debug_settings/debug_variables_base.inl | 1 + shared/source/tbx/tbx_proto.h | 6 + 10 files changed, 249 insertions(+), 158 deletions(-) delete mode 100644 opencl/test/unit_test/aub/aub_helper_tests.inl create mode 100644 shared/source/aub/aub_helper_extra.cpp diff --git a/opencl/test/unit_test/aub/CMakeLists.txt b/opencl/test/unit_test/aub/CMakeLists.txt index e9f18d4914..d669fc7238 100644 --- a/opencl/test/unit_test/aub/CMakeLists.txt +++ b/opencl/test/unit_test/aub/CMakeLists.txt @@ -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) diff --git a/opencl/test/unit_test/aub/aub_helper_tests.cpp b/opencl/test/unit_test/aub/aub_helper_tests.cpp index 90e79a4a71..efd1613392 100644 --- a/opencl/test/unit_test/aub/aub_helper_tests.cpp +++ b/opencl/test/unit_test/aub/aub_helper_tests.cpp @@ -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; + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPml4EntryIsCalledThenTraceNotypeIsReturned) { + AubHelperHw aubHelper(false); + int dataHint = aubHelper.getDataHintForPml4Entry(); + EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); +} + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdpEntryIsCalledThenTraceNotypeIsReturned) { + AubHelperHw aubHelper(false); + int dataHint = aubHelper.getDataHintForPdpEntry(); + EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); +} + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdEntryIsCalledThenTraceNotypeIsReturned) { + AubHelperHw aubHelper(false); + int dataHint = aubHelper.getDataHintForPdEntry(); + EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); +} + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPtEntryIsCalledThenTraceNotypeIsReturned) { + AubHelperHw aubHelper(false); + int dataHint = aubHelper.getDataHintForPtEntry(); + EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); +} + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTracePml4EntryIsReturned) { + AubHelperHw aubHelper(false); + int addressSpace = aubHelper.getMemTraceForPml4Entry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePml4Entry, addressSpace); +} + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTracePhysicalPdpEntryIsReturned) { + AubHelperHw aubHelper(false); + int addressSpace = aubHelper.getMemTraceForPdpEntry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePhysicalPdpEntry, addressSpace); +} + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTracePpgttPdEntryIsReturned) { + AubHelperHw aubHelper(false); + int addressSpace = aubHelper.getMemTraceForPdEntry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttPdEntry, addressSpace); +} + +HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTracePpgttEntryIsReturned) { + AubHelperHw aubHelper(false); + int addressSpace = aubHelper.getMemTraceForPtEntry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttEntry, addressSpace); +} + +HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTraceLocalIsReturned) { + AubHelperHw aubHelper(true); + int addressSpace = aubHelper.getMemTraceForPml4Entry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); +} + +HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTraceLocalIsReturned) { + AubHelperHw aubHelper(true); + int addressSpace = aubHelper.getMemTraceForPdpEntry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); +} + +HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTraceLocalIsReturned) { + AubHelperHw aubHelper(true); + int addressSpace = aubHelper.getMemTraceForPdEntry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); +} + +HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTraceLocalIsReturned) { + AubHelperHw aubHelper(true); + int addressSpace = aubHelper.getMemTraceForPtEntry(); + EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); +} + +HWTEST_F(AubHelperHwTest, givenLrcaHelperWhenContextIsInitializedThenContextFlagsAreSet) { + const auto &csTraits = CommandStreamReceiverSimulatedCommonHw::getCsTraits(aub_stream::ENGINE_RCS); + MockLrcaHelper lrcaHelper(csTraits.mmioBase); + + std::unique_ptr> lrcaBase(alignedMalloc(csTraits.sizeLRCA, csTraits.alignLRCA), alignedFree); + + lrcaHelper.initialize(lrcaBase.get()); + ASSERT_NE(0u, lrcaHelper.setContextSaveRestoreFlagsCalled); } diff --git a/opencl/test/unit_test/aub/aub_helper_tests.inl b/opencl/test/unit_test/aub/aub_helper_tests.inl deleted file mode 100644 index dc652e5afc..0000000000 --- a/opencl/test/unit_test/aub/aub_helper_tests.inl +++ /dev/null @@ -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 AubHelperHwTest; - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPml4EntryIsCalledThenTraceNotypeIsReturned) { - AubHelperHw aubHelper(false); - int dataHint = aubHelper.getDataHintForPml4Entry(); - EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); -} - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdpEntryIsCalledThenTraceNotypeIsReturned) { - AubHelperHw aubHelper(false); - int dataHint = aubHelper.getDataHintForPdpEntry(); - EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); -} - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPdEntryIsCalledThenTraceNotypeIsReturned) { - AubHelperHw aubHelper(false); - int dataHint = aubHelper.getDataHintForPdEntry(); - EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); -} - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetDataHintForPtEntryIsCalledThenTraceNotypeIsReturned) { - AubHelperHw aubHelper(false); - int dataHint = aubHelper.getDataHintForPtEntry(); - EXPECT_EQ(AubMemDump::DataTypeHintValues::TraceNotype, dataHint); -} - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTracePml4EntryIsReturned) { - AubHelperHw aubHelper(false); - int addressSpace = aubHelper.getMemTraceForPml4Entry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePml4Entry, addressSpace); -} - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTracePhysicalPdpEntryIsReturned) { - AubHelperHw aubHelper(false); - int addressSpace = aubHelper.getMemTraceForPdpEntry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePhysicalPdpEntry, addressSpace); -} - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTracePpgttPdEntryIsReturned) { - AubHelperHw aubHelper(false); - int addressSpace = aubHelper.getMemTraceForPdEntry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttPdEntry, addressSpace); -} - -HWTEST_F(AubHelperHwTest, GivenDisabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTracePpgttEntryIsReturned) { - AubHelperHw aubHelper(false); - int addressSpace = aubHelper.getMemTraceForPtEntry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TracePpgttEntry, addressSpace); -} - -HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPml4EntryIsCalledThenTraceLocalIsReturned) { - AubHelperHw aubHelper(true); - int addressSpace = aubHelper.getMemTraceForPml4Entry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); -} - -HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPdpEntryIsCalledThenTraceLocalIsReturned) { - AubHelperHw aubHelper(true); - int addressSpace = aubHelper.getMemTraceForPdpEntry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); -} - -HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPd4EntryIsCalledThenTraceLocalIsReturned) { - AubHelperHw aubHelper(true); - int addressSpace = aubHelper.getMemTraceForPdEntry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); -} - -HWTEST_F(AubHelperHwTest, GivenEnabledLocalMemoryWhenGetMemTraceForPtEntryIsCalledThenTraceLocalIsReturned) { - AubHelperHw aubHelper(true); - int addressSpace = aubHelper.getMemTraceForPtEntry(); - EXPECT_EQ(AubMemDump::AddressSpaceValues::TraceLocal, addressSpace); -} - -HWTEST_F(AubHelperHwTest, givenLrcaHelperWhenContextIsInitializedThenContextFlagsAreSet) { - const auto &csTraits = CommandStreamReceiverSimulatedCommonHw::getCsTraits(aub_stream::ENGINE_RCS); - MockLrcaHelper lrcaHelper(csTraits.mmioBase); - - std::unique_ptr> lrcaBase(alignedMalloc(csTraits.sizeLRCA, csTraits.alignLRCA), alignedFree); - - lrcaHelper.initialize(lrcaBase.get()); - ASSERT_NE(0u, lrcaHelper.setContextSaveRestoreFlagsCalled); -} diff --git a/opencl/test/unit_test/command_stream/tbx_stream_tests.cpp b/opencl/test/unit_test/command_stream/tbx_stream_tests.cpp index e05a1fe499..c9eda1c0e1 100644 --- a/opencl/test/unit_test/command_stream/tbx_stream_tests.cpp +++ b/opencl/test/unit_test/command_stream/tbx_stream_tests.cpp @@ -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 mockTbxStream(new MockTbxStream()); MockTbxStream *mockTbxStreamPtr = static_cast(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); } diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index df3554d4d9..d8cfdc1f6c 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -302,3 +302,4 @@ OverrideNotifyEnableForTagUpdatePostSync = -1 EnableCacheFlushAfterWalkerForAllQueues = -1 Force32BitDriverSupport = -1 OverrideCmdQueueSynchronousMode = -1 +HBMSizePerTileInGigabytes = 0 \ No newline at end of file diff --git a/shared/source/aub/CMakeLists.txt b/shared/source/aub/CMakeLists.txt index 12534b8ffd..d6890b42b3 100644 --- a/shared/source/aub/CMakeLists.txt +++ b/shared/source/aub/CMakeLists.txt @@ -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 diff --git a/shared/source/aub/aub_helper.cpp b/shared/source/aub/aub_helper.cpp index 0adc116657..491031d1d9 100644 --- a/shared/source/aub/aub_helper.cpp +++ b/shared/source/aub/aub_helper.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 diff --git a/shared/source/aub/aub_helper_extra.cpp b/shared/source/aub/aub_helper_extra.cpp new file mode 100644 index 0000000000..c72ae1476c --- /dev/null +++ b/shared/source/aub/aub_helper_extra.cpp @@ -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 diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index c706fb0ccd..af8734b5ab 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -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") diff --git a/shared/source/tbx/tbx_proto.h b/shared/source/tbx/tbx_proto.h index 5f400ab409..c39e13862c 100644 --- a/shared/source/tbx/tbx_proto.h +++ b/shared/source/tbx/tbx_proto.h @@ -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 +};