2018-11-11 05:25:48 +08:00
|
|
|
/*
|
2020-01-14 17:57:55 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-11-11 05:25:48 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/aub/aub_center.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/aub/aub_helper.h"
|
2019-02-05 21:16:37 +08:00
|
|
|
|
2019-01-19 04:44:23 +08:00
|
|
|
#include "third_party/aub_stream/headers/aub_manager.h"
|
2019-03-26 23:30:28 +08:00
|
|
|
#include "third_party/aub_stream/headers/aubstream.h"
|
2018-11-11 05:25:48 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2020-02-26 23:36:55 +08:00
|
|
|
extern aub_stream::AubManager *createAubManager(uint32_t productFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, uint32_t streamMode, uint64_t gpuAddressSpace);
|
2019-01-19 04:44:23 +08:00
|
|
|
|
2019-02-08 22:08:35 +08:00
|
|
|
AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
|
2018-11-11 05:25:48 +08:00
|
|
|
if (DebugManager.flags.UseAubStream.get()) {
|
2020-01-20 22:46:03 +08:00
|
|
|
auto devicesCount = HwHelper::getSubDevicesCount(pHwInfo);
|
2019-02-12 20:37:39 +08:00
|
|
|
auto memoryBankSize = AubHelper::getMemBankSize(pHwInfo);
|
2019-02-19 15:55:11 +08:00
|
|
|
CommandStreamReceiverType type = csrType;
|
|
|
|
if (DebugManager.flags.SetCommandStreamReceiver.get() >= CommandStreamReceiverType::CSR_HW) {
|
|
|
|
type = static_cast<CommandStreamReceiverType>(DebugManager.flags.SetCommandStreamReceiver.get());
|
|
|
|
}
|
|
|
|
|
2019-02-08 22:08:35 +08:00
|
|
|
aubStreamMode = getAubStreamMode(aubFileName, type);
|
2019-02-05 21:16:37 +08:00
|
|
|
|
2020-01-14 17:57:55 +08:00
|
|
|
AubHelper::setAdditionalMmioList();
|
2019-01-14 17:31:06 +08:00
|
|
|
if (DebugManager.flags.AubDumpAddMmioRegistersList.get() != "unk") {
|
2019-02-23 08:35:37 +08:00
|
|
|
aub_stream::injectMMIOList(AubHelper::getAdditionalMmioList());
|
2019-01-14 17:31:06 +08:00
|
|
|
}
|
2019-02-23 08:35:37 +08:00
|
|
|
aub_stream::setTbxServerIp(DebugManager.flags.TbxServer.get());
|
|
|
|
aub_stream::setTbxServerPort(DebugManager.flags.TbxPort.get());
|
2019-01-14 17:31:06 +08:00
|
|
|
|
2020-02-26 23:36:55 +08:00
|
|
|
aubManager.reset(createAubManager(pHwInfo->platform.eProductFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubStreamMode, pHwInfo->capabilityTable.gpuAddressSpace));
|
2018-11-11 05:25:48 +08:00
|
|
|
}
|
|
|
|
addressMapper = std::make_unique<AddressMapper>();
|
|
|
|
streamProvider = std::make_unique<AubFileStreamProvider>();
|
2019-06-03 15:57:27 +08:00
|
|
|
subCaptureCommon = std::make_unique<AubSubCaptureCommon>();
|
2019-02-20 05:50:52 +08:00
|
|
|
if (DebugManager.flags.AUBDumpSubCaptureMode.get()) {
|
2019-06-03 15:57:27 +08:00
|
|
|
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());
|
2019-02-20 05:50:52 +08:00
|
|
|
if (DebugManager.flags.AUBDumpFilterKernelName.get() != "unk") {
|
2019-06-03 15:57:27 +08:00
|
|
|
this->subCaptureCommon->subCaptureFilter.dumpKernelName = DebugManager.flags.AUBDumpFilterKernelName.get();
|
2019-02-20 05:50:52 +08:00
|
|
|
}
|
|
|
|
}
|
2018-11-11 05:25:48 +08:00
|
|
|
}
|
2018-12-11 00:12:32 +08:00
|
|
|
|
|
|
|
AubCenter::AubCenter() {
|
|
|
|
addressMapper = std::make_unique<AddressMapper>();
|
|
|
|
streamProvider = std::make_unique<AubFileStreamProvider>();
|
2019-06-03 15:57:27 +08:00
|
|
|
subCaptureCommon = std::make_unique<AubSubCaptureCommon>();
|
2018-12-11 00:12:32 +08:00
|
|
|
}
|
2019-02-05 21:16:37 +08:00
|
|
|
|
2019-02-23 08:35:37 +08:00
|
|
|
AubCenter::~AubCenter() {
|
|
|
|
if (DebugManager.flags.UseAubStream.get()) {
|
|
|
|
aub_stream::injectMMIOList(MMIOList{});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-05 21:16:37 +08:00
|
|
|
uint32_t AubCenter::getAubStreamMode(const std::string &aubFileName, uint32_t csrType) {
|
|
|
|
uint32_t mode = aub_stream::mode::aubFile;
|
|
|
|
|
2019-02-08 22:08:35 +08:00
|
|
|
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;
|
2019-02-05 21:16:37 +08:00
|
|
|
}
|
2019-02-08 22:08:35 +08:00
|
|
|
|
2019-02-05 21:16:37 +08:00
|
|
|
return mode;
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|