mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Reorganization directory structure [1/n]
Change-Id: Id1a94577437a4826a32411869f516fec20314ec0
This commit is contained in:
19
opencl/source/aub/CMakeLists.txt
Normal file
19
opencl/source/aub/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
#
|
||||
# Copyright (C) 2018-2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(RUNTIME_SRCS_AUB
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_center.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_center.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/aub_helper.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_base.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_bdw_plus.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})
|
||||
add_subdirectories()
|
||||
88
opencl/source/aub/aub_center.cpp
Normal file
88
opencl/source/aub/aub_center.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "aub/aub_center.h"
|
||||
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "core/helpers/hw_info.h"
|
||||
|
||||
#include "aub/aub_helper.h"
|
||||
#include "third_party/aub_stream/headers/aub_manager.h"
|
||||
#include "third_party/aub_stream/headers/aubstream.h"
|
||||
|
||||
namespace NEO {
|
||||
extern aub_stream::AubManager *createAubManager(uint32_t productFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, uint32_t streamMode);
|
||||
|
||||
AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
|
||||
if (DebugManager.flags.UseAubStream.get()) {
|
||||
auto devicesCount = HwHelper::getSubDevicesCount(pHwInfo);
|
||||
auto memoryBankSize = AubHelper::getMemBankSize(pHwInfo);
|
||||
CommandStreamReceiverType type = csrType;
|
||||
if (DebugManager.flags.SetCommandStreamReceiver.get() >= CommandStreamReceiverType::CSR_HW) {
|
||||
type = static_cast<CommandStreamReceiverType>(DebugManager.flags.SetCommandStreamReceiver.get());
|
||||
}
|
||||
|
||||
aubStreamMode = getAubStreamMode(aubFileName, type);
|
||||
|
||||
AubHelper::setAdditionalMmioList();
|
||||
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());
|
||||
|
||||
aubManager.reset(createAubManager(pHwInfo->platform.eProductFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubStreamMode));
|
||||
}
|
||||
addressMapper = std::make_unique<AddressMapper>();
|
||||
streamProvider = std::make_unique<AubFileStreamProvider>();
|
||||
subCaptureCommon = std::make_unique<AubSubCaptureCommon>();
|
||||
if (DebugManager.flags.AUBDumpSubCaptureMode.get()) {
|
||||
this->subCaptureCommon->subCaptureMode = static_cast<AubSubCaptureCommon::SubCaptureMode>(DebugManager.flags.AUBDumpSubCaptureMode.get());
|
||||
this->subCaptureCommon->subCaptureFilter.dumpKernelStartIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterKernelStartIdx.get());
|
||||
this->subCaptureCommon->subCaptureFilter.dumpKernelEndIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterKernelEndIdx.get());
|
||||
this->subCaptureCommon->subCaptureFilter.dumpNamedKernelStartIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterNamedKernelStartIdx.get());
|
||||
this->subCaptureCommon->subCaptureFilter.dumpNamedKernelEndIdx = static_cast<uint32_t>(DebugManager.flags.AUBDumpFilterNamedKernelEndIdx.get());
|
||||
if (DebugManager.flags.AUBDumpFilterKernelName.get() != "unk") {
|
||||
this->subCaptureCommon->subCaptureFilter.dumpKernelName = DebugManager.flags.AUBDumpFilterKernelName.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AubCenter::AubCenter() {
|
||||
addressMapper = std::make_unique<AddressMapper>();
|
||||
streamProvider = std::make_unique<AubFileStreamProvider>();
|
||||
subCaptureCommon = std::make_unique<AubSubCaptureCommon>();
|
||||
}
|
||||
|
||||
AubCenter::~AubCenter() {
|
||||
if (DebugManager.flags.UseAubStream.get()) {
|
||||
aub_stream::injectMMIOList(MMIOList{});
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t AubCenter::getAubStreamMode(const std::string &aubFileName, uint32_t csrType) {
|
||||
uint32_t mode = aub_stream::mode::aubFile;
|
||||
|
||||
switch (csrType) {
|
||||
case CommandStreamReceiverType::CSR_HW_WITH_AUB:
|
||||
case CommandStreamReceiverType::CSR_AUB:
|
||||
mode = aub_stream::mode::aubFile;
|
||||
break;
|
||||
case CommandStreamReceiverType::CSR_TBX:
|
||||
mode = aub_stream::mode::tbx;
|
||||
break;
|
||||
case CommandStreamReceiverType::CSR_TBX_WITH_AUB:
|
||||
mode = aub_stream::mode::aubFileAndTbx;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
} // namespace NEO
|
||||
62
opencl/source/aub/aub_center.h
Normal file
62
opencl/source/aub/aub_center.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/helpers/options.h"
|
||||
|
||||
#include "command_stream/aub_stream_provider.h"
|
||||
#include "command_stream/aub_subcapture.h"
|
||||
#include "memory_manager/address_mapper.h"
|
||||
#include "memory_manager/physical_address_allocator.h"
|
||||
#include "third_party/aub_stream/headers/aub_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
struct HardwareInfo;
|
||||
|
||||
class AubCenter {
|
||||
public:
|
||||
AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
|
||||
|
||||
AubCenter();
|
||||
virtual ~AubCenter();
|
||||
|
||||
void initPhysicalAddressAllocator(PhysicalAddressAllocator *pPhysicalAddressAllocator) {
|
||||
physicalAddressAllocator = std::unique_ptr<PhysicalAddressAllocator>(pPhysicalAddressAllocator);
|
||||
}
|
||||
|
||||
PhysicalAddressAllocator *getPhysicalAddressAllocator() const {
|
||||
return physicalAddressAllocator.get();
|
||||
}
|
||||
|
||||
AddressMapper *getAddressMapper() const {
|
||||
return addressMapper.get();
|
||||
}
|
||||
|
||||
AubStreamProvider *getStreamProvider() const {
|
||||
return streamProvider.get();
|
||||
}
|
||||
|
||||
AubSubCaptureCommon *getSubCaptureCommon() const {
|
||||
return subCaptureCommon.get();
|
||||
}
|
||||
|
||||
aub_stream::AubManager *getAubManager() const {
|
||||
return aubManager.get();
|
||||
}
|
||||
|
||||
static uint32_t getAubStreamMode(const std::string &aubFileName, uint32_t csrType);
|
||||
|
||||
protected:
|
||||
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
|
||||
std::unique_ptr<AddressMapper> addressMapper;
|
||||
std::unique_ptr<AubStreamProvider> streamProvider;
|
||||
|
||||
std::unique_ptr<AubSubCaptureCommon> subCaptureCommon;
|
||||
std::unique_ptr<aub_stream::AubManager> aubManager;
|
||||
uint32_t aubStreamMode = 0;
|
||||
};
|
||||
} // namespace NEO
|
||||
40
opencl/source/aub/aub_helper.cpp
Normal file
40
opencl/source/aub/aub_helper.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "aub/aub_helper.h"
|
||||
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
#include "core/helpers/basic_math.h"
|
||||
|
||||
#include "aub_mem_dump/aub_mem_dump.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
uint64_t AubHelper::getTotalMemBankSize() {
|
||||
return 2 * GB;
|
||||
}
|
||||
|
||||
int AubHelper::getMemTrace(uint64_t pdEntryBits) {
|
||||
return AubMemDump::AddressSpaceValues::TraceNonlocal;
|
||||
}
|
||||
|
||||
uint64_t AubHelper::getPTEntryBits(uint64_t pdEntryBits) {
|
||||
return pdEntryBits;
|
||||
}
|
||||
|
||||
uint32_t AubHelper::getMemType(uint32_t addressSpace) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t AubHelper::getMemBankSize(const HardwareInfo *pHwInfo) {
|
||||
return getTotalMemBankSize();
|
||||
}
|
||||
|
||||
void AubHelper::setAdditionalMmioList() {
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
82
opencl/source/aub/aub_helper.h
Normal file
82
opencl/source/aub/aub_helper.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "core/helpers/hw_info.h"
|
||||
#include "core/helpers/non_copyable_or_moveable.h"
|
||||
#include "core/memory_manager/graphics_allocation.h"
|
||||
|
||||
#include "gen_common/aub_mapper_base.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class AubHelper : public NonCopyableOrMovableClass {
|
||||
public:
|
||||
static bool isOneTimeAubWritableAllocationType(const GraphicsAllocation::AllocationType &type) {
|
||||
switch (type) {
|
||||
case GraphicsAllocation::AllocationType::PIPE:
|
||||
case GraphicsAllocation::AllocationType::CONSTANT_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::GLOBAL_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::KERNEL_ISA:
|
||||
case GraphicsAllocation::AllocationType::PRIVATE_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::SCRATCH_SURFACE:
|
||||
case GraphicsAllocation::AllocationType::BUFFER:
|
||||
case GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY:
|
||||
case GraphicsAllocation::AllocationType::BUFFER_COMPRESSED:
|
||||
case GraphicsAllocation::AllocationType::IMAGE:
|
||||
case GraphicsAllocation::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER:
|
||||
case GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR:
|
||||
case GraphicsAllocation::AllocationType::MAP_ALLOCATION:
|
||||
case GraphicsAllocation::AllocationType::SVM_GPU:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t getTotalMemBankSize();
|
||||
static int getMemTrace(uint64_t pdEntryBits);
|
||||
static uint64_t getPTEntryBits(uint64_t pdEntryBits);
|
||||
static uint32_t getMemType(uint32_t addressSpace);
|
||||
static uint64_t getMemBankSize(const HardwareInfo *pHwInfo);
|
||||
static MMIOList getAdditionalMmioList();
|
||||
static void setAdditionalMmioList();
|
||||
|
||||
virtual int getDataHintForPml4Entry() const = 0;
|
||||
virtual int getDataHintForPdpEntry() const = 0;
|
||||
virtual int getDataHintForPdEntry() const = 0;
|
||||
virtual int getDataHintForPtEntry() const = 0;
|
||||
|
||||
virtual int getMemTraceForPml4Entry() const = 0;
|
||||
virtual int getMemTraceForPdpEntry() const = 0;
|
||||
virtual int getMemTraceForPdEntry() const = 0;
|
||||
virtual int getMemTraceForPtEntry() const = 0;
|
||||
|
||||
protected:
|
||||
static MMIOList splitMMIORegisters(const std::string ®isters, char delimiter);
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
class AubHelperHw : public AubHelper {
|
||||
public:
|
||||
AubHelperHw(bool localMemoryEnabled) : localMemoryEnabled(localMemoryEnabled){};
|
||||
|
||||
int getDataHintForPml4Entry() const override;
|
||||
int getDataHintForPdpEntry() const override;
|
||||
int getDataHintForPdEntry() const override;
|
||||
int getDataHintForPtEntry() const override;
|
||||
|
||||
int getMemTraceForPml4Entry() const override;
|
||||
int getMemTraceForPdpEntry() const override;
|
||||
int getMemTraceForPdEntry() const override;
|
||||
int getMemTraceForPtEntry() const override;
|
||||
|
||||
protected:
|
||||
bool localMemoryEnabled;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
55
opencl/source/aub/aub_helper_add_mmio.cpp
Normal file
55
opencl/source/aub/aub_helper_add_mmio.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
|
||||
#include "aub/aub_helper.h"
|
||||
#include "third_party/aub_stream/headers/aubstream.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
MMIOList AubHelper::getAdditionalMmioList() {
|
||||
return splitMMIORegisters(DebugManager.flags.AubDumpAddMmioRegistersList.get(), ';');
|
||||
}
|
||||
|
||||
MMIOList AubHelper::splitMMIORegisters(const std::string ®isters, 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 NEO
|
||||
45
opencl/source/aub/aub_helper_base.inl
Normal file
45
opencl/source/aub/aub_helper_base.inl
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "aub/aub_helper.h"
|
||||
#include "aub_mem_dump/aub_mem_dump.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename Family>
|
||||
int AubHelperHw<Family>::getMemTraceForPml4Entry() const {
|
||||
if (localMemoryEnabled) {
|
||||
return AubMemDump::AddressSpaceValues::TraceLocal;
|
||||
}
|
||||
return AubMemDump::AddressSpaceValues::TracePml4Entry;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
int AubHelperHw<Family>::getMemTraceForPdpEntry() const {
|
||||
if (localMemoryEnabled) {
|
||||
return AubMemDump::AddressSpaceValues::TraceLocal;
|
||||
}
|
||||
return AubMemDump::AddressSpaceValues::TracePhysicalPdpEntry;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
int AubHelperHw<Family>::getMemTraceForPdEntry() const {
|
||||
if (localMemoryEnabled) {
|
||||
return AubMemDump::AddressSpaceValues::TraceLocal;
|
||||
}
|
||||
return AubMemDump::AddressSpaceValues::TracePpgttPdEntry;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
int AubHelperHw<Family>::getMemTraceForPtEntry() const {
|
||||
if (localMemoryEnabled) {
|
||||
return AubMemDump::AddressSpaceValues::TraceLocal;
|
||||
}
|
||||
return AubMemDump::AddressSpaceValues::TracePpgttEntry;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
32
opencl/source/aub/aub_helper_bdw_plus.inl
Normal file
32
opencl/source/aub/aub_helper_bdw_plus.inl
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "aub/aub_helper_base.inl"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
int AubHelperHw<GfxFamily>::getDataHintForPml4Entry() const {
|
||||
return AubMemDump::DataTypeHintValues::TraceNotype;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
int AubHelperHw<GfxFamily>::getDataHintForPdpEntry() const {
|
||||
return AubMemDump::DataTypeHintValues::TraceNotype;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
int AubHelperHw<GfxFamily>::getDataHintForPdEntry() const {
|
||||
return AubMemDump::DataTypeHintValues::TraceNotype;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
int AubHelperHw<GfxFamily>::getDataHintForPtEntry() const {
|
||||
return AubMemDump::DataTypeHintValues::TraceNotype;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
14
opencl/source/aub/aub_stream_interface.cpp
Normal file
14
opencl/source/aub/aub_stream_interface.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "aub/aub_center.h"
|
||||
using namespace aub_stream;
|
||||
namespace NEO {
|
||||
AubManager *createAubManager(uint32_t gfxFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, uint32_t streamMode) {
|
||||
return AubManager::create(gfxFamily, devicesCount, memoryBankSize, localMemorySupported, streamMode);
|
||||
}
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user