mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 23:40:12 +01:00
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> |
||
|---|---|---|
| .. | ||
| amd | ||
| android_stub | ||
| asahi | ||
| broadcom | ||
| c11 | ||
| compiler | ||
| drm-shim | ||
| egl | ||
| etnaviv | ||
| freedreno | ||
| gallium | ||
| gbm | ||
| getopt | ||
| glx | ||
| gtest | ||
| imagination | ||
| imgui | ||
| intel | ||
| loader | ||
| mapi | ||
| mesa | ||
| microsoft | ||
| nouveau | ||
| panfrost | ||
| tool | ||
| util | ||
| virtio | ||
| vulkan | ||
| .clang-format | ||
| meson.build | ||