2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-03-22 02:54:41 +08:00
|
|
|
* Copyright (C) 2018-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
|
2024-03-22 02:54:41 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2023-06-30 22:17:13 +08:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2020-10-07 21:09:42 +08:00
|
|
|
#include "shared/source/helpers/local_id_gen.h"
|
2023-09-26 22:07:13 +08:00
|
|
|
#include "shared/source/helpers/simd_helper.h"
|
2020-02-23 05:50:57 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#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 {
|
|
|
|
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,
|
2023-06-30 22:17:13 +08:00
|
|
|
size_t localWorkSize,
|
|
|
|
bool isHwLocalIdGeneration,
|
2024-03-22 02:54:41 +08:00
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment) {
|
2023-09-26 22:07:13 +08:00
|
|
|
auto perThreadSizeLocalIDs = static_cast<size_t>(getPerThreadSizeLocalIDs(simd, grfSize, numChannels));
|
|
|
|
if (isSimd1(simd)) {
|
|
|
|
return perThreadSizeLocalIDs * localWorkSize;
|
|
|
|
}
|
2024-03-22 02:54:41 +08:00
|
|
|
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<NEO::GfxCoreHelper>();
|
|
|
|
return perThreadSizeLocalIDs * gfxCoreHelper.calculateNumThreadsPerThreadGroup(simd, static_cast<uint32_t>(localWorkSize), grfSize, isHwLocalIdGeneration, rootDeviceEnvironment);
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
2022-10-21 22:16:43 +08:00
|
|
|
}; // namespace PerThreadDataHelper
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|