Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
tests/ | 23-Nov-2023 | - | 6,256 | 4,046 | ||
README | D | 23-Nov-2023 | 5.7 KiB | 119 | 98 | |
meson.build | D | 23-Nov-2023 | 13.9 KiB | 476 | 443 | |
nir.c | D | 23-Nov-2023 | 70.2 KiB | 2,519 | 1,995 | |
nir.h | D | 23-Nov-2023 | 162.8 KiB | 5,189 | 2,955 | |
nir_algebraic.py | D | 23-Nov-2023 | 47.2 KiB | 1,225 | 907 | |
nir_builder.h | D | 23-Nov-2023 | 52.4 KiB | 1,707 | 1,363 | |
nir_builder_opcodes_h.py | D | 23-Nov-2023 | 3.9 KiB | 120 | 103 | |
nir_builtin_builder.c | D | 23-Nov-2023 | 14.6 KiB | 402 | 241 | |
nir_builtin_builder.h | D | 23-Nov-2023 | 8.1 KiB | 279 | 205 | |
nir_clone.c | D | 23-Nov-2023 | 24.5 KiB | 821 | 555 | |
nir_constant_expressions.h | D | 23-Nov-2023 | 1.6 KiB | 39 | 8 | |
nir_constant_expressions.py | D | 23-Nov-2023 | 15.6 KiB | 513 | 474 | |
nir_control_flow.c | D | 23-Nov-2023 | 22.8 KiB | 766 | 509 | |
nir_control_flow.h | D | 23-Nov-2023 | 6.9 KiB | 182 | 63 | |
nir_control_flow_private.h | D | 23-Nov-2023 | 1.5 KiB | 42 | 6 | |
nir_conversion_builder.h | D | 23-Nov-2023 | 16.6 KiB | 483 | 374 | |
nir_convert_ycbcr.c | D | 23-Nov-2023 | 5.6 KiB | 143 | 107 | |
nir_deref.c | D | 23-Nov-2023 | 44 KiB | 1,386 | 940 | |
nir_deref.h | D | 23-Nov-2023 | 2.6 KiB | 73 | 31 | |
nir_divergence_analysis.c | D | 23-Nov-2023 | 32 KiB | 927 | 747 | |
nir_dominance.c | D | 23-Nov-2023 | 9.3 KiB | 347 | 218 | |
nir_format_convert.h | D | 23-Nov-2023 | 14.9 KiB | 445 | 322 | |
nir_from_ssa.c | D | 23-Nov-2023 | 33.2 KiB | 1,026 | 620 | |
nir_gather_info.c | D | 23-Nov-2023 | 31.3 KiB | 836 | 669 | |
nir_gather_ssa_types.c | D | 23-Nov-2023 | 8.7 KiB | 235 | 169 | |
nir_gather_xfb_info.c | D | 23-Nov-2023 | 10.4 KiB | 288 | 199 | |
nir_gs_count_vertices.c | D | 23-Nov-2023 | 4.2 KiB | 118 | 60 | |
nir_inline_functions.c | D | 23-Nov-2023 | 10.6 KiB | 277 | 119 | |
nir_inline_uniforms.c | D | 23-Nov-2023 | 7.1 KiB | 203 | 123 | |
nir_instr_set.c | D | 23-Nov-2023 | 25 KiB | 842 | 616 | |
nir_instr_set.h | D | 23-Nov-2023 | 2.4 KiB | 65 | 8 | |
nir_intrinsics.py | D | 23-Nov-2023 | 47.2 KiB | 1,044 | 486 | |
nir_intrinsics_c.py | D | 23-Nov-2023 | 2.5 KiB | 75 | 65 | |
nir_intrinsics_h.py | D | 23-Nov-2023 | 2 KiB | 61 | 47 | |
nir_linking_helpers.c | D | 23-Nov-2023 | 45.7 KiB | 1,325 | 913 | |
nir_liveness.c | D | 23-Nov-2023 | 11.8 KiB | 360 | 200 | |
nir_loop_analyze.c | D | 23-Nov-2023 | 41.4 KiB | 1,294 | 898 | |
nir_loop_analyze.h | D | 23-Nov-2023 | 3.4 KiB | 107 | 58 | |
nir_lower_alpha_test.c | D | 23-Nov-2023 | 5 KiB | 127 | 78 | |
nir_lower_alu.c | D | 23-Nov-2023 | 10.1 KiB | 260 | 165 | |
nir_lower_alu_to_scalar.c | D | 23-Nov-2023 | 11.5 KiB | 317 | 230 | |
nir_lower_amul.c | D | 23-Nov-2023 | 9.9 KiB | 326 | 208 | |
nir_lower_array_deref_of_vec.c | D | 23-Nov-2023 | 7.5 KiB | 198 | 131 | |
nir_lower_atomics_to_ssbo.c | D | 23-Nov-2023 | 8.6 KiB | 243 | 153 | |
nir_lower_bit_size.c | D | 23-Nov-2023 | 11.2 KiB | 333 | 238 | |
nir_lower_bitmap.c | D | 23-Nov-2023 | 5 KiB | 146 | 74 | |
nir_lower_bool_to_bitsize.c | D | 23-Nov-2023 | 14 KiB | 446 | 322 | |
nir_lower_bool_to_float.c | D | 23-Nov-2023 | 6 KiB | 190 | 138 | |
nir_lower_bool_to_int32.c | D | 23-Nov-2023 | 5.7 KiB | 178 | 127 | |
nir_lower_cl_images_to_tex.c | D | 23-Nov-2023 | 5.5 KiB | 163 | 102 | |
nir_lower_clamp_color_outputs.c | D | 23-Nov-2023 | 3.9 KiB | 141 | 99 | |
nir_lower_clip.c | D | 23-Nov-2023 | 16.2 KiB | 515 | 353 | |
nir_lower_clip_cull_distance_arrays.c | D | 23-Nov-2023 | 4.7 KiB | 152 | 82 | |
nir_lower_clip_disable.c | D | 23-Nov-2023 | 5.5 KiB | 146 | 83 | |
nir_lower_clip_halfz.c | D | 23-Nov-2023 | 2.9 KiB | 80 | 47 | |
nir_lower_convert_alu_types.c | D | 23-Nov-2023 | 6.2 KiB | 207 | 149 | |
nir_lower_discard_to_demote.c | D | 23-Nov-2023 | 2.6 KiB | 71 | 34 | |
nir_lower_double_ops.c | D | 23-Nov-2023 | 25 KiB | 769 | 447 | |
nir_lower_drawpixels.c | D | 23-Nov-2023 | 10.3 KiB | 308 | 223 | |
nir_lower_fb_read.c | D | 23-Nov-2023 | 4.3 KiB | 122 | 52 | |
nir_lower_flatshade.c | D | 23-Nov-2023 | 1.7 KiB | 51 | 22 | |
nir_lower_flrp.c | D | 23-Nov-2023 | 21.5 KiB | 661 | 314 | |
nir_lower_fragcolor.c | D | 23-Nov-2023 | 4 KiB | 110 | 52 | |
nir_lower_fragcoord_wtrans.c | D | 23-Nov-2023 | 2.6 KiB | 76 | 35 | |
nir_lower_frexp.c | D | 23-Nov-2023 | 6.9 KiB | 209 | 119 | |
nir_lower_global_vars_to_local.c | D | 23-Nov-2023 | 3.7 KiB | 116 | 64 | |
nir_lower_goto_ifs.c | D | 23-Nov-2023 | 33.3 KiB | 997 | 699 | |
nir_lower_gs_intrinsics.c | D | 23-Nov-2023 | 14.5 KiB | 400 | 229 | |
nir_lower_idiv.c | D | 23-Nov-2023 | 8.5 KiB | 273 | 182 | |
nir_lower_indirect_derefs.c | D | 23-Nov-2023 | 8 KiB | 227 | 155 | |
nir_lower_input_attachments.c | D | 23-Nov-2023 | 7.3 KiB | 226 | 156 | |
nir_lower_int64.c | D | 23-Nov-2023 | 35.1 KiB | 1,086 | 824 | |
nir_lower_int_to_float.c | D | 23-Nov-2023 | 6.2 KiB | 186 | 132 | |
nir_lower_interpolation.c | D | 23-Nov-2023 | 5.7 KiB | 169 | 107 | |
nir_lower_io.c | D | 23-Nov-2023 | 93.5 KiB | 2,691 | 2,126 | |
nir_lower_io_arrays_to_elements.c | D | 23-Nov-2023 | 15.3 KiB | 443 | 300 | |
nir_lower_io_to_scalar.c | D | 23-Nov-2023 | 13.8 KiB | 417 | 279 | |
nir_lower_io_to_temporaries.c | D | 23-Nov-2023 | 13.5 KiB | 387 | 236 | |
nir_lower_io_to_vector.c | D | 23-Nov-2023 | 19.3 KiB | 577 | 418 | |
nir_lower_load_const_to_scalar.c | D | 23-Nov-2023 | 3.4 KiB | 102 | 53 | |
nir_lower_locals_to_regs.c | D | 23-Nov-2023 | 8.9 KiB | 291 | 194 | |
nir_lower_mediump_outputs.c | D | 23-Nov-2023 | 2.9 KiB | 80 | 43 | |
nir_lower_memcpy.c | D | 23-Nov-2023 | 6.9 KiB | 196 | 136 | |
nir_lower_memory_model.c | D | 23-Nov-2023 | 8.9 KiB | 273 | 224 | |
nir_lower_multiview.c | D | 23-Nov-2023 | 12.1 KiB | 349 | 213 | |
nir_lower_non_uniform_access.c | D | 23-Nov-2023 | 12.5 KiB | 349 | 248 | |
nir_lower_packing.c | D | 23-Nov-2023 | 5.2 KiB | 167 | 111 | |
nir_lower_passthrough_edgeflags.c | D | 23-Nov-2023 | 4 KiB | 109 | 64 | |
nir_lower_patch_vertices.c | D | 23-Nov-2023 | 3.9 KiB | 110 | 57 | |
nir_lower_phis_to_scalar.c | D | 23-Nov-2023 | 11.2 KiB | 319 | 159 | |
nir_lower_pntc_ytransform.c | D | 23-Nov-2023 | 4.8 KiB | 135 | 86 | |
nir_lower_point_size.c | D | 23-Nov-2023 | 3.7 KiB | 114 | 59 | |
nir_lower_point_size_mov.c | D | 23-Nov-2023 | 2.9 KiB | 81 | 41 | |
nir_lower_regs_to_ssa.c | D | 23-Nov-2023 | 9.8 KiB | 312 | 195 | |
nir_lower_returns.c | D | 23-Nov-2023 | 9.5 KiB | 299 | 178 | |
nir_lower_samplers.c | D | 23-Nov-2023 | 5.7 KiB | 179 | 103 | |
nir_lower_scratch.c | D | 23-Nov-2023 | 6.5 KiB | 185 | 116 | |
nir_lower_ssbo.c | D | 23-Nov-2023 | 7.1 KiB | 219 | 146 | |
nir_lower_subgroups.c | D | 23-Nov-2023 | 23.1 KiB | 629 | 486 | |
nir_lower_system_values.c | D | 23-Nov-2023 | 16.5 KiB | 426 | 284 | |
nir_lower_tex.c | D | 23-Nov-2023 | 40.7 KiB | 1,216 | 855 | |
nir_lower_to_source_mods.c | D | 23-Nov-2023 | 7.2 KiB | 235 | 144 | |
nir_lower_two_sided_color.c | D | 23-Nov-2023 | 7.2 KiB | 244 | 164 | |
nir_lower_ubo_vec4.c | D | 23-Nov-2023 | 7.9 KiB | 202 | 101 | |
nir_lower_uniforms_to_ubo.c | D | 23-Nov-2023 | 6.3 KiB | 162 | 96 | |
nir_lower_var_copies.c | D | 23-Nov-2023 | 5.9 KiB | 174 | 111 | |
nir_lower_variable_initializers.c | D | 23-Nov-2023 | 4.9 KiB | 138 | 89 | |
nir_lower_vars_to_ssa.c | D | 23-Nov-2023 | 26.5 KiB | 822 | 503 | |
nir_lower_vec3_to_vec4.c | D | 23-Nov-2023 | 5.5 KiB | 170 | 119 | |
nir_lower_vec_to_movs.c | D | 23-Nov-2023 | 9.6 KiB | 290 | 161 | |
nir_lower_viewport_transform.c | D | 23-Nov-2023 | 4.2 KiB | 104 | 42 | |
nir_lower_wpos_center.c | D | 23-Nov-2023 | 3.9 KiB | 116 | 59 | |
nir_lower_wpos_ytransform.c | D | 23-Nov-2023 | 13.3 KiB | 365 | 227 | |
nir_lower_wrmasks.c | D | 23-Nov-2023 | 7.5 KiB | 234 | 123 | |
nir_metadata.c | D | 23-Nov-2023 | 3.3 KiB | 108 | 56 | |
nir_move_vec_src_uses_to_dest.c | D | 23-Nov-2023 | 6.7 KiB | 214 | 111 | |
nir_normalize_cubemap_coords.c | D | 23-Nov-2023 | 3.8 KiB | 117 | 62 | |
nir_opcodes.py | D | 23-Nov-2023 | 42 KiB | 1,156 | 853 | |
nir_opcodes_c.py | D | 23-Nov-2023 | 5 KiB | 131 | 98 | |
nir_opcodes_h.py | D | 23-Nov-2023 | 1.6 KiB | 48 | 40 | |
nir_opt_access.c | D | 23-Nov-2023 | 11.5 KiB | 350 | 243 | |
nir_opt_algebraic.py | D | 23-Nov-2023 | 118.9 KiB | 2,311 | 1,420 | |
nir_opt_barriers.c | D | 23-Nov-2023 | 2.7 KiB | 86 | 50 | |
nir_opt_combine_stores.c | D | 23-Nov-2023 | 15.8 KiB | 471 | 325 | |
nir_opt_comparison_pre.c | D | 23-Nov-2023 | 12.7 KiB | 389 | 204 | |
nir_opt_conditional_discard.c | D | 23-Nov-2023 | 4.7 KiB | 149 | 92 | |
nir_opt_constant_folding.c | D | 23-Nov-2023 | 11.6 KiB | 347 | 253 | |
nir_opt_copy_prop_vars.c | D | 23-Nov-2023 | 43.2 KiB | 1,296 | 915 | |
nir_opt_copy_propagate.c | D | 23-Nov-2023 | 8.1 KiB | 304 | 216 | |
nir_opt_cse.c | D | 23-Nov-2023 | 2.8 KiB | 97 | 44 | |
nir_opt_dce.c | D | 23-Nov-2023 | 4.6 KiB | 169 | 110 | |
nir_opt_dead_cf.c | D | 23-Nov-2023 | 12.7 KiB | 394 | 207 | |
nir_opt_dead_write_vars.c | D | 23-Nov-2023 | 9 KiB | 268 | 169 | |
nir_opt_find_array_copies.c | D | 23-Nov-2023 | 22.2 KiB | 686 | 453 | |
nir_opt_gcm.c | D | 23-Nov-2023 | 22.2 KiB | 666 | 375 | |
nir_opt_idiv_const.c | D | 23-Nov-2023 | 6.3 KiB | 203 | 144 | |
nir_opt_if.c | D | 23-Nov-2023 | 48.3 KiB | 1,483 | 764 | |
nir_opt_intrinsics.c | D | 23-Nov-2023 | 6.3 KiB | 215 | 145 | |
nir_opt_large_constants.c | D | 23-Nov-2023 | 13.8 KiB | 412 | 285 | |
nir_opt_load_store_vectorize.c | D | 23-Nov-2023 | 46.8 KiB | 1,343 | 1,040 | |
nir_opt_loop_unroll.c | D | 23-Nov-2023 | 35 KiB | 996 | 551 | |
nir_opt_memcpy.c | D | 23-Nov-2023 | 6.7 KiB | 225 | 153 | |
nir_opt_move.c | D | 23-Nov-2023 | 6 KiB | 173 | 78 | |
nir_opt_peephole_select.c | D | 23-Nov-2023 | 10.1 KiB | 330 | 198 | |
nir_opt_rematerialize_compares.c | D | 23-Nov-2023 | 5.9 KiB | 199 | 125 | |
nir_opt_remove_phis.c | D | 23-Nov-2023 | 5.9 KiB | 187 | 96 | |
nir_opt_shrink_vectors.c | D | 23-Nov-2023 | 7.8 KiB | 265 | 176 | |
nir_opt_sink.c | D | 23-Nov-2023 | 8.3 KiB | 260 | 152 | |
nir_opt_trivial_continues.c | D | 23-Nov-2023 | 4.8 KiB | 140 | 83 | |
nir_opt_undef.c | D | 23-Nov-2023 | 5.7 KiB | 193 | 119 | |
nir_opt_uniform_atomics.c | D | 23-Nov-2023 | 11.4 KiB | 341 | 248 | |
nir_opt_vectorize.c | D | 23-Nov-2023 | 15.5 KiB | 509 | 341 | |
nir_phi_builder.c | D | 23-Nov-2023 | 11.5 KiB | 322 | 158 | |
nir_phi_builder.h | D | 23-Nov-2023 | 4.7 KiB | 120 | 17 | |
nir_print.c | D | 23-Nov-2023 | 48.7 KiB | 1,690 | 1,391 | |
nir_propagate_invariant.c | D | 23-Nov-2023 | 5.8 KiB | 206 | 141 | |
nir_range_analysis.c | D | 23-Nov-2023 | 55 KiB | 1,497 | 994 | |
nir_range_analysis.h | D | 23-Nov-2023 | 1.6 KiB | 49 | 20 | |
nir_remove_dead_variables.c | D | 23-Nov-2023 | 6.8 KiB | 220 | 151 | |
nir_repair_ssa.c | D | 23-Nov-2023 | 6.6 KiB | 211 | 135 | |
nir_schedule.c | D | 23-Nov-2023 | 34.9 KiB | 1,188 | 763 | |
nir_schedule.h | D | 23-Nov-2023 | 3.1 KiB | 85 | 27 | |
nir_search.c | D | 23-Nov-2023 | 31.1 KiB | 971 | 695 | |
nir_search.h | D | 23-Nov-2023 | 6.8 KiB | 216 | 94 | |
nir_search_helpers.h | D | 23-Nov-2023 | 13.1 KiB | 430 | 322 | |
nir_serialize.c | D | 23-Nov-2023 | 64.5 KiB | 2,143 | 1,681 | |
nir_serialize.h | D | 23-Nov-2023 | 1.6 KiB | 44 | 15 | |
nir_split_per_member_structs.c | D | 23-Nov-2023 | 6.5 KiB | 202 | 144 | |
nir_split_var_copies.c | D | 23-Nov-2023 | 5.5 KiB | 142 | 67 | |
nir_split_vars.c | D | 23-Nov-2023 | 58.6 KiB | 1,719 | 1,253 | |
nir_sweep.c | D | 23-Nov-2023 | 4.8 KiB | 178 | 103 | |
nir_to_lcssa.c | D | 23-Nov-2023 | 12.9 KiB | 418 | 276 | |
nir_validate.c | D | 23-Nov-2023 | 56.9 KiB | 1,695 | 1,244 | |
nir_vla.h | D | 23-Nov-2023 | 2.1 KiB | 57 | 10 | |
nir_vulkan.h | D | 23-Nov-2023 | 374 | 13 | 9 | |
nir_worklist.c | D | 23-Nov-2023 | 3.4 KiB | 139 | 82 | |
nir_worklist.h | D | 23-Nov-2023 | 4.7 KiB | 165 | 81 | |
nir_xfb_info.h | D | 23-Nov-2023 | 2.4 KiB | 81 | 45 |
README
1New IR, or NIR, is an IR for Mesa intended to sit below GLSL IR and Mesa IR. 2Its design inherits from the various IRs that Mesa has used in the past, as 3well as Direct3D assembly, and it includes a few new ideas as well. It is a 4flat (in terms of using instructions instead of expressions), typeless IR, 5similar to TGSI and Mesa IR. It also supports SSA (although it doesn't require 6it). 7 8Variables 9========= 10 11NIR includes support for source-level GLSL variables through a structure mostly 12copied from GLSL IR. These will be used for linking and conversion from GLSL IR 13(and later, from an AST), but for the most part, they will be lowered to 14registers (see below) and loads/stores. 15 16Registers 17========= 18 19Registers are light-weight; they consist of a structure that only contains its 20size, its index for liveness analysis, and an optional name for debugging. In 21addition, registers can be local to a function or global to the entire shader; 22the latter will be used in ARB_shader_subroutine for passing parameters and 23getting return values from subroutines. Registers can also be an array, in which 24case they can be accessed indirectly. Each ALU instruction (add, subtract, etc.) 25works directly with registers or SSA values (see below). 26 27SSA 28======== 29 30Everywhere a register can be loaded/stored, an SSA value can be used instead. 31The only exception is that arrays/indirect addressing are not supported with 32SSA; although research has been done on extensions of SSA to arrays before, it's 33usually for the purpose of parallelization (which we're not interested in), and 34adds some overhead in the form of adding copies or extra arrays (which is much 35more expensive than introducing copies between non-array registers). SSA uses 36point directly to their corresponding definition, which in turn points to the 37instruction it is part of. This creates an implicit use-def chain and avoids the 38need for an external structure for each SSA register. 39 40Functions 41========= 42 43Support for function calls is mostly similar to GLSL IR. Each shader contains a 44list of functions, and each function has a list of overloads. Each overload 45contains a list of parameters, and may contain an implementation which specifies 46the variables that correspond to the parameters and return value. Inlining a 47function, assuming it has a single return point, is as simple as copying its 48instructions, registers, and local variables into the target function and then 49inserting copies to and from the new parameters as appropriate. After functions 50are inlined and any non-subroutine functions are deleted, parameters and return 51variables will be converted to global variables and then global registers. We 52don't do this lowering earlier (i.e. the fortranizer idea) for a few reasons: 53 54- If we want to do optimizations before link time, we need to have the function 55signature available during link-time. 56 57- If we do any inlining before link time, then we might wind up with the 58inlined function and the non-inlined function using the same global 59variables/registers which would preclude optimization. 60 61Intrinsics 62========= 63 64Any operation (other than function calls and textures) which touches a variable 65or is not referentially transparent is represented by an intrinsic. Intrinsics 66are similar to the idea of a "builtin function," i.e. a function declaration 67whose implementation is provided by the backend, except they are more powerful 68in the following ways: 69 70- They can also load and store registers when appropriate, which limits the 71number of variables needed in later stages of the IR while obviating the need 72for a separate load/store variable instruction. 73 74- Intrinsics can be marked as side-effect free, which permits them to be 75treated like any other instruction when it comes to optimizations. This allows 76load intrinsics to be represented as intrinsics while still being optimized 77away by dead code elimination, common subexpression elimination, etc. 78 79Intrinsics are used for: 80 81- Atomic operations 82- Memory barriers 83- Subroutine calls 84- Geometry shader emitVertex and endPrimitive 85- Loading and storing variables (before lowering) 86- Loading and storing uniforms, shader inputs and outputs, etc (after lowering) 87- Copying variables (cases where in GLSL the destination is a structure or 88array) 89- The kitchen sink 90- ... 91 92Textures 93========= 94 95Unfortunately, there are far too many texture operations to represent each one 96of them with an intrinsic, so there's a special texture instruction similar to 97the GLSL IR one. The biggest difference is that, while the texture instruction 98has a sampler dereference field used just like in GLSL IR, this gets lowered to 99a texture unit index (with a possible indirect offset) while the type 100information of the original sampler is kept around for backends. Also, all the 101non-constant sources are stored in a single array to make it easier for 102optimization passes to iterate over all the sources. 103 104Control Flow 105========= 106 107Like in GLSL IR, control flow consists of a tree of "control flow nodes", which 108include if statements and loops, and jump instructions (break, continue, and 109return). Unlike GLSL IR, though, the leaves of the tree aren't statements but 110basic blocks. Each basic block also keeps track of its successors and 111predecessors, and function implementations keep track of the beginning basic 112block (the first basic block of the function) and the ending basic block (a fake 113basic block that every return statement points to). Together, these elements 114make up the control flow graph, in this case a redundant piece of information on 115top of the control flow tree that will be used by almost all the optimizations. 116There are helper functions to add and remove control flow nodes that also update 117the control flow graph, and so usually it doesn't need to be touched by passes 118that modify control flow nodes. 119