Add aub_stream headers

Change-Id: I4d9420210e2a06d8a36abc0cf272901514ff3547
This commit is contained in:
Hoppe, Mateusz
2018-10-30 18:29:32 +01:00
committed by sys_ocldev
parent 8504b37a08
commit e6b93941ee
11 changed files with 213 additions and 1 deletions

View File

@@ -105,6 +105,21 @@ if(NOT SOURCE_LEVEL_DEBUGGER_HEADERS_DIR)
endif()
endif(NOT SOURCE_LEVEL_DEBUGGER_HEADERS_DIR)
get_filename_component(AUB_STREAM_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/aub_stream/headers" ABSOLUTE)
if(IS_DIRECTORY ${AUB_STREAM_HEADERS_DIR})
message(STATUS "Aub Stream Headers dir: ${AUB_STREAM_HEADERS_DIR}")
else()
message(FATAL_ERROR "Aub Stream headers not available!")
endif()
if(NOT DEFINED AUB_STREAM_DIR)
get_filename_component(TEMP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/aub_stream/aub_mem_dump" ABSOLUTE)
if(IS_DIRECTORY ${TEMP_DIR})
set(AUB_STREAM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/aub_stream/aub_mem_dump")
message(STATUS "Aub Stream dir: ${AUB_STREAM_DIR}")
endif()
endif(NOT DEFINED AUB_STREAM_DIR)
if(LIBDRM_DIR)
get_filename_component(I915_INCLUDES_DIR "${LIBDRM_DIR}/include" ABSOLUTE)
else()
@@ -344,7 +359,11 @@ if(NEO_BITS STREQUAL "64")
set(SLD_LIBRARY_NAME "${SLD_LIBRARY_NAME}${NEO_BITS}")
endif()
add_subdirectory(third_party/gtest)
if(DEFINED AUB_STREAM_DIR)
add_subdirectory(${AUB_STREAM_DIR})
endif()
add_definitions(-DGMM_OCL)

View File

@@ -48,6 +48,9 @@ if(WIN32)
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})
endif()
target_include_directories(${NEO_STATIC_LIB_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}

View File

@@ -15,6 +15,13 @@ set(RUNTIME_SRCS_AUB_MEM_DUMP
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/context_flags.cpp
${CMAKE_CURRENT_SOURCE_DIR}/page_table_entry_bits.h
)
if(NOT DEFINED AUB_STREAM_DIR)
list(APPEND RUNTIME_SRCS_AUB_MEM_DUMP
${CMAKE_CURRENT_SOURCE_DIR}/aub_stream_stubs.cpp
)
endif()
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_AUB_MEM_DUMP})
set_property(GLOBAL PROPERTY RUNTIME_SRCS_AUB_MEM_DUMP ${RUNTIME_SRCS_AUB_MEM_DUMP})
add_subdirectories()

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "third_party/aub_stream/headers/aub_manager.h"
#include "third_party/aub_stream/headers/aub_streamer.h"
namespace AubDump {
struct AubFileStream {};
struct PhysicalAddressAllocator {};
struct GGTT {};
struct PML4 {};
struct PDP4 {};
AubManager::AubManager(uint32_t devicesCount, bool localMemorySupported, std::string &aubFileName) {
}
void AubManager::initialize(uint32_t devicesCount, bool localMemorySupported) {
}
AubManager::~AubManager() {
}
AubStreamer *AubManager::createAubStreamer(uint32_t gfxFamily, uint32_t device, uint32_t engine) {
return nullptr;
}
AubStreamer::~AubStreamer() {
}
void AubStreamer::writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, size_t pageSize) {
}
void AubStreamer::expectMemory(uint64_t gfxAddress, const void *memory, size_t size) {
}
void AubStreamer::dumpBuffer(uint64_t gfxAddress, size_t size) {
}
void AubStreamer::dumpImage(uint64_t gfxAddress, size_t size) {
}
void AubStreamer::submit(uint64_t batchBufferGfxAddress, const void *batchBuffer, size_t size, uint32_t memoryBank) {
}
void AubStreamer::pollForCompletion() {
}
} // namespace AubDump

View File

