File: per_thread_data.h

package info (click to toggle)
intel-compute-runtime 20.44.18297-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 34,780 kB
  • sloc: cpp: 379,729; lisp: 4,931; python: 299; sh: 196; makefile: 8
file content (53 lines) | stat: -rw-r--r-- 1,471 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (C) 2017-2020 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#pragma once
#include "shared/source/helpers/local_id_gen.h"

#include "patch_shared.h"

#include <array>
#include <cstddef>
#include <cstdint>

namespace NEO {
class LinearStream;

struct PerThreadDataHelper {
    static inline uint32_t getLocalIdSizePerThread(
        uint32_t simd,
        uint32_t grfSize,
        uint32_t numChannels) {
        return getPerThreadSizeLocalIDs(simd, grfSize, numChannels);
    }

    static inline size_t getPerThreadDataSizeTotal(
        uint32_t simd,
        uint32_t grfSize,
        uint32_t numChannels,
        size_t localWorkSize) {
        return getThreadsPerWG(simd, localWorkSize) * getLocalIdSizePerThread(simd, grfSize, numChannels);
    }

    static size_t sendPerThreadData(
        LinearStream &indirectHeap,
        uint32_t simd,
        uint32_t grfSize,
        uint32_t numChannels,
        const size_t localWorkSizes[3],
        const std::array<uint8_t, 3> &workgroupWalkOrder,
        bool hasKernelOnlyImages);

    static inline uint32_t getNumLocalIdChannels(const iOpenCL::SPatchThreadPayload &threadPayload) {
        return threadPayload.LocalIDXPresent +
               threadPayload.LocalIDYPresent +
               threadPayload.LocalIDZPresent;
    }

    static uint32_t getThreadPayloadSize(const iOpenCL::SPatchThreadPayload &threadPayload, uint32_t simd, uint32_t grfSize);
};
} // namespace NEO