mesa/src/intel/compiler
Kenneth Graunke 9d8f2c4421 intel/brw: Rework BRW_REGISTER_TYPE's representation semantics
In ancient days, we directly used the hardware register type encodings
throughout the compiler.  As more GPU generations came out, encodings
shifted, and we moved to an abstract enum that we could encode/decode
to a particular GPU's hardware encoding.  But there was no particular
meaning behind any particular value.

One downside to this approach is that we end up with switch statements
galore.  Want to know a type's size?  Switch.  Convert a unsigned type
to a signed one?  Switch.  Get a type with the same base type, but
different bit size?  Switch.  This is both inefficient and inconvenient.

In contrast, nir_alu_type takes a nicer approach - the type encoding has
certain bits representing the base type, and others encoding the size of
the type.  Switching base types or sizes is a simple matter of masking
out the relevant field and substituting a different one.

Tigerlake's encoding adopts a similar approach: two bits represent the
size as a 2-bit unsigned number n, where the bit size is (8 * 2^n).
Two more bits represent the base type.  Past encodings were a bit ad hoc
as new data types were added over time, but Gfx12 is organized (mostly).

This patch converts our brw_reg_type enum over to a new system that's
patterned after the Tigerlake style (for easy conversion) while
deviating in a few ways that make our vector immediate type size
handling simpler.  Should we add additional base types, we're likely
to continue deviating.  Still, converting is much simpler.

Type size calculations (which are performed all the time) are now a
simple mask and shift, instead of a switch.

