2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-02-22 16:28:27 +08:00
|
|
|
* Copyright (C) 2017-2020 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
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/command_queue/local_id_gen.h"
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "patch_shared.h"
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include <array>
|
|
|
|
#include <cstddef>
|
|
|
|
#include <cstdint>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
class LinearStream;
|
|
|
|
|
|
|
|
struct PerThreadDataHelper {
|
2019-12-17 15:55:09 +08:00
|
|
|
static inline uint32_t getLocalIdSizePerThread(
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t simd,
|
2019-12-17 15:55:09 +08:00
|
|
|
uint32_t grfSize,
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t numChannels) {
|
2019-12-17 15:55:09 +08:00
|
|
|
return getPerThreadSizeLocalIDs(simd, grfSize, numChannels);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline size_t getPerThreadDataSizeTotal(
|
|
|
|
uint32_t simd,
|
2019-12-17 15:55:09 +08:00
|
|
|
uint32_t grfSize,
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t numChannels,
|
|
|
|
size_t localWorkSize) {
|
2019-12-17 15:55:09 +08:00
|
|
|
return getThreadsPerWG(simd, localWorkSize) * getLocalIdSizePerThread(simd, grfSize, numChannels);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static size_t sendPerThreadData(
|
|
|
|
LinearStream &indirectHeap,
|
|
|
|
uint32_t simd,
|
2019-12-17 15:55:09 +08:00
|
|
|
uint32_t grfSize,
|
2017-12-21 07:45:38 +08:00
|
|
|
uint32_t numChannels,
|
2018-08-06 17:35:59 +08:00
|
|
|
const size_t localWorkSizes[3],
|
2018-08-08 18:49:36 +08:00
|
|
|
const std::array<uint8_t, 3> &workgroupWalkOrder,
|
|
|
|
bool hasKernelOnlyImages);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
static inline uint32_t getNumLocalIdChannels(const iOpenCL::SPatchThreadPayload &threadPayload) {
|
|
|
|
return threadPayload.LocalIDXPresent +
|
|
|
|
threadPayload.LocalIDYPresent +
|
|
|
|
threadPayload.LocalIDZPresent;
|
|
|
|
}
|
|
|
|
|
2019-12-17 15:55:09 +08:00
|
|
|
static uint32_t getThreadPayloadSize(const iOpenCL::SPatchThreadPayload &threadPayload, uint32_t simd, uint32_t grfSize);
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|