1 /*
2  * Copyright (C) 2020-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 
10 #include "shared/source/helpers/constants.h"
11 
12 #include "level_zero/core/source/kernel/kernel.h"
13 
14 #include <cstdint>
15 
16 namespace NEO {
17 class Kernel;
18 class GraphicsAllocation;
19 } // namespace NEO
20 
21 namespace L0 {
22 struct Device;
23 
24 struct PrintfHandler {
25     static NEO::GraphicsAllocation *createPrintfBuffer(Device *device);
26     static void printOutput(const KernelImmutableData *kernelData,
27                             NEO::GraphicsAllocation *printfBuffer, Device *device);
28     static size_t getPrintBufferSize();
29 
30   protected:
31     PrintfHandler(const PrintfHandler &) = delete;
32     PrintfHandler &operator=(PrintfHandler const &) = delete;
33     PrintfHandler() = delete;
34 
35     constexpr static size_t printfBufferSize = 4 * MemoryConstants::megaByte;
36     constexpr static uint32_t printfSurfaceInitialDataSize = sizeof(uint32_t);
37 };
38 
39 } // namespace L0
40