2019-10-14 19:33:18 +08:00
|
|
|
/*
|
2023-01-24 23:33:52 +08:00
|
|
|
* Copyright (C) 2019-2023 Intel Corporation
|
2019-10-14 19:33:18 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-01-24 23:33:52 +08:00
|
|
|
#include "shared/source/helpers/device_bitfield.h"
|
2021-08-12 01:36:00 +08:00
|
|
|
|
2022-11-23 17:14:27 +08:00
|
|
|
#include "aubstream/engine_node.h"
|
2019-10-14 19:33:18 +08:00
|
|
|
|
2020-02-25 01:25:42 +08:00
|
|
|
#include <atomic>
|
2022-11-29 03:00:39 +08:00
|
|
|
#include <bitset>
|
2020-02-25 01:25:42 +08:00
|
|
|
|
2019-10-14 19:33:18 +08:00
|
|
|
namespace NEO {
|
2022-11-29 03:00:39 +08:00
|
|
|
enum PreemptionMode : uint32_t;
|
2020-01-17 00:52:17 +08:00
|
|
|
struct HardwareInfo;
|
2021-07-02 19:34:07 +08:00
|
|
|
struct SelectorCopyEngine;
|
2022-12-20 19:23:46 +08:00
|
|
|
struct RootDeviceEnvironment;
|
2020-01-17 00:52:17 +08:00
|
|
|
|
2020-09-15 23:29:02 +08:00
|
|
|
enum class EngineUsage : uint32_t {
|
|
|
|
Regular,
|
|
|
|
LowPriority,
|
2021-05-17 23:22:49 +08:00
|
|
|
Internal,
|
2021-08-17 02:24:13 +08:00
|
|
|
Cooperative,
|
2021-05-17 23:22:49 +08:00
|
|
|
|
|
|
|
EngineUsageCount,
|
2020-09-15 23:29:02 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
using EngineTypeUsage = std::pair<aub_stream::EngineType, EngineUsage>;
|
|
|
|
|
2021-08-12 01:36:00 +08:00
|
|
|
struct EngineDescriptor {
|
|
|
|
EngineDescriptor() = delete;
|
2021-08-12 23:43:07 +08:00
|
|
|
constexpr EngineDescriptor(EngineTypeUsage engineTypeUsage, DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool isRootDevice, bool isEngineInstanced)
|
|
|
|
: engineTypeUsage(engineTypeUsage), deviceBitfield(deviceBitfield), preemptionMode(preemptionMode), isRootDevice(isRootDevice), isEngineInstanced(isEngineInstanced) {}
|
2021-08-12 01:36:00 +08:00
|
|
|
|
|
|
|
EngineTypeUsage engineTypeUsage;
|
|
|
|
DeviceBitfield deviceBitfield;
|
|
|
|
PreemptionMode preemptionMode;
|
|
|
|
bool isRootDevice;
|
2021-08-12 23:43:07 +08:00
|
|
|
bool isEngineInstanced;
|
2021-08-12 01:36:00 +08:00
|
|
|
};
|
|
|
|
|
2020-01-13 20:15:03 +08:00
|
|
|
namespace EngineHelpers {
|
2019-10-14 19:33:18 +08:00
|
|
|
bool isCcs(aub_stream::EngineType engineType);
|
2023-03-28 05:37:18 +08:00
|
|
|
bool isComputeEngine(aub_stream::EngineType engineType);
|
2019-11-26 01:37:19 +08:00
|
|
|
bool isBcs(aub_stream::EngineType engineType);
|
2022-07-04 23:46:15 +08:00
|
|
|
bool isBcsVirtualEngineEnabled(aub_stream::EngineType engineType);
|
2022-12-20 19:23:46 +08:00
|
|
|
aub_stream::EngineType getBcsEngineType(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, SelectorCopyEngine &selectorCopyEngine, bool internalUsage);
|
2021-07-02 19:34:07 +08:00
|
|
|
void releaseBcsEngineType(aub_stream::EngineType engineType, SelectorCopyEngine &selectorCopyEngine);
|
2022-12-20 19:23:46 +08:00
|
|
|
aub_stream::EngineType remapEngineTypeToHwSpecific(aub_stream::EngineType inputType, const RootDeviceEnvironment &rootDeviceEnvironment);
|
2021-09-25 00:32:20 +08:00
|
|
|
uint32_t getBcsIndex(aub_stream::EngineType engineType);
|
2021-10-22 04:46:22 +08:00
|
|
|
aub_stream::EngineType mapBcsIndexToEngineType(uint32_t index, bool includeMainCopyEngine);
|
2021-10-21 02:37:18 +08:00
|
|
|
aub_stream::EngineType mapCcsIndexToEngineType(uint32_t index);
|
2021-05-17 23:22:49 +08:00
|
|
|
std::string engineTypeToString(aub_stream::EngineType engineType);
|
|
|
|
std::string engineUsageToString(EngineUsage usage);
|
|
|
|
|
2021-12-08 21:57:37 +08:00
|
|
|
bool isBcsEnabled(const HardwareInfo &hwInfo, aub_stream::EngineType engineType);
|
|
|
|
|
|
|
|
constexpr bool isLinkBcs(aub_stream::EngineType engineType) {
|
|
|
|
return engineType >= aub_stream::ENGINE_BCS1 && engineType <= aub_stream::ENGINE_BCS8;
|
|
|
|
}
|
|
|
|
|
2022-12-08 22:23:49 +08:00
|
|
|
inline constexpr uint32_t numLinkedCopyEngines = 8u;
|
|
|
|
inline constexpr size_t oddLinkedCopyEnginesMask = 0b010101010;
|
2023-05-12 18:36:06 +08:00
|
|
|
inline constexpr size_t h2dCopyEngineMask = 0b000001010;
|
|
|
|
inline constexpr size_t d2hCopyEngineMask = 0b010100000;
|
2022-02-07 19:28:51 +08:00
|
|
|
|
2022-12-20 19:23:46 +08:00
|
|
|
bool linkCopyEnginesSupported(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield);
|
2021-12-08 21:57:37 +08:00
|
|
|
|
2022-12-20 19:23:46 +08:00
|
|
|
aub_stream::EngineType selectLinkCopyEngine(const RootDeviceEnvironment &rootDeviceEnvironment, const DeviceBitfield &deviceBitfield, std::atomic<uint32_t> &selectorCopyEngine);
|
2021-12-08 21:57:37 +08:00
|
|
|
|
2020-01-13 20:15:03 +08:00
|
|
|
}; // namespace EngineHelpers
|
2019-10-14 19:33:18 +08:00
|
|
|
} // namespace NEO
|