• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2020 Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  */
23 
24 #pragma once
25 
26 #include "brw_compiler.h"
27 
28 struct disk_cache;
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /** Software interface for system values in kernels
35  *
36  * These are intended to go at the start of the kernel argument buffer.
37  */
38 struct brw_kernel_sysvals {
39    uint32_t num_work_groups[3];
40    uint32_t pad[5];
41 };
42 
43 struct brw_kernel_arg_desc {
44    uint16_t offset;
45    uint16_t size;
46 };
47 
48 struct brw_kernel {
49    struct brw_cs_prog_data prog_data;
50 
51    struct brw_compile_stats stats[3];
52 
53    uint16_t args_size;
54    uint16_t arg_count;
55    const struct brw_kernel_arg_desc *args;
56 
57    const void *code;
58 };
59 
60 bool
61 brw_kernel_from_spirv(struct brw_compiler *compiler,
62                       struct disk_cache *disk_cache,
63                       struct brw_kernel *kernel,
64                       void *log_data, void *mem_ctx,
65                       const uint32_t *spirv, size_t spirv_size,
66                       const char *entrypoint_name,
67                       char **error_str);
68 
69 nir_shader *
70 brw_nir_from_spirv(void *mem_ctx, unsigned gfx_version,
71                    const uint32_t *spirv, size_t spirv_size, bool llvm17_wa);
72 
73 #ifdef __cplusplus
74 } /* extern "C" */
75 #endif
76