diff --git a/CMakeLists.txt b/CMakeLists.txt index ddd40a9923..db36dadbfb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,7 +118,7 @@ endif() if(NOT DEFINED AUB_STREAM_DIR) get_filename_component(TEMP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../aub_stream/aub_mem_dump" ABSOLUTE) if(IS_DIRECTORY ${TEMP_DIR}) - set(AUB_STREAM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../aub_stream/aub_mem_dump") + set(AUB_STREAM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../aub_stream") message(STATUS "Aub Stream dir: ${AUB_STREAM_DIR}") endif() endif(NOT DEFINED AUB_STREAM_DIR) @@ -409,9 +409,10 @@ endif() add_subdirectory(third_party/gtest) +message(STATUS "AUB_STREAM_DIR = ${AUB_STREAM_DIR}" ) if(DEFINED AUB_STREAM_DIR) - set(AUB_STREAM_ENABLE_LIB_NAME "aub_mem_dump_enable") - add_subdirectory(${AUB_STREAM_DIR} ${CMAKE_BINARY_DIR}/aub_stream) + set(AUB_STREAM_PROJECT_NAME "aub_stream") + add_subdirectory(${AUB_STREAM_DIR} ${CMAKE_BINARY_DIR}/aub_stream EXCLUDE_FROM_ALL) endif() add_definitions(-DGMM_OCL) diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 8cd3a0f98e..ce5e5ca07e 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2018 Intel Corporation +# Copyright (C) 2018-2019 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -49,7 +49,7 @@ endif() target_link_libraries(${NEO_STATIC_LIB_NAME} elflib) if(DEFINED AUB_STREAM_DIR) - target_link_libraries(${NEO_STATIC_LIB_NAME} ${AUB_STREAM_LIB_NAME}) + target_link_libraries(${NEO_STATIC_LIB_NAME} ${AUB_STREAM_PROJECT_NAME}) endif() target_include_directories(${NEO_STATIC_LIB_NAME} PRIVATE @@ -118,13 +118,14 @@ if(${GENERATE_EXECUTABLE}) ) if(DEFINED AUB_STREAM_DIR) - list(APPEND NEO_DYNAMIC_LIB__TARGET_OBJECTS $) + list(APPEND NEO_DYNAMIC_LIB__TARGET_OBJECTS $) endif() add_library(${NEO_DYNAMIC_LIB_NAME} SHARED ${NEO_DYNAMIC_LIB__TARGET_OBJECTS} ${IGDRCL_SOURCE_DIR}/runtime/aub/aub_stream_interface.cpp ) + if(TARGET ${GMMUMD_LIB_NAME}) add_dependencies(${NEO_DYNAMIC_LIB_NAME} ${GMMUMD_LIB_NAME}) endif() diff --git a/runtime/aub/aub_center.cpp b/runtime/aub/aub_center.cpp index 02073048d6..00894ec291 100644 --- a/runtime/aub/aub_center.cpp +++ b/runtime/aub/aub_center.cpp @@ -10,14 +10,17 @@ #include "runtime/helpers/hw_info.h" #include "runtime/os_interface/debug_settings_manager.h" #include "third_party/aub_stream/headers/options.h" +#include "third_party/aub_stream/headers/aub_manager.h" namespace OCLRT { +extern aub_stream::AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName); + AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName) { if (DebugManager.flags.UseAubStream.get()) { auto devicesCount = AubHelper::getDevicesCount(pHwInfo); auto memoryBankSize = AubHelper::getMemBankSize(); if (DebugManager.flags.AubDumpAddMmioRegistersList.get() != "unk") { - AubDump::injectMMIOList = AubHelper::getAdditionalMmioList(); + aub_stream::injectMMIOList = AubHelper::getAdditionalMmioList(); } aubManager.reset(createAubManager(pHwInfo->pPlatform->eRenderCoreFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubFileName)); diff --git a/runtime/aub/aub_center.h b/runtime/aub/aub_center.h index b70c849195..1689be5140 100644 --- a/runtime/aub/aub_center.h +++ b/runtime/aub/aub_center.h @@ -9,12 +9,10 @@ #include "runtime/command_stream/aub_stream_provider.h" #include "runtime/memory_manager/address_mapper.h" #include "runtime/memory_manager/physical_address_allocator.h" - #include "third_party/aub_stream/headers/aub_manager.h" namespace OCLRT { struct HardwareInfo; -extern AubDump::AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName); class AubCenter { public: @@ -38,7 +36,7 @@ class AubCenter { return streamProvider.get(); } - AubDump::AubManager *getAubManager() const { + aub_stream::AubManager *getAubManager() const { return aubManager.get(); } @@ -47,6 +45,6 @@ class AubCenter { std::unique_ptr addressMapper; std::unique_ptr streamProvider; - std::unique_ptr aubManager; + std::unique_ptr aubManager; }; } // namespace OCLRT diff --git a/runtime/aub/aub_stream_interface.cpp b/runtime/aub/aub_stream_interface.cpp index 202841895e..7a95eebab2 100644 --- a/runtime/aub/aub_stream_interface.cpp +++ b/runtime/aub/aub_stream_interface.cpp @@ -6,9 +6,9 @@ */ #include "runtime/aub/aub_center.h" -using namespace AubDump; +using namespace aub_stream; namespace OCLRT { AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName) { - return AubDump::AubManager::create(gfxFamily, devicesCount, memoryBankSize, localMemorySupported, aubFileName); + return AubManager::create(gfxFamily, devicesCount, memoryBankSize, localMemorySupported, aubFileName); } } // namespace OCLRT diff --git a/runtime/aub_mem_dump/aub_stream_stubs.cpp b/runtime/aub_mem_dump/aub_stream_stubs.cpp index 2d9b753af1..7b29ceb6ae 100644 --- a/runtime/aub_mem_dump/aub_stream_stubs.cpp +++ b/runtime/aub_mem_dump/aub_stream_stubs.cpp @@ -8,7 +8,7 @@ #include "third_party/aub_stream/headers/aub_manager.h" #include "third_party/aub_stream/headers/options.h" -namespace AubDump { +namespace aub_stream { MMIOList injectMMIOList; diff --git a/runtime/command_stream/command_stream_receiver_simulated_common_hw.h b/runtime/command_stream/command_stream_receiver_simulated_common_hw.h index 519afeb88d..45740fd0c5 100644 --- a/runtime/command_stream/command_stream_receiver_simulated_common_hw.h +++ b/runtime/command_stream/command_stream_receiver_simulated_common_hw.h @@ -9,12 +9,10 @@ #include "runtime/command_stream/command_stream_receiver_hw.h" #include "runtime/gen_common/aub_mapper.h" #include "runtime/memory_manager/memory_banks.h" -#include "third_party/aub_stream/headers/aub_manager.h" #include "third_party/aub_stream/headers/hardware_context.h" -using namespace AubDump; - -namespace AubMemDump { +namespace aub_stream { +class AubManager; struct AubStream; } @@ -45,8 +43,8 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw hardwareContext; + aub_stream::AubManager *aubManager = nullptr; + std::unique_ptr hardwareContext; struct EngineInfo { void *pLRCA; diff --git a/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl b/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl index 1c641d1920..834bf17976 100644 --- a/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl +++ b/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl @@ -10,6 +10,7 @@ #include "runtime/command_stream/command_stream_receiver_simulated_common_hw.h" #include "runtime/os_interface/debug_settings_manager.h" #include "runtime/os_interface/os_context.h" +#include "third_party/aub_stream/headers/aub_manager.h" #include "aub_mapper.h" namespace OCLRT { @@ -86,8 +87,8 @@ void CommandStreamReceiverSimulatedCommonHw::setupContext(OsContext & auto &engineType = osContext.getEngineType(); if (aubManager && !(engineType.type == lowPriorityGpgpuEngine.type && engineType.id == lowPriorityGpgpuEngine.id)) { auto engineIndex = static_cast(getEngineIndex(osContext.getEngineType())); - hardwareContext = std::unique_ptr(aubManager->createHardwareContext(deviceIndex, - engineIndex)); + hardwareContext = std::unique_ptr(aubManager->createHardwareContext(deviceIndex, + engineIndex)); } } } // namespace OCLRT diff --git a/third_party/aub_stream/headers/aub_manager.h b/third_party/aub_stream/headers/aub_manager.h index ecd94ccaba..1d09fae776 100644 --- a/third_party/aub_stream/headers/aub_manager.h +++ b/third_party/aub_stream/headers/aub_manager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Intel Corporation + * Copyright (C) 2018-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,7 +9,7 @@ #include #include -namespace AubDump { +namespace aub_stream { struct HardwareContext; @@ -22,4 +22,4 @@ class AubManager { static AubManager *create(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName); }; -} // namespace AubDump +} // namespace aub_stream diff --git a/third_party/aub_stream/headers/hardware_context.h b/third_party/aub_stream/headers/hardware_context.h index 2607e4c7d5..0162d67182 100644 --- a/third_party/aub_stream/headers/hardware_context.h +++ b/third_party/aub_stream/headers/hardware_context.h @@ -9,7 +9,7 @@ #include #include -namespace AubDump { +namespace aub_stream { struct HardwareContext { virtual void initialize() = 0; @@ -22,4 +22,4 @@ struct HardwareContext { virtual ~HardwareContext() = default; }; -} // namespace AubDump +} // namespace aub_stream diff --git a/third_party/aub_stream/headers/options.h b/third_party/aub_stream/headers/options.h index 681d5b27e3..af1680682e 100644 --- a/third_party/aub_stream/headers/options.h +++ b/third_party/aub_stream/headers/options.h @@ -11,7 +11,7 @@ #include #include -namespace AubDump { +namespace aub_stream { extern std::ostream &log; extern std::string tbxServerIp; @@ -19,6 +19,6 @@ extern uint16_t tbxServerPort; using MMIOPair = std::pair; using MMIOList = std::vector; -extern MMIOList injectMMIOList; +extern "C" MMIOList injectMMIOList; -} // namespace AubDump +} // namespace aub_stream diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 4f0d14d65d..c1ebb590a0 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2017-2018 Intel Corporation +# Copyright (C) 2017-2019 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -79,8 +79,8 @@ if(DEFINED AUB_STREAM_DIR) add_library (aub_stream_mock_lib OBJECT ${IGDRCL_SOURCE_DIR}/unit_tests/aub_stream_mocks/aub_stream_interface_mock.cpp ) - list(APPEND NEO_IGDRCL_TESTS__TARGET_OBJECTS - $ + list(APPEND NEO_IGDRCL_TESTS__TARGET_OBJECTS + $ $ ) else() @@ -91,6 +91,7 @@ add_executable(igdrcl_tests ${NEO_IGDRCL_TESTS__TARGET_OBJECTS} ${IGDRCL_SRCS_tests_local} ) + hide_subdir(gen_common) add_subdirectory(gen_common) diff --git a/unit_tests/aub_stream_mocks/aub_stream_interface_mock.cpp b/unit_tests/aub_stream_mocks/aub_stream_interface_mock.cpp index eb8f31548e..7ce281184b 100644 --- a/unit_tests/aub_stream_mocks/aub_stream_interface_mock.cpp +++ b/unit_tests/aub_stream_mocks/aub_stream_interface_mock.cpp @@ -8,7 +8,7 @@ #include "unit_tests/mocks/mock_aub_manager.h" namespace OCLRT { -AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName) { +aub_stream::AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName) { return new MockAubManager(); } } // namespace OCLRT diff --git a/unit_tests/aub_tests/CMakeLists.txt b/unit_tests/aub_tests/CMakeLists.txt index a474a008b3..1d087d7ad5 100644 --- a/unit_tests/aub_tests/CMakeLists.txt +++ b/unit_tests/aub_tests/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2017-2018 Intel Corporation +# Copyright (C) 2017-2019 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -19,7 +19,7 @@ list(APPEND IGDRCL_AUB_TESTS__TARGET_OBJECTS ) if(DEFINED AUB_STREAM_DIR) - list(APPEND IGDRCL_AUB_TESTS__TARGET_OBJECTS $) + list(APPEND IGDRCL_AUB_TESTS__TARGET_OBJECTS $) endif() add_executable(igdrcl_aub_tests diff --git a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp index 1640c048c2..2d66b5d84b 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -710,13 +710,13 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineI struct InjectMmmioTest : public AubCommandStreamReceiverTests { void SetUp() override { AubCommandStreamReceiverTests::SetUp(); - injectMmioListCopy = AubDump::injectMMIOList; + injectMmioListCopy = aub_stream::injectMMIOList; } void TearDown() override { AubCommandStreamReceiverTests::TearDown(); - AubDump::injectMMIOList = injectMmioListCopy; - AubDump::injectMMIOList.shrink_to_fit(); + aub_stream::injectMMIOList = injectMmioListCopy; + aub_stream::injectMMIOList.shrink_to_fit(); } private: diff --git a/unit_tests/mocks/mock_aub_manager.h b/unit_tests/mocks/mock_aub_manager.h index 0453ac5b05..b3fdf5c934 100644 --- a/unit_tests/mocks/mock_aub_manager.h +++ b/unit_tests/mocks/mock_aub_manager.h @@ -8,9 +8,7 @@ #include "third_party/aub_stream/headers/aub_manager.h" #include "third_party/aub_stream/headers/hardware_context.h" -using namespace AubDump; - -struct MockHardwareContext : public HardwareContext { +struct MockHardwareContext : public aub_stream::HardwareContext { MockHardwareContext(uint32_t deviceIndex, uint32_t engineIndex) : deviceIndex(deviceIndex), engineIndex(engineIndex){}; ~MockHardwareContext() override{}; @@ -35,7 +33,9 @@ struct MockHardwareContext : public HardwareContext { uint32_t engineIndex = 0; }; -class MockAubManager : public AubManager { +class MockAubManager : public aub_stream::AubManager { + using HardwareContext = aub_stream::HardwareContext; + public: MockAubManager(){}; ~MockAubManager() override {}