We also adopt the name BRW_TYPE_* instead of BRW_REGISTER_TYPE_* because
it's much shorter and easier to type.  Similarly, we create new helper
functions named brw_type_* for working with these types, with a cleaner
naming convention.  Legacy names still exist but will we dropped over
the next few patches as pieces get cleaned up.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28847>
2024-04-25 11:41:48 +00:00
..
elk nir: remove workgroup_id_zero_base 2024-04-24 20:18:49 +00:00
tests intel/brw: Remove assembler tests for Gfx8- 2024-02-24 02:10:56 +00:00
brw_asm.h intel: Rename i965_{asm,disasm} tools to brw_{asm,disasm} 2024-02-15 09:26:46 +00:00
brw_asm_tool.c intel/brw: Remove automatic_exec_sizes 2024-02-28 05:45:39 +00:00
brw_cfg.cpp intel/brw: Use fs_inst in cfg_t 2024-02-29 20:47:48 -08:00
brw_cfg.h intel/brw: Use fs_inst in cfg_t 2024-02-29 20:47:48 -08:00
brw_compile_gs.cpp intel/brw: Remove runtime_check_aads_emit 2024-02-28 05:45:39 +00:00
brw_compile_tcs.cpp intel/brw: Remove runtime_check_aads_emit 2024-02-28 05:45:39 +00:00
brw_compile_vs.cpp intel/brw: Remove runtime_check_aads_emit 2024-02-28 05:45:39 +00:00
brw_compiler.c intel: set compact_arrays in compiler options 2024-04-12 18:43:48 +00:00
brw_compiler.h intel/brw/gfx12: Setup PS thread payload registers required for ALU-based pixel interpolation. 2024-03-20 15:46:44 -07:00
brw_dead_control_flow.cpp intel/brw: Use fs_inst explicitly in various passes 2024-02-29 20:47:48 -08:00
brw_debug_recompile.c intel/brw: Delete brw_wm_prog_key::line_aa 2024-02-29 18:00:14 +00:00
brw_device_sha1_gen_c.py intel/compiler: drop unused ray-tracing fields from cache hash 2024-03-22 00:01:28 +00:00
brw_disasm.c intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
brw_disasm.h intel/compiler: Merge intel_disasm.[ch] into corresponding brw files 2024-02-15 09:26:46 +00:00
brw_disasm_info.cpp intel/brw: Use fs_inst in disasm_annotate() 2024-02-29 21:14:13 -08:00
brw_disasm_info.h intel/brw: Use fs_inst in disasm_annotate() 2024-02-29 21:14:13 -08:00
brw_disasm_tool.c intel/brw: Remove Gfx8- code from disassembler 2024-02-28 05:45:38 +00:00
brw_eu.c intel/brw: Delete if_depth_in_loop 2024-04-16 02:14:49 +00:00
brw_eu.h intel/brw: Use SHADER_OPCODE_SEND for coherent framebuffer reads 2024-04-16 02:14:49 +00:00
brw_eu_compact.c intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
brw_eu_defines.h intel/brw: Replace FS_OPCODE_LINTERP with BRW_OPCODE_PLN 2024-04-16 02:14:49 +00:00
brw_eu_emit.c intel/brw: Drop NF type support 2024-04-25 11:41:48 +00:00
brw_eu_validate.c intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
brw_fs.cpp intel/brw: Lower VGRFs to FIXED_GRFs earlier 2024-04-23 23:17:57 +00:00
brw_fs.h intel/brw: Lower VGRFs to FIXED_GRFs earlier 2024-04-23 23:17:57 +00:00
brw_fs_bank_conflicts.cpp intel/brw: Remove MRF type 2024-02-28 05:45:39 +00:00
brw_fs_builder.h intel/brw: Make an fs_builder::SYNC helper 2024-04-16 02:14:49 +00:00
brw_fs_cmod_propagation.cpp intel/brw: Remove Gfx8- code from backend passes 2024-02-28 05:45:38 +00:00
brw_fs_combine_constants.cpp intel/brw: Drop NF type support 2024-04-25 11:41:48 +00:00
brw_fs_copy_propagation.cpp intel/fs/gfx20+: Handle subdword integer regioning restrictions in copy propagation. 2024-04-22 18:02:32 -07:00
brw_fs_cse.cpp intel/brw: Replace FS_OPCODE_LINTERP with BRW_OPCODE_PLN 2024-04-16 02:14:49 +00:00
brw_fs_dead_code_eliminate.cpp intel/brw: Pull dead_code_eliminate out of fs_visitor 2024-02-26 20:54:24 +00:00
brw_fs_generator.cpp intel/brw: Lower VGRFs to FIXED_GRFs earlier 2024-04-23 23:17:57 +00:00
brw_fs_live_variables.cpp intel/brw: Use fs_visitor instead of backend_shader in various passes 2024-02-29 19:28:05 +00:00
brw_fs_live_variables.h intel/brw: Use fs_visitor instead of backend_shader in various passes 2024-02-29 19:28:05 +00:00
brw_fs_lower.cpp intel/brw: Lower VGRFs to FIXED_GRFs earlier 2024-04-23 23:17:57 +00:00
brw_fs_lower_dpas.cpp intel/brw: Drop default size of 1 from bld.vgrf() calls 2024-04-16 02:14:49 +00:00
brw_fs_lower_integer_multiplication.cpp intel/brw: Remove MRF type 2024-02-28 05:45:39 +00:00
brw_fs_lower_pack.cpp intel/brw: Remove F16TO32 and F32TO16 opcodes 2024-02-28 05:45:38 +00:00
brw_fs_lower_regioning.cpp intel/fs/gfx20+: Implement sub-dword integer regioning restrictions. 2024-04-22 18:02:07 -07:00
brw_fs_lower_simd_width.cpp intel/brw: Replace FS_OPCODE_LINTERP with BRW_OPCODE_PLN 2024-04-16 02:14:49 +00:00
brw_fs_nir.cpp nir: remove workgroup_id_zero_base 2024-04-24 20:18:49 +00:00
brw_fs_opt.cpp intel/brw: Move validate out of fs_visitor 2024-04-22 13:38:41 -07:00
brw_fs_opt_algebraic.cpp intel/brw: Split out 64-bit lowering from algebraic optimizations 2024-03-20 01:04:17 -07:00
brw_fs_opt_virtual_grfs.cpp intel/brw: Move virtual GRF opts into their own file 2024-02-26 20:54:25 +00:00
brw_fs_reg_allocate.cpp intel/brw/xehp+: Drop redundant arguments of lsc_msg_desc*(). 2024-04-01 00:00:03 +00:00
brw_fs_register_coalesce.cpp intel/brw: Fix register coalescing's LOAD_PAYLOAD dst offset handling 2024-03-27 04:52:17 +00:00
brw_fs_saturate_propagation.cpp intel/brw: Simplify usage of reg immediate helpers 2024-03-01 17:52:09 +00:00
brw_fs_scoreboard.cpp intel/brw: Make an fs_builder::SYNC helper 2024-04-16 02:14:49 +00:00
brw_fs_sel_peephole.cpp intel/brw: Pull peephole_sel out of fs_visitor 2024-02-26 20:54:25 +00:00
brw_fs_thread_payload.cpp intel/brw/xe2+: Setup PS thread payload registers required for ALU-based pixel interpolation. 2024-03-20 15:46:44 -07:00
brw_fs_validate.cpp intel/brw: Move validate out of fs_visitor 2024-04-22 13:38:41 -07:00
brw_fs_visitor.cpp intel/brw: Delete fs_visitor::vgrf helper 2024-04-16 02:14:49 +00:00
brw_fs_workaround.cpp intel/brw: Use fs_inst explicitly in various passes 2024-02-29 20:47:48 -08:00
brw_gram.y intel/brw: Drop NF type support 2024-04-25 11:41:48 +00:00
brw_inst.h intel/brw: Replace CS_OPCODE_CS_TERMINATE with SHADER_OPCODE_SEND 2024-03-05 11:16:20 +00:00
brw_ir.h intel/brw: Fold backend_reg into fs_reg 2024-03-01 17:52:09 +00:00
brw_ir_allocator.h intel/compiler,intel/blorp,intel/vulkan: decouple vulkan driver and compiler from gallium 2023-08-03 22:00:15 +00:00
brw_ir_analysis.h
brw_ir_fs.h intel/fs/gfx20+: Handle subdword integer regioning restrictions in copy propagation. 2024-04-22 18:02:32 -07:00
brw_ir_performance.cpp intel/brw: Replace FS_OPCODE_LINTERP with BRW_OPCODE_PLN 2024-04-16 02:14:49 +00:00
brw_ir_performance.h intel/brw: Fold backend_shader into fs_visitor 2024-02-29 19:28:05 +00:00
brw_isa_info.h intel/compiler: Remove use of thread_local for opcode tables 2022-06-30 23:46:35 +00:00
brw_kernel.c intel/brw: Remove Gfx8- code from NIR options 2024-02-28 05:45:38 +00:00
brw_kernel.h intel-clc: Use correct set of nir_options when building for Gfx8 2024-02-24 00:24:32 +00:00
brw_lex.l intel/brw: Drop NF type support 2024-04-25 11:41:48 +00:00
brw_lower_logical_sends.cpp intel/brw: Use SHADER_OPCODE_SEND for coherent framebuffer reads 2024-04-16 02:14:49 +00:00
brw_mesh.cpp intel/brw: Remove runtime_check_aads_emit 2024-02-28 05:45:39 +00:00
brw_nir.c intel/brw: Delete stray nir_opt_dce 2024-04-04 23:42:27 +00:00
brw_nir.h intel/brw: Remove brw_shader.h 2024-02-29 19:28:06 +00:00
brw_nir_analyze_ubo_ranges.c intel/brw/xe2: Update brw_nir_analyze_ubo_ranges to account for 512b physical registers 2024-04-01 00:00:03 +00:00
brw_nir_lower_alpha_to_coverage.c brw/lower_a2c: fix for scalarized fs outputs 2024-04-18 23:27:22 +00:00
brw_nir_lower_cooperative_matrix.c nir: intel/brw: Remove cmat_signed_mask from dpas_intel intrinsic 2024-04-19 09:53:29 -07:00
brw_nir_lower_cs_intrinsics.c intel/compiler: Use "intel" prefix for walk_order enum 2024-02-21 00:38:35 +00:00
brw_nir_lower_intersection_shader.c intel/nir/rt: fix reportIntersection() hitT handling 2023-11-17 07:06:30 +00:00
brw_nir_lower_ray_queries.c intel/nir: only consider ray query variables in lowering 2024-02-24 12:56:30 +00:00
brw_nir_lower_rt_intrinsics.c treewide: Use nir_before/after_impl for more elaborate cases 2023-08-30 19:30:58 +00:00
brw_nir_lower_shader_calls.c intel/rt: Don't directly generate umul_32x16 2024-02-02 00:02:05 +00:00
brw_nir_lower_storage_image.c intel/brw: Remove Gfx8- code from lower storage image pass 2024-02-28 05:45:38 +00:00
brw_nir_rt.c nir: remove workgroup_id_zero_base 2024-04-24 20:18:49 +00:00
brw_nir_rt.h anv: support VK_PIPELINE_CREATE_RAY_TRACING_SKIP_* 2022-10-20 00:03:55 +00:00
brw_nir_rt_builder.h nir: Drop "SSA" from NIR language 2023-08-12 16:44:41 -04:00
brw_nir_trig_workarounds.py driconf: Add a limit_trig_input_range option 2022-05-13 06:47:53 +00:00
brw_packed_float.c
brw_predicated_break.cpp intel/brw: Use fs_inst explicitly in various passes 2024-02-29 20:47:48 -08:00
brw_prim.h intel/compiler: Split 3DPRIM_* defines out to a separate header. 2022-06-30 23:46:35 +00:00
brw_private.h intel/brw: Remove brw_shader.h 2024-02-29 19:28:06 +00:00
brw_reg.h intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
brw_reg_type.c intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
brw_reg_type.h intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
brw_rt.h intel: Use ALIGN_POT instead of ALIGN inside macro define 2024-01-03 12:46:10 +00:00
brw_schedule_instructions.cpp intel/fs: fixup instruction scheduling last grf write tracking 2024-04-05 19:46:40 +00:00
brw_shader.cpp intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
brw_simd_selection.cpp intel/fs/xe2+: Stop building SIMD8 compute-like shaders (CS/BS/TS/MS). 2023-12-22 10:37:00 -08:00
brw_vue_map.c intel/brw: Remove Gfx8- code from VUE map 2024-02-28 05:45:38 +00:00
intel_clc.c intel/clc: Fix file descriptor leak 2024-02-28 04:30:33 +00:00
intel_gfx_ver_enum.h intel/compiler: Rename brw_gfx_ver_enum.h to intel_gfx_ver_enum.h 2024-02-16 22:35:05 +00:00
intel_nir.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir.h intel/compiler: Pack texture LOD and offset to a single 32-bit value 2024-02-27 00:22:46 +00:00
intel_nir_blockify_uniform_loads.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_clamp_image_1d_2d_array_sizes.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_clamp_per_vertex_loads.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_lower_conversions.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_lower_non_uniform_barycentric_at_sample.c intel/compiler: Ensure load_barycentric_at_sample and load_interpolated_input remain together 2024-04-04 23:42:27 +00:00
intel_nir_lower_non_uniform_resource_intel.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_lower_shading_rate_output.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_lower_sparse.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_lower_texture.c intel/compiler: Pack texture LOD and offset to a single 32-bit value 2024-02-27 00:22:46 +00:00
intel_nir_opt_peephole_ffma.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_opt_peephole_imul32x16.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_nir_tcs_workarounds.c intel/compiler: Rename the passes and files related to intel_nir.h 2024-02-16 22:35:05 +00:00
intel_shader_enums.h intel/compiler: Use "intel" prefix for walk_order enum 2024-02-21 00:38:35 +00:00
meson.build meson: Allow building intel-clc for the host if it can be run 2024-03-21 16:31:35 +00:00
test_eu_compact.cpp intel/brw: Remove EU compaction tests for Gfx8- 2024-02-24 02:10:56 +00:00
test_eu_validate.cpp intel/brw: Rework BRW_REGISTER_TYPE's representation semantics 2024-04-25 11:41:48 +00:00
test_fs_cmod_propagation.cpp intel/brw: Delete fs_visitor::vgrf helper 2024-04-16 02:14:49 +00:00
test_fs_combine_constants.cpp intel/brw: Move validate out of fs_visitor 2024-04-22 13:38:41 -07:00
test_fs_copy_propagation.cpp intel/brw: Delete fs_visitor::vgrf helper 2024-04-16 02:14:49 +00:00
test_fs_saturate_propagation.cpp intel/brw: Delete fs_visitor::vgrf helper 2024-04-16 02:14:49 +00:00
test_fs_scoreboard.cpp intel/brw: Delete fs_visitor::vgrf helper 2024-04-16 02:14:49 +00:00
test_predicated_break.cpp intel/brw: Use fs_visitor instead of backend_shader in various passes 2024-02-29 19:28:05 +00:00
test_simd_selection.cpp intel: Remove brw_ prefix from process debug function 2024-02-16 22:35:05 +00:00
test_vf_float_conversions.cpp