Refactoring of additional MMIO registers in AubDump

Change-Id: I97c0cc25aa24c6abcff4ba7469d6a6e3f0c12b86
This commit is contained in:
Pawel Wilma
2019-01-14 10:31:06 +01:00
committed by sys_ocldev
parent f18f9a5f88
commit 9036882d11
8 changed files with 95 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2018 Intel Corporation
# Copyright (C) 2018-2019 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -11,6 +11,7 @@ set(RUNTIME_SRCS_AUB
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/aub_helper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper.inl
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_add_mmio.cpp
)
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE ${RUNTIME_SRCS_AUB})
set_property(GLOBAL PROPERTY RUNTIME_SRCS_AUB ${RUNTIME_SRCS_AUB})

View File

@@ -9,12 +9,17 @@
#include "runtime/aub/aub_helper.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include "third_party/aub_stream/headers/options.h"
namespace OCLRT {
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();
}
aubManager.reset(createAubManager(pHwInfo->pPlatform->eRenderCoreFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubFileName));
}
addressMapper = std::make_unique<AddressMapper>();

View File

@@ -6,6 +6,7 @@
*/
#pragma once
#include "runtime/gen_common/aub_mapper_base.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/helpers/properties_helper.h"
#include "runtime/memory_manager/graphics_allocation.h"
@@ -32,6 +33,7 @@ class AubHelper : public NonCopyableOrMovableClass {
static uint32_t getMemType(uint32_t addressSpace);
static uint64_t getMemBankSize();
static uint32_t getDevicesCount(const HardwareInfo *pHwInfo);
static MMIOList getAdditionalMmioList();
virtual int getDataHintForPml4Entry() const = 0;
virtual int getDataHintForPdpEntry() const = 0;
@@ -42,6 +44,9 @@ class AubHelper : public NonCopyableOrMovableClass {
virtual int getMemTraceForPdpEntry() const = 0;
virtual int getMemTraceForPdEntry() const = 0;
virtual int getMemTraceForPtEntry() const = 0;
protected:
static MMIOList splitMMIORegisters(const std::string &registers, char delimiter);
};
template <typename GfxFamily>

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/aub/aub_helper.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include "third_party/aub_stream/headers/options.h"
namespace OCLRT {
MMIOList AubHelper::getAdditionalMmioList() {
return splitMMIORegisters(DebugManager.flags.AubDumpAddMmioRegistersList.get(), ';');
}
MMIOList AubHelper::splitMMIORegisters(const std::string &registers, char delimiter) {
MMIOList result;
bool firstElementInPair = false;
std::string token;
uint32_t registerOffset = 0;
uint32_t registerValue = 0;
std::istringstream stream("");
for (std::string::const_iterator i = registers.begin();; i++) {
if (i == registers.end() || *i == delimiter) {
if (token.size() > 0) {
stream.str(token);
stream.clear();
firstElementInPair = !firstElementInPair;
stream >> std::hex >> (firstElementInPair ? registerOffset : registerValue);
if (stream.fail()) {
result.clear();
break;
}
token.clear();
if (!firstElementInPair) {
result.push_back(std::pair<uint32_t, uint32_t>(registerOffset, registerValue));
registerValue = 0;
registerOffset = 0;
}
}
if (i == registers.end()) {
break;
}
} else {
token.push_back(*i);
}
}
return result;
}
} // namespace OCLRT