From 9a582a73688ce5775d2aa9c0cfc2b8d9ea823f00 Mon Sep 17 00:00:00 2001 From: Slawomir Milczarek Date: Sat, 22 Aug 2020 14:12:46 +0200 Subject: [PATCH] Add function to set TBX configuration Related-To: NEO-2948 Change-Id: I765c4270be334f454be887f8d70a7f51360a17e8 Signed-off-by: Slawomir Milczarek --- opencl/source/aub/aub_center.cpp | 4 ++-- opencl/source/aub/aub_helper.cpp | 7 +++++++ opencl/source/aub/aub_helper.h | 1 + opencl/source/aub_mem_dump/aub_stream_stubs.cpp | 2 ++ .../aub/aub_center_using_aubstream_stubs_tests.cpp | 14 ++++++++++++++ opencl/test/unit_test/test_files/igdrcl.config | 1 + .../source/debug_settings/debug_variables_base.inl | 1 + third_party/aub_stream/headers/aubstream.h | 1 + 8 files changed, 29 insertions(+), 2 deletions(-) diff --git a/opencl/source/aub/aub_center.cpp b/opencl/source/aub/aub_center.cpp index 3bf47982aa..c8a3fdb625 100644 --- a/opencl/source/aub/aub_center.cpp +++ b/opencl/source/aub/aub_center.cpp @@ -34,8 +34,8 @@ AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const if (DebugManager.flags.AubDumpAddMmioRegistersList.get() != "unk") { aub_stream::injectMMIOList(AubHelper::getAdditionalMmioList()); } - aub_stream::setTbxServerIp(DebugManager.flags.TbxServer.get()); - aub_stream::setTbxServerPort(DebugManager.flags.TbxPort.get()); + + AubHelper::setTbxConfiguration(); aubManager.reset(createAubManager(pHwInfo->platform.eProductFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubStreamMode, pHwInfo->capabilityTable.gpuAddressSpace)); } diff --git a/opencl/source/aub/aub_helper.cpp b/opencl/source/aub/aub_helper.cpp index eb49da3a76..f628d14d94 100644 --- a/opencl/source/aub/aub_helper.cpp +++ b/opencl/source/aub/aub_helper.cpp @@ -12,6 +12,8 @@ #include "opencl/source/aub_mem_dump/aub_mem_dump.h" +#include "third_party/aub_stream/headers/aubstream.h" + namespace NEO { uint64_t AubHelper::getTotalMemBankSize() { @@ -37,4 +39,9 @@ uint64_t AubHelper::getMemBankSize(const HardwareInfo *pHwInfo) { void AubHelper::setAdditionalMmioList() { } +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/opencl/source/aub/aub_helper.h b/opencl/source/aub/aub_helper.h index 76e002e2db..ef1a48cab1 100644 --- a/opencl/source/aub/aub_helper.h +++ b/opencl/source/aub/aub_helper.h @@ -45,6 +45,7 @@ class AubHelper : public NonCopyableOrMovableClass { static uint64_t getMemBankSize(const HardwareInfo *pHwInfo); static MMIOList getAdditionalMmioList(); static void setAdditionalMmioList(); + static void setTbxConfiguration(); virtual int getDataHintForPml4Entry() const = 0; virtual int getDataHintForPdpEntry() const = 0; diff --git a/opencl/source/aub_mem_dump/aub_stream_stubs.cpp b/opencl/source/aub_mem_dump/aub_stream_stubs.cpp index ea0545550e..f1ab7870ef 100644 --- a/opencl/source/aub_mem_dump/aub_stream_stubs.cpp +++ b/opencl/source/aub_mem_dump/aub_stream_stubs.cpp @@ -11,6 +11,7 @@ namespace aub_stream_stubs { uint16_t tbxServerPort = 4321; std::string tbxServerIp = "127.0.0.1"; +bool tbxFrontdoorMode = false; } // namespace aub_stream_stubs namespace aub_stream { @@ -28,6 +29,7 @@ void setTbxServerIp(std::string server) { if (aub_stream_stubs::tbxServerIp != server) aub_stream_stubs::tbxServerIp = server; }; +void setTbxFrontdoorMode(bool frontdoor) { aub_stream_stubs::tbxFrontdoorMode = frontdoor; } } } // namespace aub_stream diff --git a/opencl/test/unit_test/aub/aub_center_using_aubstream_stubs_tests.cpp b/opencl/test/unit_test/aub/aub_center_using_aubstream_stubs_tests.cpp index ee12687936..d141d40edb 100644 --- a/opencl/test/unit_test/aub/aub_center_using_aubstream_stubs_tests.cpp +++ b/opencl/test/unit_test/aub/aub_center_using_aubstream_stubs_tests.cpp @@ -22,6 +22,7 @@ using namespace NEO; namespace aub_stream_stubs { extern uint16_t tbxServerPort; extern std::string tbxServerIp; +extern bool tbxFrontdoorMode; } // namespace aub_stream_stubs TEST(AubCenter, GivenUseAubStreamDebugVariableSetWhenAubCenterIsCreatedThenAubManagerIsNotCreated) { @@ -57,3 +58,16 @@ TEST(AubCenter, GivenUseAubStreamAndTbxServerPortDebugVariableSetWhenAubCenterIs MockAubCenter aubCenter(defaultHwInfo.get(), false, "", CommandStreamReceiverType::CSR_TBX); EXPECT_EQ(port, aub_stream_stubs::tbxServerPort); } + +TEST(AubCenter, GivenUseAubStreamAndTbxFrontdoorModeDebugVariableSetWhenAubCenterIsCreatedThenFrontdoorModeIsModified) { + DebugManagerStateRestore restorer; + DebugManager.flags.UseAubStream.set(true); + DebugManager.flags.TbxFrontdoorMode.set(true); + + VariableBackup backup(&aub_stream_stubs::tbxFrontdoorMode); + + EXPECT_FALSE(aub_stream_stubs::tbxFrontdoorMode); + + MockAubCenter aubCenter(defaultHwInfo.get(), false, "", CommandStreamReceiverType::CSR_TBX); + EXPECT_TRUE(aub_stream_stubs::tbxFrontdoorMode); +} diff --git a/opencl/test/unit_test/test_files/igdrcl.config b/opencl/test/unit_test/test_files/igdrcl.config index ccdaf900ba..298f130364 100644 --- a/opencl/test/unit_test/test_files/igdrcl.config +++ b/opencl/test/unit_test/test_files/igdrcl.config @@ -19,6 +19,7 @@ AubDumpOverrideMmioRegister = 0 AubDumpOverrideMmioRegisterValue = 0 SetCommandStreamReceiver = -1 TbxPort = 4321 +TbxFrontdoorMode = 0 FlattenBatchBufferForAUBDump = 0 AddPatchInfoCommentsForAUBDump = 0 UseAubStream = 1 diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index 47d94d0b94..ab0c653a78 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -27,6 +27,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, AubDumpOverrideMmioRegister, 0, "Override mmio o DECLARE_DEBUG_VARIABLE(int32_t, AubDumpOverrideMmioRegisterValue, 0, "Value to override mmio offset from AubDumpOverrideMmioRegister") 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(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") DECLARE_DEBUG_VARIABLE(bool, UseAubStream, true, "Use aub_stream for aub dumping") diff --git a/third_party/aub_stream/headers/aubstream.h b/third_party/aub_stream/headers/aubstream.h index cc180899f3..e0eff6dcef 100644 --- a/third_party/aub_stream/headers/aubstream.h +++ b/third_party/aub_stream/headers/aubstream.h @@ -56,5 +56,6 @@ using MMIOList = std::vector; extern "C" void injectMMIOList(MMIOList mmioList); extern "C" void setTbxServerPort(uint16_t port); extern "C" void setTbxServerIp(std::string server); +extern "C" void setTbxFrontdoorMode(bool frontdoor); } // namespace aub_stream