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