File: kernel_info_from_patchtokens.cpp

package info (click to toggle)
intel-compute-runtime 25.35.35096.9-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,324 kB
  • sloc: cpp: 926,243; lisp: 3,433; sh: 715; makefile: 162; python: 21
file content (53 lines) | stat: -rw-r--r-- 2,018 bytes parent folder | download | duplicates (2)
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) 2019-2023 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/program/kernel_info_from_patchtokens.h"

#include "shared/source/device_binary_format/patchtokens_decoder.h"
#include "shared/source/kernel/kernel_descriptor_from_patchtokens.h"
#include "shared/source/program/kernel_info.h"

#include <cstring>

namespace NEO {

using namespace iOpenCL;

void populateKernelInfo(KernelInfo &dst, const PatchTokenBinary::KernelFromPatchtokens &src, uint32_t gpuPointerSizeInBytes) {
    UNRECOVERABLE_IF(nullptr == src.header);

    dst.heapInfo.dynamicStateHeapSize = src.header->DynamicStateHeapSize;
    dst.heapInfo.generalStateHeapSize = src.header->GeneralStateHeapSize;
    dst.heapInfo.surfaceStateHeapSize = src.header->SurfaceStateHeapSize;
    dst.heapInfo.kernelHeapSize = src.header->KernelHeapSize;
    dst.heapInfo.kernelUnpaddedSize = src.header->KernelUnpaddedSize;
    dst.shaderHashCode = src.header->ShaderHashCode;

    dst.heapInfo.pKernelHeap = src.isa.begin();
    dst.heapInfo.pGsh = src.heaps.generalState.begin();
    dst.heapInfo.pDsh = src.heaps.dynamicState.begin();
    dst.heapInfo.pSsh = src.heaps.surfaceState.begin();

    if (src.tokens.executionEnvironment != nullptr) {
        dst.kernelDescriptor.kernelAttributes.hasIndirectStatelessAccess = (src.tokens.executionEnvironment->IndirectStatelessCount > 0);
    }

    dst.systemKernelOffset = src.tokens.stateSip ? src.tokens.stateSip->SystemKernelOffset : 0U;

    if (src.tokens.gtpinInfo) {
        dst.igcInfoForGtpin = reinterpret_cast<const gtpin::igc_info_t *>(src.tokens.gtpinInfo + 1);
    }

    populateKernelDescriptor(dst.kernelDescriptor, src, gpuPointerSizeInBytes);

    if (dst.kernelDescriptor.kernelAttributes.crossThreadDataSize) {
        dst.crossThreadData = new char[dst.kernelDescriptor.kernelAttributes.crossThreadDataSize];
        memset(dst.crossThreadData, 0x00, dst.kernelDescriptor.kernelAttributes.crossThreadDataSize);
    }
}

} // namespace NEO