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