2021-04-24 00:43:48 +08:00
|
|
|
/*
|
2024-01-17 21:20:26 +08:00
|
|
|
* Copyright (C) 2021-2024 Intel Corporation
|
2021-04-24 00:43:48 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-12-05 23:21:29 +08:00
|
|
|
#include "shared/source/helpers/definitions/command_encoder_args.h"
|
2023-01-24 23:33:52 +08:00
|
|
|
#include "shared/source/helpers/device_bitfield.h"
|
2021-04-24 00:43:48 +08:00
|
|
|
#include "shared/source/helpers/vec.h"
|
|
|
|
|
2021-10-29 18:12:13 +08:00
|
|
|
namespace WalkerPartition {
|
|
|
|
struct WalkerPartitionArgs;
|
|
|
|
}
|
|
|
|
|
2021-04-24 00:43:48 +08:00
|
|
|
namespace NEO {
|
2021-11-11 03:56:42 +08:00
|
|
|
struct HardwareInfo;
|
2021-04-24 00:43:48 +08:00
|
|
|
class LinearStream;
|
2021-11-04 23:28:06 +08:00
|
|
|
struct PipeControlArgs;
|
2023-01-26 11:58:18 +08:00
|
|
|
struct RootDeviceEnvironment;
|
2021-04-24 00:43:48 +08:00
|
|
|
|
|
|
|
namespace ImplicitScaling {
|
|
|
|
extern bool apiSupport;
|
2021-09-14 01:39:55 +08:00
|
|
|
} // namespace ImplicitScaling
|
2021-04-24 00:43:48 +08:00
|
|
|
|
|
|
|
struct ImplicitScalingHelper {
|
|
|
|
static bool isImplicitScalingEnabled(const DeviceBitfield &devices, bool preCondition);
|
2021-09-14 01:39:55 +08:00
|
|
|
static bool isSemaphoreProgrammingRequired();
|
2021-10-29 18:12:13 +08:00
|
|
|
static bool isCrossTileAtomicRequired(bool defaultCrossTileRequirement);
|
2021-04-24 00:43:48 +08:00
|
|
|
static bool isSynchronizeBeforeExecutionRequired();
|
2021-09-16 20:11:22 +08:00
|
|
|
static bool isAtomicsUsedForSelfCleanup();
|
2021-10-29 18:12:13 +08:00
|
|
|
static bool isSelfCleanupRequired(const WalkerPartition::WalkerPartitionArgs &args, bool apiSelfCleanup);
|
2021-09-16 20:11:22 +08:00
|
|
|
static bool isWparidRegisterInitializationRequired();
|
2021-10-29 18:12:13 +08:00
|
|
|
static bool isPipeControlStallRequired(bool defaultEmitPipeControl);
|
2022-10-14 08:11:28 +08:00
|
|
|
static bool pipeControlBeforeCleanupAtomicSyncRequired();
|
2021-04-24 00:43:48 +08:00
|
|
|
};
|
|
|
|
|
2024-07-29 21:37:30 +08:00
|
|
|
struct ImplicitScalingDispatchCommandArgs {
|
|
|
|
uint64_t workPartitionAllocationGpuVa = 0;
|
|
|
|
const HardwareInfo *hwInfo = nullptr;
|
|
|
|
void **outWalkerPtr = nullptr;
|
|
|
|
|
|
|
|
RequiredPartitionDim requiredPartitionDim = RequiredPartitionDim::none;
|
|
|
|
uint32_t partitionCount = 0;
|
2024-09-11 23:25:33 +08:00
|
|
|
uint32_t workgroupSize = 0;
|
|
|
|
uint32_t maxWgCountPerTile = 0;
|
2024-07-29 21:37:30 +08:00
|
|
|
|
|
|
|
bool useSecondaryBatchBuffer = false;
|
|
|
|
bool apiSelfCleanup = false;
|
|
|
|
bool dcFlush = false;
|
|
|
|
bool forceExecutionOnSingleTile = false;
|
|
|
|
bool blockDispatchToCommandBuffer = false;
|
2024-09-11 23:25:33 +08:00
|
|
|
bool isRequiredWorkGroupOrder = false;
|
2024-07-29 21:37:30 +08:00
|
|
|
};
|
|
|
|
|
2021-04-24 00:43:48 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
struct ImplicitScalingDispatch {
|
2023-12-04 20:20:54 +08:00
|
|
|
using DefaultWalkerType = typename GfxFamily::DefaultWalkerType;
|
2021-04-24 00:43:48 +08:00
|
|
|
|
2023-11-23 21:58:58 +08:00
|
|
|
template <typename WalkerType>
|
2021-10-29 18:12:13 +08:00
|
|
|
static size_t getSize(bool apiSelfCleanup,
|
2021-04-24 00:43:48 +08:00
|
|
|
bool preferStaticPartitioning,
|
|
|
|
const DeviceBitfield &devices,
|
2021-09-08 05:21:19 +08:00
|
|
|
const Vec3<size_t> &groupStart,
|
|
|
|
const Vec3<size_t> &groupCount);
|
2021-10-29 18:12:13 +08:00
|
|
|
|
2023-11-23 21:58:58 +08:00
|
|
|
template <typename WalkerType>
|
2021-04-24 00:43:48 +08:00
|
|
|
static void dispatchCommands(LinearStream &commandStream,
|
2023-11-23 21:58:58 +08:00
|
|
|
WalkerType &walkerCmd,
|
2021-04-24 00:43:48 +08:00
|
|
|
const DeviceBitfield &devices,
|
2024-07-29 21:37:30 +08:00
|
|
|
ImplicitScalingDispatchCommandArgs &dispatchCommandArgs);
|
2021-10-29 18:12:13 +08:00
|
|
|
|
|
|
|
static bool &getPipeControlStallRequired();
|
|
|
|
|
2023-01-26 11:58:18 +08:00
|
|
|
static size_t getBarrierSize(const RootDeviceEnvironment &rootDeviceEnvironment,
|
2021-11-11 03:56:42 +08:00
|
|
|
bool apiSelfCleanup,
|
|
|
|
bool usePostSync);
|
2021-10-29 18:12:13 +08:00
|
|
|
static void dispatchBarrierCommands(LinearStream &commandStream,
|
|
|
|
const DeviceBitfield &devices,
|
2021-11-04 23:28:06 +08:00
|
|
|
PipeControlArgs &flushArgs,
|
2023-01-26 11:58:18 +08:00
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment,
|
2021-11-11 03:56:42 +08:00
|
|
|
uint64_t gpuAddress,
|
|
|
|
uint64_t immediateData,
|
2021-10-29 18:12:13 +08:00
|
|
|
bool apiSelfCleanup,
|
|
|
|
bool useSecondaryBatchBuffer);
|
|
|
|
|
2021-11-18 03:51:43 +08:00
|
|
|
static size_t getRegisterConfigurationSize();
|
|
|
|
static void dispatchRegisterConfiguration(LinearStream &commandStream,
|
|
|
|
uint64_t workPartitionSurfaceAddress,
|
2024-04-19 22:20:27 +08:00
|
|
|
uint32_t addressOffset,
|
|
|
|
bool isBcs);
|
2021-11-18 03:51:43 +08:00
|
|
|
|
|
|
|
static size_t getOffsetRegisterSize();
|
|
|
|
static void dispatchOffsetRegister(LinearStream &commandStream,
|
2024-04-19 22:20:27 +08:00
|
|
|
uint32_t addressOffset, bool isBcs);
|
2021-11-18 03:51:43 +08:00
|
|
|
|
2023-06-06 23:11:09 +08:00
|
|
|
static uint32_t getImmediateWritePostSyncOffset();
|
|
|
|
static uint32_t getTimeStampPostSyncOffset();
|
2021-11-30 22:41:26 +08:00
|
|
|
|
2023-01-30 08:09:45 +08:00
|
|
|
static bool platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment);
|
2022-01-12 03:41:57 +08:00
|
|
|
|
2021-10-29 18:12:13 +08:00
|
|
|
private:
|
|
|
|
static bool pipeControlStallRequired;
|
2021-04-24 00:43:48 +08:00
|
|
|
};
|
|
|
|
|
2021-09-03 19:42:31 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
struct PartitionRegisters {
|
|
|
|
enum {
|
|
|
|
wparidCCSOffset = 0x221C,
|
|
|
|
addressOffsetCCSOffset = 0x23B4
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-24 00:43:48 +08:00
|
|
|
} // namespace NEO
|