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 #ifndef BRW_KERNEL_H 25 #define BRW_KERNEL_H 26 27 #include "brw_compiler.h" 28 29 struct disk_cache; 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 /** Software interface for system values in kernels 36 * 37 * These are intended to go at the start of the kernel argument buffer. 38 */ 39 struct brw_kernel_sysvals { 40 uint32_t num_work_groups[3]; 41 uint32_t pad[5]; 42 }; 43 44 struct brw_kernel_arg_desc { 45 uint16_t offset; 46 uint16_t size; 47 }; 48 49 struct brw_kernel { 50 struct brw_cs_prog_data prog_data; 51 52 struct brw_compile_stats stats[3]; 53 54 uint16_t args_size; 55 uint16_t arg_count; 56 const struct brw_kernel_arg_desc *args; 57 58 const void *code; 59 }; 60 61 bool 62 brw_kernel_from_spirv(struct brw_compiler *compiler, 63 struct disk_cache *disk_cache, 64 struct brw_kernel *kernel, 65 void *log_data, void *mem_ctx, 66 const uint32_t *spirv, size_t spirv_size, 67 const char *entrypoint_name, 68 char **error_str); 69 70 #ifdef __cplusplus 71 } /* extern "C" */ 72 #endif 73 74 #endif /* BRW_KERNEL_H */ 75