@@ -10,11 +10,18 @@
#include "runtime/memory_manager/address_mapper.h"
#include "runtime/memory_manager/physical_address_allocator.h"
#include "third_party/aub_stream/headers/aub_manager.h"
#include "third_party/aub_stream/headers/aub_streamer.h"
namespace OCLRT {
class AubCenter {
public:
AubCenter() {
if (DebugManager.flags.UseAubStream.get()) {
std::string filename("aub.aub");
aubManager = std::make_unique<AubDump::AubManager>(1, false, filename);
}
addressMapper = std::make_unique<AddressMapper>();
streamProvider = std::make_unique<AubFileStreamProvider>();
}
@@ -40,5 +47,7 @@ class AubCenter {
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
std::unique_ptr<AddressMapper> addressMapper;
std::unique_ptr<AubStreamProvider> streamProvider;
std::unique_ptr<AubDump::AubManager> aubManager;
};
} // namespace OCLRT

View File

@@ -24,6 +24,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, TbxPort, 4321, "TCP-IP port of TBX server")
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, UseMallocToObtainHeap32Base, false, "Instead of using dedicated ranges, use pointer from malloc as heap base.")
DECLARE_DEBUG_VARIABLE(bool, UseAubStream, false, "Use aub_stream for aub dumping")
/*DEBUG FLAGS*/
DECLARE_DEBUG_VARIABLE(int32_t, SchedulerSimulationReturnInstance, 0, "prints execution model related debug information")

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <memory>
#include <string>
#include <vector>
namespace AubDump {
class AubStreamer;
struct AubFileStream;
struct PhysicalAddressAllocator;
struct GGTT;
struct PML4;
struct PDP4;
using PPGTT = typename std::conditional<sizeof(void *) == 8, PML4, PDP4>::type;
class AubManager {
public:
AubManager(uint32_t devicesCount, bool localMemorySupported, std::string &aubFileName);
virtual ~AubManager();
AubManager &operator=(const AubManager &) = delete;
AubManager(const AubManager &) = delete;
GGTT *getGGTT(uint32_t index) {
return ggtts.at(index).get();
}
PPGTT *getPPGTT(uint32_t index) {
return ppgtts.at(index).get();
}
PhysicalAddressAllocator *getPysicalAddressAllocator() {
return physicalAddressAllocator.get();
}
AubFileStream *getAubFileStream() {
return aubFileStream.get();
}
AubStreamer *createAubStreamer(uint32_t gfxFamily, uint32_t device, uint32_t engine);
protected:
void initialize(uint32_t devicesCount, bool localMemorySupported);
uint32_t devicesCount = 0;
std::unique_ptr<AubFileStream> aubFileStream;
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
std::vector<std::unique_ptr<PPGTT>> ppgtts;
std::vector<std::unique_ptr<GGTT>> ggtts;
};
} // namespace AubDump

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <cstdint>
namespace AubDump {
class AubStreamer {
public:
void writeMemory(uint64_t gfxAddress, const void *memory, size_t size, uint32_t memoryBanks, size_t pageSize);
void expectMemory(uint64_t gfxAddress, const void *memory, size_t size);
void dumpBuffer(uint64_t gfxAddress, size_t size);
void dumpImage(uint64_t gfxAddress, size_t size);
void submit(uint64_t batchBufferGfxAddress, const void *batchBuffer, size_t size, uint32_t memoryBank);
void pollForCompletion();
class AubStreamerImpl;
AubStreamerImpl *aubStreamerImpl;
~AubStreamer();
};
} // namespace AubDump

View File

@@ -6,6 +6,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}/aub_helper_tests.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_aub_helper_tests})

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/command_stream/aub_center.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "gtest/gtest.h"
using namespace OCLRT;
class MockAubCenter : public AubCenter {
public:
using AubCenter::AubCenter;
using AubCenter::aubManager;
};
TEST(AubCenter, GivenUseAubStreamDebugVarSetWhenAubCenterIsCreatedThenAubMangerIsInitialized) {
DebugManagerStateRestore restorer;
DebugManager.flags.UseAubStream.set(true);
MockAubCenter aubCenter;
EXPECT_NE(nullptr, aubCenter.aubManager.get());
}

View File

@@ -90,4 +90,5 @@ AddClGlSharing = 0
EnablePassInlineData = false
LimitAmountOfReturnedDevices = 0
UseMallocToObtainHeap32Base = false
EnableLocalMemory = false
EnableLocalMemory = false
UseAubStream = false