diff --git a/runtime/aub_mem_dump/aub_services.h b/runtime/aub_mem_dump/aub_services.h index d0e58d9e23..0150677389 100644 --- a/runtime/aub_mem_dump/aub_services.h +++ b/runtime/aub_mem_dump/aub_services.h @@ -93,6 +93,7 @@ struct CmdServicesMemTraceVersion { enum { Blc = 2, Il = 5, + Glk = 17, Skl = 12, Hsw = 9, Bxt = 14, @@ -106,7 +107,8 @@ struct CmdServicesMemTraceVersion { Vlv = 10, Cln = 1, Kbl = 16, - Bdw = 11 + Bdw = 11, + Cfl = 24 }; }; struct RecordingMethodValues { diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.h b/runtime/command_stream/aub_command_stream_receiver_hw.h index 7ed0265091..a7742881c8 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.h +++ b/runtime/command_stream/aub_command_stream_receiver_hw.h @@ -81,6 +81,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverHw { } engineInfoTable[EngineType::NUM_ENGINES]; std::unique_ptr stream; + uint32_t aubDeviceId; bool standalone; TypeSelector::type ppgtt; diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.inl b/runtime/command_stream/aub_command_stream_receiver_hw.inl index 0cd5a2a148..aaf87e2220 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.inl +++ b/runtime/command_stream/aub_command_stream_receiver_hw.inl @@ -28,6 +28,7 @@ #include "runtime/memory_manager/os_agnostic_memory_manager.h" #include "runtime/gmm_helper/gmm_helper.h" #include "runtime/helpers/string.h" +#include "runtime/os_interface/debug_settings_manager.h" #include namespace OCLRT { @@ -51,6 +52,10 @@ AUBCommandStreamReceiverHw::AUBCommandStreamReceiverHw(const Hardware engineInfo.sizeRingBuffer = 0; engineInfo.tailRingBuffer = 0; } + auto debugDeviceId = DebugManager.flags.OverrideAubDeviceId.get(); + this->aubDeviceId = debugDeviceId == -1 + ? hwInfoIn.capabilityTable.aubDeviceId + : static_cast(debugDeviceId); } template @@ -204,7 +209,7 @@ CommandStreamReceiver *AUBCommandStreamReceiverHw::create(const Hardw DEBUG_BREAK_IF(true); } // Add the file header. - csr->stream->init(AubMemDump::SteppingValues::A, AUB::Traits::device); + csr->stream->init(AubMemDump::SteppingValues::A, csr->aubDeviceId); return csr; } diff --git a/runtime/command_stream/tbx_command_stream_receiver_hw.h b/runtime/command_stream/tbx_command_stream_receiver_hw.h index f39882954a..a429dc64bf 100644 --- a/runtime/command_stream/tbx_command_stream_receiver_hw.h +++ b/runtime/command_stream/tbx_command_stream_receiver_hw.h @@ -88,6 +88,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverHw { void getGTTData(void *memory, AubGTTData &data); TbxCommandStreamReceiver::TbxStream stream; + uint32_t aubDeviceId; TypeSelector::type ppgtt; PDPE ggtt; diff --git a/runtime/command_stream/tbx_command_stream_receiver_hw.inl b/runtime/command_stream/tbx_command_stream_receiver_hw.inl index f43d87917d..3ed9c97da9 100644 --- a/runtime/command_stream/tbx_command_stream_receiver_hw.inl +++ b/runtime/command_stream/tbx_command_stream_receiver_hw.inl @@ -26,6 +26,7 @@ #include "runtime/helpers/ptr_math.h" #include "runtime/memory_manager/graphics_allocation.h" #include "runtime/command_stream/command_stream_receiver_with_aub_dump.h" +#include "runtime/os_interface/debug_settings_manager.h" #include namespace OCLRT { @@ -43,6 +44,10 @@ TbxCommandStreamReceiverHw::TbxCommandStreamReceiverHw(const Hardware engineInfo.sizeRCS = 0; engineInfo.tailRCS = 0; } + auto debugDeviceId = DebugManager.flags.OverrideAubDeviceId.get(); + this->aubDeviceId = debugDeviceId == -1 + ? hwInfoIn.capabilityTable.aubDeviceId + : static_cast(debugDeviceId); } template @@ -175,7 +180,7 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw::create(const Hardw csr->stream.open(nullptr); // Add the file header. - csr->stream.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + csr->stream.init(AubMemDump::SteppingValues::A, csr->aubDeviceId); return csr; } diff --git a/runtime/gen8/hw_info_bdw.inl b/runtime/gen8/hw_info_bdw.inl index 97d51437dd..3f9e23f660 100644 --- a/runtime/gen8/hw_info_bdw.inl +++ b/runtime/gen8/hw_info_bdw.inl @@ -22,6 +22,7 @@ #include "hw_info.h" #include "hw_cmds.h" +#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/helpers/engine_node.h" #include "runtime/memory_manager/memory_constants.h" @@ -74,8 +75,8 @@ const RuntimeCapabilityTable BDW::capabilityTable{ EngineType::ENGINE_RCS, // defaultEngineType MemoryConstants::pageSize, //requiredPreemptionSurfaceSize true, // isCore - false // sourceLevelDebuggerSupported -}; + false, // sourceLevelDebuggerSupported + CmdServicesMemTraceVersion::DeviceValues::Bdw}; const HardwareInfo BDW_1x2x6::hwInfo = { &BDW::platform, diff --git a/runtime/gen9/hw_info_bxt.inl b/runtime/gen9/hw_info_bxt.inl index cab765bdf8..89a1790417 100644 --- a/runtime/gen9/hw_info_bxt.inl +++ b/runtime/gen9/hw_info_bxt.inl @@ -22,6 +22,7 @@ #include "hw_info_bxt.h" #include "hw_cmds.h" +#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/helpers/engine_node.h" #include "runtime/memory_manager/memory_constants.h" @@ -71,8 +72,8 @@ const RuntimeCapabilityTable BXT::capabilityTable{ EngineType::ENGINE_RCS, // defaultEngineType MemoryConstants::pageSize, //requiredPreemptionSurfaceSize false, // isCore - true // sourceLevelDebuggerSupported -}; + true, // sourceLevelDebuggerSupported + CmdServicesMemTraceVersion::DeviceValues::Bxt}; const HardwareInfo BXT_1x2x6::hwInfo = { &BXT::platform, diff --git a/runtime/gen9/hw_info_cfl.inl b/runtime/gen9/hw_info_cfl.inl index 5e1d785ade..20bec95e4c 100644 --- a/runtime/gen9/hw_info_cfl.inl +++ b/runtime/gen9/hw_info_cfl.inl @@ -22,6 +22,7 @@ #include "hw_info_cfl.h" #include "hw_cmds.h" +#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/helpers/engine_node.h" #include "runtime/memory_manager/memory_constants.h" @@ -66,8 +67,8 @@ const RuntimeCapabilityTable CFL::capabilityTable{ EngineType::ENGINE_RCS, // defaultEngineType MemoryConstants::pageSize, //requiredPreemptionSurfaceSize true, // isCore - true // sourceLevelDebuggerSupported -}; + true, // sourceLevelDebuggerSupported + CmdServicesMemTraceVersion::DeviceValues::Cfl}; const HardwareInfo CFL_1x2x6::hwInfo = { &CFL::platform, diff --git a/runtime/gen9/hw_info_glk.inl b/runtime/gen9/hw_info_glk.inl index 183d84c9d2..3e03a07850 100644 --- a/runtime/gen9/hw_info_glk.inl +++ b/runtime/gen9/hw_info_glk.inl @@ -22,6 +22,7 @@ #include "hw_info_glk.h" #include "hw_cmds.h" +#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/helpers/engine_node.h" #include "runtime/memory_manager/memory_constants.h" @@ -66,8 +67,8 @@ const RuntimeCapabilityTable GLK::capabilityTable{ EngineType::ENGINE_RCS, // defaultEngineType MemoryConstants::pageSize, //requiredPreemptionSurfaceSize false, // isCore - true // sourceLevelDebuggerSupported -}; + true, // sourceLevelDebuggerSupported + CmdServicesMemTraceVersion::DeviceValues::Glk}; const HardwareInfo GLK_1x3x6::hwInfo = { &GLK::platform, diff --git a/runtime/gen9/hw_info_kbl.inl b/runtime/gen9/hw_info_kbl.inl index d09bef9572..41ef198e0d 100644 --- a/runtime/gen9/hw_info_kbl.inl +++ b/runtime/gen9/hw_info_kbl.inl @@ -22,6 +22,7 @@ #include "hw_info_kbl.h" #include "hw_cmds.h" +#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/helpers/engine_node.h" #include "runtime/memory_manager/memory_constants.h" @@ -66,8 +67,8 @@ const RuntimeCapabilityTable KBL::capabilityTable{ EngineType::ENGINE_RCS, // defaultEngineType MemoryConstants::pageSize, //requiredPreemptionSurfaceSize true, // isCore - true // sourceLevelDebuggerSupported -}; + true, // sourceLevelDebuggerSupported + CmdServicesMemTraceVersion::DeviceValues::Kbl}; const HardwareInfo KBL_1x2x6::hwInfo = { &KBL::platform, diff --git a/runtime/gen9/hw_info_skl.inl b/runtime/gen9/hw_info_skl.inl index 1b992c2969..a45fcfd651 100644 --- a/runtime/gen9/hw_info_skl.inl +++ b/runtime/gen9/hw_info_skl.inl @@ -22,6 +22,7 @@ #include "hw_info_skl.h" #include "hw_cmds.h" +#include "runtime/aub_mem_dump/aub_services.h" #include "runtime/helpers/engine_node.h" #include "runtime/memory_manager/memory_constants.h" @@ -74,8 +75,8 @@ const RuntimeCapabilityTable SKL::capabilityTable{ EngineType::ENGINE_RCS, // defaultEngineType MemoryConstants::pageSize, //requiredPreemptionSurfaceSize true, // isCore - true // sourceLevelDebuggerSupported -}; + true, // sourceLevelDebuggerSupported + CmdServicesMemTraceVersion::DeviceValues::Skl}; const HardwareInfo SKL_1x2x6::hwInfo = { &SKL::platform, diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index a5db48a4a6..8eb26c6846 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -74,6 +74,7 @@ struct RuntimeCapabilityTable { size_t requiredPreemptionSurfaceSize; bool isCore; bool sourceLevelDebuggerSupported; + uint32_t aubDeviceId; }; struct HardwareCapabilities { diff --git a/runtime/os_interface/DebugVariables.inl b/runtime/os_interface/DebugVariables.inl index ac0e986e14..f3c2f7cf40 100644 --- a/runtime/os_interface/DebugVariables.inl +++ b/runtime/os_interface/DebugVariables.inl @@ -93,3 +93,4 @@ DECLARE_DEBUG_VARIABLE(int32_t, NodeOrdinal, -1, "-1: default do not override, 0 DECLARE_DEBUG_VARIABLE(int32_t, OverrideThreadArbitrationPolicy, -1, "-1 (dont override) or any valid config (0: Age Based, 1: Round Robin)") DECLARE_DEBUG_VARIABLE(bool, HwQueueSupported, false, "Windows only. Pass flag to KMD during Wddm Context creation") DECLARE_DEBUG_VARIABLE(bool, UseMaxSimdSizeToDeduceMaxWorkgroupSize, false, "With this flag on, max workgroup size is deduced using SIMD32 instead of SIMD8, this causes the max wkg size to be 4 times bigger") +DECLARE_DEBUG_VARIABLE(int32_t, OverrideAubDeviceId, -1, "-1 dont override, any other: use this value for AUB generation device id") diff --git a/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp b/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp index 69a184c7ee..ba5184b8f4 100644 --- a/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp +++ b/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.cpp @@ -48,7 +48,8 @@ HWTEST_F(AubMemDumpTests, testHeader) { aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); aubFile.fileHandle.close(); } @@ -62,7 +63,8 @@ HWTEST_F(AubMemDumpTests, reserveMaxAddress) { aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); auto gAddress = static_cast(-1) - 4096; auto pAddress = static_cast(gAddress) & 0xFFFFFFFF; @@ -80,7 +82,8 @@ HWTEST_F(AubMemDumpTests, writeVerifyOneBytePPGTT) { aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); uint8_t byte = 0xbf; auto gAddress = reinterpret_cast(&byte); @@ -101,7 +104,8 @@ HWTEST_F(AubMemDumpTests, writeVerifyOneByteGGTT) { aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); uint8_t byte = 0xbf; uint64_t physAddress = reinterpret_cast(&byte) & 0xFFFFFFFF; @@ -122,7 +126,8 @@ HWTEST_F(AubMemDumpTests, writeVerifySevenBytesPPGTT) { aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); uint8_t bytes[] = {0, 1, 2, 3, 4, 5, 6}; auto gAddress = reinterpret_cast(bytes); @@ -143,7 +148,8 @@ HWTEST_F(AubMemDumpTests, writeVerifySevenBytesGGTT) { aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); uint8_t bytes[] = {0, 1, 2, 3, 4, 5, 6}; uint64_t physAddress = reinterpret_cast(bytes) & 0xFFFFFFFF; diff --git a/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.h b/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.h index 6122bf0fa3..4606015a01 100644 --- a/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.h +++ b/unit_tests/aub_tests/command_stream/aub_mem_dump_tests.h @@ -53,7 +53,8 @@ void setupAUB(const OCLRT::Device *pDevice, OCLRT::EngineType engineType) { aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); aubFile.writeMMIO(mmioBase + 0x229c, 0xffff8280); diff --git a/unit_tests/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h b/unit_tests/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h index 6c6be60c2d..7b33fcbb76 100644 --- a/unit_tests/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h +++ b/unit_tests/aub_tests/gen9/batch_buffer/aub_batch_buffer_tests.h @@ -42,7 +42,8 @@ void setupAUBWithBatchBuffer(const OCLRT::Device *pDevice, OCLRT::EngineType eng aubFile.fileHandle.open(filePath.c_str(), std::ofstream::binary); // Header - aubFile.init(AubMemDump::SteppingValues::A, AUB::Traits::device); + auto deviceId = pDevice->getHardwareInfo().capabilityTable.aubDeviceId; + aubFile.init(AubMemDump::SteppingValues::A, deviceId); aubFile.writeMMIO(mmioBase + 0x229c, 0xffff8280); diff --git a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp index 807ad3768f..eb03b3e8ad 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp @@ -35,8 +35,8 @@ using namespace OCLRT; -using ::testing::Invoke; using ::testing::_; +using ::testing::Invoke; using ::testing::Return; typedef Test AubCommandStreamReceiverTests; @@ -104,6 +104,7 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenTypeIsChe } HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDefaultSettingsThenItHasBatchedDispatchModeEnabled) { + DebugManagerStateRestore stateRestore; DebugManager.flags.CsrDispatchMode.set(0); std::unique_ptr> aubCsr(new MockAubCsr(*platformDevices[0], true)); EXPECT_EQ(DispatchMode::BatchedDispatch, aubCsr->peekDispatchMode()); @@ -1200,3 +1201,17 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe queryGmm.release(); memoryManager->freeGraphicsMemory(imageAllocation); } + +HWTEST_F(AubCommandStreamReceiverTests, givenNoDbgDeviceIdFlagWhenAubCsrIsCreatedThenUseDefaultDeviceId) { + const HardwareInfo &hwInfoIn = *platformDevices[0]; + std::unique_ptr> aubCsr(new MockAubCsr(hwInfoIn, true)); + EXPECT_EQ(hwInfoIn.capabilityTable.aubDeviceId, aubCsr->aubDeviceId); +} + +HWTEST_F(AubCommandStreamReceiverTests, givenDbgDeviceIdFlagIsSetWhenAubCsrIsCreatedThenUseDebugDeviceId) { + DebugManagerStateRestore stateRestore; + DebugManager.flags.OverrideAubDeviceId.set(9); //this is Hsw, not used + const HardwareInfo &hwInfoIn = *platformDevices[0]; + std::unique_ptr> aubCsr(new MockAubCsr(hwInfoIn, true)); + EXPECT_EQ(9u, aubCsr->aubDeviceId); +} diff --git a/unit_tests/command_stream/tbx_command_stream_tests.cpp b/unit_tests/command_stream/tbx_command_stream_tests.cpp index 09c3a81273..4d85a7a62a 100644 --- a/unit_tests/command_stream/tbx_command_stream_tests.cpp +++ b/unit_tests/command_stream/tbx_command_stream_tests.cpp @@ -25,9 +25,11 @@ #include "runtime/command_stream/tbx_command_stream_receiver_hw.h" #include "runtime/command_stream/command_stream_receiver_hw.h" #include "runtime/helpers/ptr_math.h" +#include "runtime/os_interface/debug_settings_manager.h" #include "gen_cmd_parse.h" #include "unit_tests/command_queue/command_queue_fixture.h" #include "unit_tests/fixtures/device_fixture.h" +#include "unit_tests/helpers/debug_manager_state_restore.h" #include "test.h" #include @@ -288,4 +290,18 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh TEST(TbxMemoryManagerTest, givenTbxMemoryManagerWhenItIsQueriedForSystemSharedMemoryThen1GBIsReturned) { TbxMemoryManager memoryManager; EXPECT_EQ(1 * GB, memoryManager.getSystemSharedMemory()); -} \ No newline at end of file +} + +HWTEST_F(TbxCommandStreamTests, givenNoDbgDeviceIdFlagWhenTbxCsrIsCreatedThenUseDefaultDeviceId) { + const HardwareInfo &hwInfo = *platformDevices[0]; + TbxCommandStreamReceiverHw *tbxCsr = reinterpret_cast *>(pCommandStreamReceiver); + EXPECT_EQ(hwInfo.capabilityTable.aubDeviceId, tbxCsr->aubDeviceId); +} + +HWTEST_F(TbxCommandStreamTests, givenDbgDeviceIdFlagIsSetWhenTbxCsrIsCreatedThenUseDebugDeviceId) { + DebugManagerStateRestore stateRestore; + DebugManager.flags.OverrideAubDeviceId.set(9); //this is Hsw, not used + const HardwareInfo &hwInfoIn = *platformDevices[0]; + std::unique_ptr> tbxCsr(reinterpret_cast *>(TbxCommandStreamReceiver::create(hwInfoIn, false))); + EXPECT_EQ(9u, tbxCsr->aubDeviceId); +} diff --git a/unit_tests/test_files/igdrcl.config b/unit_tests/test_files/igdrcl.config index b7554c339b..3bfda07282 100644 --- a/unit_tests/test_files/igdrcl.config +++ b/unit_tests/test_files/igdrcl.config @@ -64,4 +64,5 @@ PrintDispatchParameters = false AddPatchInfoCommentsForAUBDump = false HwQueueSupported = false DisableZeroCopyForUseHostPtr = false -SchedulerGWS = 0 \ No newline at end of file +SchedulerGWS = 0 +OverrideAubDeviceId = -1 \ No newline at end of file