File: mock_dispatch_kernel_encoder_interface.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 (68 lines) | stat: -rw-r--r-- 2,257 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
67
68
/*
 * Copyright (C) 2020 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 "opencl/test/unit_test/mocks/mock_graphics_allocation.h"

#include "gmock/gmock.h"

#include <stdint.h>

namespace NEO {
class GraphicsAllocation;

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

    MOCK_METHOD(const KernelDescriptor &, getKernelDescriptor, (), (const, override));

    MOCK_METHOD(const uint32_t *, getGroupSize, (), (const, override));
    MOCK_METHOD(uint32_t, getSlmTotalSize, (), (const, override));

    MOCK_METHOD(const uint8_t *, getCrossThreadData, (), (const, override));
    MOCK_METHOD(uint32_t, getCrossThreadDataSize, (), (const, override));

    MOCK_METHOD(uint32_t, getThreadExecutionMask, (), (const, override));

    MOCK_METHOD(const uint8_t *, getPerThreadData, (), (const, override));
    MOCK_METHOD(uint32_t, getPerThreadDataSize, (), (const, override));

    MOCK_METHOD(uint32_t, getPerThreadDataSizeForWholeThreadGroup, (), (const, override));

    MOCK_METHOD(const uint8_t *, getSurfaceStateHeapData, (), (const, override));
    MOCK_METHOD(uint32_t, getSurfaceStateHeapDataSize, (), (const, override));

    MOCK_METHOD(GraphicsAllocation *, getIsaAllocation, (), (const, override));
    MOCK_METHOD(const uint8_t *, getDynamicStateHeapData, (), (const, override));

    MOCK_METHOD(bool, requiresGenerationOfLocalIdsByRuntime, (), (const, override));

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

    void expectAnyMockFunctionCall();

    ::testing::NiceMock<MockGraphicsAllocation> mockAllocation;
    static constexpr uint32_t crossThreadSize = 0x40;
    static constexpr uint32_t perThreadSize = 0x20;
    uint8_t dataCrossThread[crossThreadSize];
    uint8_t dataPerThread[perThreadSize];
    KernelDescriptor kernelDescriptor;

    uint32_t groupSizes[3];
    bool localIdGenerationByRuntime = true;
    uint32_t requiredWalkGroupOrder = 0x0u;
};
} // namespace NEO