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