2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-03-22 02:54:41 +08:00
|
|
|
* Copyright (C) 2019-2024 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2021-09-30 17:04:25 +08:00
|
|
|
#include "shared/source/helpers/per_thread_data.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include <cstddef>
|
2019-02-27 18:39:32 +08:00
|
|
|
#include <cstdint>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2020-01-22 23:22:30 +08:00
|
|
|
class CommandQueue;
|
2023-01-16 23:30:27 +08:00
|
|
|
class Device;
|
|
|
|
class Kernel;
|
2017-12-21 07:45:38 +08:00
|
|
|
class LinearStream;
|
|
|
|
class IndirectHeap;
|
2023-01-16 23:30:27 +08:00
|
|
|
enum PreemptionMode : uint32_t;
|
2017-12-21 07:45:38 +08:00
|
|
|
struct CrossThreadInfo;
|
|
|
|
struct MultiDispatchInfo;
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-06-12 15:13:06 +08:00
|
|
|
struct HardwareCommandsHelper : public PerThreadDataHelper {
|
2023-12-04 20:20:54 +08:00
|
|
|
using DefaultWalkerType = typename GfxFamily::DefaultWalkerType;
|
2018-05-11 19:33:16 +08:00
|
|
|
using BINDING_TABLE_STATE = typename GfxFamily::BINDING_TABLE_STATE;
|
|
|
|
using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE;
|
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
2018-09-26 06:44:43 +08:00
|
|
|
using MI_ATOMIC = typename GfxFamily::MI_ATOMIC;
|
2020-01-09 00:42:14 +08:00
|
|
|
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-10-04 21:01:52 +08:00
|
|
|
static INTERFACE_DESCRIPTOR_DATA *getInterfaceDescriptor(
|
|
|
|
const IndirectHeap &indirectHeap,
|
|
|
|
uint64_t offsetInterfaceDescriptor,
|
|
|
|
INTERFACE_DESCRIPTOR_DATA *inlineInterfaceDescriptor);
|
|
|
|
|
|
|
|
inline static uint32_t additionalSizeRequiredDsh();
|
|
|
|
|
2023-11-23 21:58:58 +08:00
|
|
|
template <typename WalkerType, typename InterfaceDescriptorType>
|
2017-12-21 07:45:38 +08:00
|
|
|
static size_t sendInterfaceDescriptorData(
|
|
|
|
const IndirectHeap &indirectHeap,
|
|
|
|
uint64_t offsetInterfaceDescriptor,
|
|
|
|
uint64_t kernelStartOffset,
|
|
|
|
size_t sizeCrossThreadData,
|
|
|
|
size_t sizePerThreadData,
|
|
|
|
size_t bindingTablePointer,
|
2022-01-14 07:57:00 +08:00
|
|
|
[[maybe_unused]] size_t offsetSamplerState,
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t numSamplers,
|
2022-08-03 20:22:30 +08:00
|
|
|
const uint32_t threadGroupCount,
|
2020-04-07 20:07:31 +08:00
|
|
|
uint32_t numThreadsPerThreadGroup,
|
2019-09-20 20:55:06 +08:00
|
|
|
const Kernel &kernel,
|
2018-08-13 21:05:59 +08:00
|
|
|
uint32_t bindingTablePrefetchSize,
|
2018-05-11 19:33:16 +08:00
|
|
|
PreemptionMode preemptionMode,
|
2023-04-28 00:58:48 +08:00
|
|
|
const Device &device,
|
2023-11-23 21:58:58 +08:00
|
|
|
WalkerType *walkerCmd,
|
2024-07-09 23:10:02 +08:00
|
|
|
InterfaceDescriptorType *inlineInterfaceDescriptor);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
static void sendMediaStateFlush(
|
|
|
|
LinearStream &commandStream,
|
|
|
|
size_t offsetInterfaceDescriptorData);
|
|
|
|
|
|
|
|
static void sendMediaInterfaceDescriptorLoad(
|
|
|
|
LinearStream &commandStream,
|
|
|
|
size_t offsetInterfaceDescriptorData,
|
|
|
|
size_t sizeInterfaceDescriptorData);
|
|
|
|
|
2023-11-23 21:58:58 +08:00
|
|
|
template <typename WalkerType>
|
2017-12-21 07:45:38 +08:00
|
|
|
static size_t sendCrossThreadData(
|
|
|
|
IndirectHeap &indirectHeap,
|
2018-10-18 12:38:18 +08:00
|
|
|
Kernel &kernel,
|
|
|
|
bool inlineDataProgrammingRequired,
|
2023-11-23 21:58:58 +08:00
|
|
|
WalkerType *walkerCmd,
|
|
|
|
uint32_t &sizeCrossThreadData,
|
2024-03-22 02:54:41 +08:00
|
|
|
uint64_t scratchAddress,
|
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2023-11-23 21:58:58 +08:00
|
|
|
template <typename WalkerType, typename InterfaceDescriptorType>
|
2017-12-21 07:45:38 +08:00
|
|
|
static size_t sendIndirectState(
|
|
|
|
LinearStream &commandStream,
|
|
|
|
IndirectHeap &dsh,
|
|
|
|
IndirectHeap &ioh,
|
|
|
|
IndirectHeap &ssh,
|
2018-03-14 18:07:51 +08:00
|
|
|
Kernel &kernel,
|
2020-01-23 22:52:49 +08:00
|
|
|
uint64_t kernelStartOffset,
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t simd,
|
|
|
|
const size_t localWorkSize[3],
|
2022-08-03 20:22:30 +08:00
|
|
|
const uint32_t threadGroupCount,
|
2017-12-21 07:45:38 +08:00
|
|
|
const uint64_t offsetInterfaceDescriptorTable,
|
2018-09-28 22:16:18 +08:00
|
|
|
uint32_t &interfaceDescriptorIndex,
|
2018-05-11 19:33:16 +08:00
|
|
|
PreemptionMode preemptionMode,
|
2023-11-23 21:58:58 +08:00
|
|
|
WalkerType *walkerCmd,
|
|
|
|
InterfaceDescriptorType *inlineInterfaceDescriptor,
|
2020-11-13 18:41:45 +08:00
|
|
|
bool localIdsGenerationByRuntime,
|
2023-11-23 21:58:58 +08:00
|
|
|
uint64_t scratchAddress,
|
2024-07-09 23:10:02 +08:00
|
|
|
const Device &device);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2023-11-23 21:58:58 +08:00
|
|
|
template <typename WalkerType>
|
|
|
|
static void programInlineData(Kernel &kernel, WalkerType *walkerCmd, uint64_t indirectDataAddress, uint64_t scratchAddress);
|
|
|
|
|
2018-10-04 21:01:52 +08:00
|
|
|
static void programPerThreadData(
|
2022-10-21 22:16:43 +08:00
|
|
|
bool localIdsGenerationByRuntime,
|
2018-10-04 21:01:52 +08:00
|
|
|
size_t &sizePerThreadData,
|
|
|
|
size_t &sizePerThreadDataTotal,
|
2022-10-21 22:16:43 +08:00
|
|
|
LinearStream &ioh,
|
|
|
|
const Kernel &kernel,
|
|
|
|
const size_t localWorkSize[3]);
|
2018-10-04 21:01:52 +08:00
|
|
|
|
2021-03-26 22:32:49 +08:00
|
|
|
static size_t getSizeRequiredCS();
|
2020-10-06 00:32:55 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
static size_t getSizeRequiredDSH(
|
|
|
|
const Kernel &kernel);
|
|
|
|
static size_t getSizeRequiredIOH(
|
|
|
|
const Kernel &kernel,
|
2024-03-22 02:54:41 +08:00
|
|
|
const size_t localWorkSizes[3],
|
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment);
|
2017-12-21 07:45:38 +08:00
|
|
|
static size_t getSizeRequiredSSH(
|
2021-03-22 23:26:03 +08:00
|
|
|
const Kernel &kernel);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
static size_t getTotalSizeRequiredDSH(
|
|
|
|
const MultiDispatchInfo &multiDispatchInfo);
|
|
|
|
static size_t getTotalSizeRequiredIOH(
|
2018-02-13 22:43:33 +08:00
|
|
|
const MultiDispatchInfo &multiDispatchInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
static size_t getTotalSizeRequiredSSH(
|
|
|
|
const MultiDispatchInfo &multiDispatchInfo);
|
|
|
|
|
2024-06-27 00:45:18 +08:00
|
|
|
template <typename WalkerType>
|
2018-10-04 21:01:52 +08:00
|
|
|
static void setInterfaceDescriptorOffset(
|
2024-06-27 00:45:18 +08:00
|
|
|
WalkerType *walkerCmd,
|
2018-10-04 21:01:52 +08:00
|
|
|
uint32_t &interfaceDescriptorIndex);
|
|
|
|
|
2021-03-22 23:26:03 +08:00
|
|
|
static bool kernelUsesLocalIds(const Kernel &kernel);
|
2023-03-08 06:43:53 +08:00
|
|
|
static size_t checkForAdditionalBTAndSetBTPointer(IndirectHeap &ssh, const Kernel &kernel);
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|