2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2025-05-12 14:53:41 +00:00
|
|
|
* Copyright (C) 2018-2025 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-19 06:09:03 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2021-07-06 15:44:16 +02:00
|
|
|
#include "shared/source/command_stream/aub_command_stream_receiver.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2024-03-05 03:39:51 +00:00
|
|
|
#include "shared/source/aub/aub_helper.h"
|
2025-05-12 14:53:41 +00:00
|
|
|
#include "shared/source/command_stream/aub_command_stream_receiver_hw.h"
|
2022-12-15 16:01:37 +00:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
|
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2023-01-02 16:19:30 +00:00
|
|
|
#include "shared/source/helpers/basic_math.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/debug_helpers.h"
|
2023-02-01 16:23:01 +00:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
|
|
|
|
#include "shared/source/helpers/options.h"
|
2021-05-21 10:22:13 +00:00
|
|
|
#include "shared/source/os_interface/os_inc_base.h"
|
2021-07-08 17:19:43 +00:00
|
|
|
#include "shared/source/os_interface/sys_calls_common.h"
|
2024-03-05 03:39:51 +00:00
|
|
|
#include "shared/source/release_helper/release_helper.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
#include <algorithm>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
AubCommandStreamReceiverCreateFunc aubCommandStreamReceiverFactory[IGFX_MAX_CORE] = {};
|
|
|
|
|
|
2023-10-26 15:04:39 +02:00
|
|
|
std::string AUBCommandStreamReceiver::createFullFilePath(const HardwareInfo &hwInfo, const std::string &filename, uint32_t rootDeviceIndex) {
|
2019-05-08 16:00:24 +02:00
|
|
|
std::string hwPrefix = hardwarePrefix[hwInfo.platform.eProductFamily];
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
// Generate the full filename
|
2019-05-08 16:00:24 +02:00
|
|
|
const auto >SystemInfo = hwInfo.gtSystemInfo;
|
2017-12-21 00:45:38 +01:00
|
|
|
std::stringstream strfilename;
|
2023-10-26 15:04:39 +02:00
|
|
|
auto subDevicesCount = GfxCoreHelper::getSubDevicesCount(&hwInfo);
|
2018-11-22 15:16:20 +01:00
|
|
|
uint32_t subSlicesPerSlice = gtSystemInfo.SubSliceCount / gtSystemInfo.SliceCount;
|
2019-12-08 21:23:58 +01:00
|
|
|
strfilename << hwPrefix << "_";
|
2021-09-17 11:31:08 +00:00
|
|
|
std::stringstream strExtendedFileName;
|
|
|
|
|
|
|
|
|
|
strExtendedFileName << filename;
|
2023-11-30 08:32:25 +00:00
|
|
|
if (debugManager.flags.GenerateAubFilePerProcessId.get()) {
|
2021-09-17 11:31:08 +00:00
|
|
|
strExtendedFileName << "_PID_" << SysCalls::getProcessId();
|
2021-07-08 17:19:43 +00:00
|
|
|
}
|
2024-03-05 03:39:51 +00:00
|
|
|
auto releaseHelper = ReleaseHelper::create(hwInfo.ipVersion);
|
|
|
|
|
const auto deviceConfig = AubHelper::getDeviceConfigString(releaseHelper.get(), subDevicesCount, gtSystemInfo.SliceCount, subSlicesPerSlice, gtSystemInfo.MaxEuPerSubSlice);
|
|
|
|
|
strfilename << deviceConfig << "_" << rootDeviceIndex << "_" << strExtendedFileName.str() << ".aub";
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
// clean-up any fileName issues because of the file system incompatibilities
|
|
|
|
|
auto fileName = strfilename.str();
|
|
|
|
|
for (char &i : fileName) {
|
|
|
|
|
i = i == '/' ? '_' : i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string filePath(folderAUB);
|
2024-06-12 16:22:21 +00:00
|
|
|
if (debugManager.flags.AUBDumpCaptureDirPath.get() != "unk") {
|
|
|
|
|
filePath.assign(debugManager.flags.AUBDumpCaptureDirPath.get());
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
filePath.append(Os::fileSeparator);
|
|
|
|
|
filePath.append(fileName);
|
|
|
|
|
|
2019-01-09 14:23:49 +01:00
|
|
|
return filePath;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-28 16:08:37 +01:00
|
|
|
CommandStreamReceiver *AUBCommandStreamReceiver::create(const std::string &baseName,
|
|
|
|
|
bool standalone,
|
|
|
|
|
ExecutionEnvironment &executionEnvironment,
|
|
|
|
|
uint32_t rootDeviceIndex,
|
2020-10-29 15:33:35 +01:00
|
|
|
const DeviceBitfield deviceBitfield) {
|
2020-02-12 11:27:28 +01:00
|
|
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
2023-10-26 15:04:39 +02:00
|
|
|
std::string filePath = AUBCommandStreamReceiver::createFullFilePath(*hwInfo, baseName, rootDeviceIndex);
|
2023-11-30 08:32:25 +00:00
|
|
|
if (debugManager.flags.AUBDumpCaptureFileName.get() != "unk") {
|
|
|
|
|
filePath.assign(debugManager.flags.AUBDumpCaptureFileName.get());
|
2018-08-23 17:15:33 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-08 16:00:24 +02:00
|
|
|
if (hwInfo->platform.eRenderCoreFamily >= IGFX_MAX_CORE) {
|
2017-12-21 00:45:38 +01:00
|
|
|
DEBUG_BREAK_IF(!false);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-08 16:00:24 +02:00
|
|
|
auto pCreate = aubCommandStreamReceiverFactory[hwInfo->platform.eRenderCoreFamily];
|
2020-10-28 16:08:37 +01:00
|
|
|
return pCreate ? pCreate(filePath, standalone, executionEnvironment, rootDeviceIndex, deviceBitfield) : nullptr;
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
namespace AubMemDump {
|
|
|
|
|
using CmdServicesMemTraceMemoryCompare = AubMemDump::CmdServicesMemTraceMemoryCompare;
|
|
|
|
|
using CmdServicesMemTraceMemoryWrite = AubMemDump::CmdServicesMemTraceMemoryWrite;
|
|
|
|
|
using CmdServicesMemTraceRegisterPoll = AubMemDump::CmdServicesMemTraceRegisterPoll;
|
|
|
|
|
using CmdServicesMemTraceRegisterWrite = AubMemDump::CmdServicesMemTraceRegisterWrite;
|
|
|
|
|
using CmdServicesMemTraceVersion = AubMemDump::CmdServicesMemTraceVersion;
|
|
|
|
|
} // namespace AubMemDump
|