2018-11-10 22:25:48 +01:00
|
|
|
/*
|
2019-01-01 21:14:17 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-11-10 22:25:48 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "runtime/aub/aub_center.h"
|
2018-12-12 13:09:45 +01:00
|
|
|
#include "runtime/aub/aub_helper.h"
|
2018-11-10 22:25:48 +01:00
|
|
|
#include "runtime/helpers/hw_info.h"
|
2019-02-05 14:16:37 +01:00
|
|
|
#include "runtime/helpers/options.h"
|
2018-11-10 22:25:48 +01:00
|
|
|
#include "runtime/os_interface/debug_settings_manager.h"
|
2019-02-05 14:16:37 +01:00
|
|
|
|
2019-01-18 21:44:23 +01:00
|
|
|
#include "third_party/aub_stream/headers/aub_manager.h"
|
2019-02-05 14:16:37 +01:00
|
|
|
#include "third_party/aub_stream/headers/options.h"
|
|
|
|
|
#include "third_party/aub_stream/headers/modes.h"
|
2018-11-10 22:25:48 +01:00
|
|
|
|
|
|
|
|
namespace OCLRT {
|
2019-02-11 18:46:29 +01:00
|
|
|
extern aub_stream::AubManager *createAubManager(uint32_t productFamily, uint32_t devicesCount, uint64_t memoryBankSize, bool localMemorySupported, const std::string &aubFileName, uint32_t streamMode);
|
2019-01-18 21:44:23 +01:00
|
|
|
|
2019-02-08 15:08:35 +01:00
|
|
|
AubCenter::AubCenter(const HardwareInfo *pHwInfo, bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
|
2018-11-10 22:25:48 +01:00
|
|
|
if (DebugManager.flags.UseAubStream.get()) {
|
2018-12-12 15:39:02 +01:00
|
|
|
auto devicesCount = AubHelper::getDevicesCount(pHwInfo);
|
2019-02-12 13:37:39 +01:00
|
|
|
auto memoryBankSize = AubHelper::getMemBankSize(pHwInfo);
|
2019-02-08 15:08:35 +01:00
|
|
|
CommandStreamReceiverType type = static_cast<CommandStreamReceiverType>(DebugManager.flags.SetCommandStreamReceiver.get() != CommandStreamReceiverType::CSR_HW
|
|
|
|
|
? DebugManager.flags.SetCommandStreamReceiver.get()
|
|
|
|
|
: csrType);
|
|
|
|
|
aubStreamMode = getAubStreamMode(aubFileName, type);
|
2019-02-05 14:16:37 +01:00
|
|
|
|
2019-01-14 10:31:06 +01:00
|
|
|
if (DebugManager.flags.AubDumpAddMmioRegistersList.get() != "unk") {
|
2019-01-18 21:44:23 +01:00
|
|
|
aub_stream::injectMMIOList = AubHelper::getAdditionalMmioList();
|
2019-01-14 10:31:06 +01:00
|
|
|
}
|
2019-01-31 20:03:42 +01:00
|
|
|
aub_stream::tbxServerIp = DebugManager.flags.TbxServer.get();
|
|
|
|
|
aub_stream::tbxServerPort = DebugManager.flags.TbxPort.get();
|
2019-01-14 10:31:06 +01:00
|
|
|
|
2019-02-08 15:08:35 +01:00
|
|
|
aubManager.reset(createAubManager(pHwInfo->pPlatform->eProductFamily, devicesCount, memoryBankSize, localMemoryEnabled, aubFileName, aubStreamMode));
|
2018-11-10 22:25:48 +01:00
|
|
|
}
|
|
|
|
|
addressMapper = std::make_unique<AddressMapper>();
|
|
|
|
|
streamProvider = std::make_unique<AubFileStreamProvider>();
|
|
|
|
|
}
|
2018-12-10 17:12:32 +01:00
|
|
|
|
|
|
|
|
AubCenter::AubCenter() {
|
|
|
|
|
addressMapper = std::make_unique<AddressMapper>();
|
|
|
|
|
streamProvider = std::make_unique<AubFileStreamProvider>();
|
|
|
|
|
}
|
2019-02-05 14:16:37 +01:00
|
|
|
|
|
|
|
|
uint32_t AubCenter::getAubStreamMode(const std::string &aubFileName, uint32_t csrType) {
|
|
|
|
|
uint32_t mode = aub_stream::mode::aubFile;
|
|
|
|
|
|
2019-02-08 15:08:35 +01: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 14:16:37 +01:00
|
|
|
}
|
2019-02-08 15:08:35 +01:00
|
|
|
|
2019-02-05 14:16:37 +01:00
|
|
|
return mode;
|
|
|
|
|
}
|
2018-11-10 22:25:48 +01:00
|
|
|
} // namespace OCLRT
|