• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2024 Intel Corporation
3  * SPDX-License-Identifier: MIT
4  */
5 
6 #include "elk_nir_options.h"
7 
8 #define COMMON_OPTIONS                                                        \
9    .compact_arrays = true,                                                    \
10    .discard_is_demote = true,                                                 \
11    .has_uclz = true,                                                          \
12    .lower_fdiv = true,                                                        \
13    .lower_scmp = true,                                                        \
14    .lower_flrp16 = true,                                                      \
15    .lower_fmod = true,                                                        \
16    .lower_ufind_msb = true,                                                   \
17    .lower_uadd_carry = true,                                                  \
18    .lower_usub_borrow = true,                                                 \
19    .lower_flrp64 = true,                                                      \
20    .lower_fisnormal = true,                                                   \
21    .lower_isign = true,                                                       \
22    .lower_ldexp = true,                                                       \
23    .lower_bitfield_extract = true,                                            \
24    .lower_bitfield_insert = true,                                             \
25    .lower_device_index_to_zero = true,                                        \
26    .vectorize_tess_levels = true,                                             \
27    .scalarize_ddx = true,                                                     \
28    .lower_insert_byte = true,                                                 \
29    .lower_insert_word = true,                                                 \
30    .vertex_id_zero_based = true,                                              \
31    .lower_base_vertex = true,                                                 \
32    .support_16bit_alu = true,                                                 \
33    .lower_uniforms_to_ubo = true,                                             \
34    .support_indirect_inputs = (uint8_t)BITFIELD_MASK(PIPE_SHADER_TYPES),      \
35    .support_indirect_outputs = (uint8_t)BITFIELD_MASK(PIPE_SHADER_TYPES)
36 
37 #define COMMON_SCALAR_OPTIONS                                                 \
38    .lower_to_scalar = true,                                                   \
39    .lower_pack_half_2x16 = true,                                              \
40    .lower_pack_snorm_2x16 = true,                                             \
41    .lower_pack_snorm_4x8 = true,                                              \
42    .lower_pack_unorm_2x16 = true,                                             \
43    .lower_pack_unorm_4x8 = true,                                              \
44    .lower_unpack_half_2x16 = true,                                            \
45    .lower_unpack_snorm_2x16 = true,                                           \
46    .lower_unpack_snorm_4x8 = true,                                            \
47    .lower_unpack_unorm_2x16 = true,                                           \
48    .lower_unpack_unorm_4x8 = true,                                            \
49    .lower_hadd64 = true,                                                      \
50    .avoid_ternary_with_two_constants = true,                                  \
51    .has_pack_32_4x8 = true,                                                   \
52    .max_unroll_iterations = 32,                                               \
53    .force_indirect_unrolling = nir_var_function_temp,                         \
54    .divergence_analysis_options =                                             \
55       (nir_divergence_single_patch_per_tcs_subgroup |                         \
56        nir_divergence_single_patch_per_tes_subgroup |                         \
57        nir_divergence_shader_record_ptr_uniform)
58 
59 const struct nir_shader_compiler_options elk_scalar_nir_options = {
60    COMMON_OPTIONS,
61    COMMON_SCALAR_OPTIONS,
62 };
63 
64 const struct nir_shader_compiler_options elk_vector_nir_options = {
65    COMMON_OPTIONS,
66 
67    /* In the vec4 backend, our dpN instruction replicates its result to all the
68     * components of a vec4.  We would like NIR to give us replicated fdot
69     * instructions because it can optimize better for us.
70     */
71    .fdot_replicates = true,
72 
73    .lower_usub_sat = true,
74    .lower_pack_snorm_2x16 = true,
75    .lower_pack_unorm_2x16 = true,
76    .lower_unpack_snorm_2x16 = true,
77    .lower_unpack_unorm_2x16 = true,
78    .lower_extract_byte = true,
79    .lower_extract_word = true,
80    .intel_vec4 = true,
81    .max_unroll_iterations = 32,
82 };
83