1 /* 2 * Copyright (C) 2018-2019 Alyssa Rosenzweig <alyssa@rosenzweig.io> 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 FROM, 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 * SOFTWARE. 22 */ 23 24 #ifndef __BIFROST_PUBLIC_H_ 25 #define __BIFROST_PUBLIC_H_ 26 27 #include "compiler/nir/nir.h" 28 #include "util/u_dynarray.h" 29 #include "panfrost/util/pan_ir.h" 30 31 void 32 bifrost_compile_shader_nir(nir_shader *nir, 33 const struct panfrost_compile_inputs *inputs, 34 struct util_dynarray *binary, 35 struct pan_shader_info *info); 36 37 static const nir_shader_compiler_options bifrost_nir_options = { 38 .lower_scmp = true, 39 .lower_flrp16 = true, 40 .lower_flrp32 = true, 41 .lower_flrp64 = true, 42 .lower_ffract = true, 43 .lower_fmod = true, 44 .lower_fdiv = true, 45 .lower_isign = true, 46 .lower_find_lsb = true, 47 .lower_ifind_msb = true, 48 .lower_fdph = true, 49 .lower_fsqrt = true, 50 51 .lower_wpos_pntc = true, 52 .lower_fsign = true, 53 54 .lower_bitfield_insert_to_shifts = true, 55 .lower_bitfield_extract_to_shifts = true, 56 .lower_extract_byte = true, 57 .lower_extract_word = true, 58 .lower_insert_byte = true, 59 .lower_insert_word = true, 60 .lower_rotate = true, 61 62 .lower_pack_half_2x16 = true, 63 .lower_pack_unorm_2x16 = true, 64 .lower_pack_snorm_2x16 = true, 65 .lower_pack_unorm_4x8 = true, 66 .lower_pack_snorm_4x8 = true, 67 .lower_unpack_half_2x16 = true, 68 .lower_unpack_unorm_2x16 = true, 69 .lower_unpack_snorm_2x16 = true, 70 .lower_unpack_unorm_4x8 = true, 71 .lower_unpack_snorm_4x8 = true, 72 .lower_pack_split = true, 73 74 .lower_doubles_options = nir_lower_dmod, 75 /* TODO: Don't lower supported 64-bit operations */ 76 .lower_int64_options = ~0, 77 /* TODO: Use IMULD on v7 */ 78 .lower_mul_high = true, 79 .lower_uadd_carry = true, 80 81 .has_fsub = true, 82 .has_isub = true, 83 .vectorize_io = true, 84 .vectorize_vec2_16bit = true, 85 .fuse_ffma16 = true, 86 .fuse_ffma32 = true, 87 .fuse_ffma64 = true, 88 .use_interpolated_input_intrinsics = true, 89 90 .lower_uniforms_to_ubo = true, 91 92 .has_cs_global_id = true, 93 .vertex_id_zero_based = true, 94 .lower_cs_local_index_from_id = true, 95 .max_unroll_iterations = 32, 96 .force_indirect_unrolling = (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp), 97 }; 98 99 #endif 100