File: mock_dispatch_kernel_encoder_interface.h

package info (click to toggle)
intel-compute-runtime 25.44.36015.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 79,632 kB
  • sloc: cpp: 931,547; lisp: 2,074; sh: 719; makefile: 162; python: 21
file content (66 lines) | stat: -rw-r--r-- 2,885 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
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Copyright (C) 2020-2025 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#pragma once
#include "shared/source/kernel/dispatch_kernel_encoder_interface.h"
#include "shared/source/kernel/kernel_descriptor.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/mock_method_macros.h"

#include <stdint.h>

namespace NEO {
class GraphicsAllocation;

struct MockDispatchKernelEncoder : public DispatchKernelEncoderI {
  public:
    MockDispatchKernelEncoder() = default;

    uint32_t getRequiredWorkgroupOrder() const override {
        return requiredWalkGroupOrder;
    }
    uint32_t getNumThreadsPerThreadGroup() const override {
        return numThreadsPerThreadGroup;
    }

    NEO::ImplicitArgs *getImplicitArgs() const override { return nullptr; }

    void patchBindlessOffsetsInCrossThreadData(uint64_t bindlessSurfaceStateBaseOffset) const override { return; };
    void patchSamplerBindlessOffsetsInCrossThreadData(uint64_t samplerStateOffset) const override {
        samplerStateOffsetPassed = samplerStateOffset;
    }

    MockGraphicsAllocation mockAllocation{};
    static constexpr uint32_t crossThreadSize = 0x40;
    static constexpr uint32_t perThreadSize = 0x20;
    uint8_t dataCrossThread[crossThreadSize]{};
    uint8_t dataPerThread[perThreadSize]{};
    uint32_t groupSizes[3]{32, 1, 1};
    uint32_t requiredWalkGroupOrder = 0x0u;
    KernelDescriptor kernelDescriptor{};
    uint32_t numThreadsPerThreadGroup = 1;

    mutable uint64_t samplerStateOffsetPassed = 0u;

    ADDMETHOD_CONST_NOBASE(getKernelDescriptor, const KernelDescriptor &, kernelDescriptor, ());
    ADDMETHOD_CONST_NOBASE(getGroupSize, const uint32_t *, groupSizes, ());
    ADDMETHOD_CONST_NOBASE(getSlmTotalSize, uint32_t, 0u, ());
    ADDMETHOD_CONST_NOBASE(getCrossThreadData, const uint8_t *, dataCrossThread, ());
    ADDMETHOD_CONST_NOBASE(getCrossThreadDataSize, uint32_t, crossThreadSize, ());
    ADDMETHOD_CONST_NOBASE(getThreadExecutionMask, uint32_t, 0u, ());
    ADDMETHOD_CONST_NOBASE(getPerThreadData, const uint8_t *, dataPerThread, ());
    ADDMETHOD_CONST_NOBASE(getPerThreadDataSize, uint32_t, perThreadSize, ());
    ADDMETHOD_CONST_NOBASE(getPerThreadDataSizeForWholeThreadGroup, uint32_t, 0u, ());
    ADDMETHOD_CONST_NOBASE(getSurfaceStateHeapData, const uint8_t *, nullptr, ());
    ADDMETHOD_CONST_NOBASE(getSurfaceStateHeapDataSize, uint32_t, 0u, ());
    ADDMETHOD_CONST_NOBASE(getIsaAllocation, GraphicsAllocation *, &mockAllocation, ());
    ADDMETHOD_CONST_NOBASE(getDynamicStateHeapData, const uint8_t *, nullptr, ());
    ADDMETHOD_CONST_NOBASE(requiresGenerationOfLocalIdsByRuntime, bool, true, ());
    ADDMETHOD_CONST_NOBASE(getSlmPolicy, SlmPolicy, SlmPolicy::slmPolicyNone, ());
    ADDMETHOD_CONST_NOBASE(getIsaOffsetInParentAllocation, uint64_t, 0lu, ());
};
} // namespace NEO