mesa/src
Connor Abbott c86563c29e nv50/ir/ra: Fix copying compound for moves
In order to reduce moves when coalescing multiple registers into a
larger register, RA will try to coalesce MERGE instructions with their
definitions. For example, for something like this in GLSL:

uint a = ...;
uint b = ...;
uint64 x = packUint2x32(a, b);

The compiler will try to coalesce x with a and b, in the same way as
something like:

uint a = ...;
uint b = ...;
...
uint x = phi(a, b);

with the crucial difference that the definitions of a and b only clobber
part of the register, instead of the whole thing. This information is
carried through the compound flag and compMask bitmask. If compound is
set, then the value has been coalesced in such a way that not all the
defs clobber the entire register. The compMask bitmask describes which
subregister each def clobbers, although it does it in a slightly
convoluted way. It's an invariant that once compound is set on one def,
it must be set for all the defs in a given coalesced value.

In more detail, the constraints pass will first create extra moves:

uint a = ...;
uint b = ...;
uint a' = a;
uint b' = b;
uint64 x = packUint2x32(a', b');

and then RA will merge values involved in MERGE/SPLIT instructions,
merging x with a' and b' and making the combined value compound -- this
is relatively simple, and will always succeed since we just created a'
and b', so they never interfere with x, and x has no other definitions,
since we haven't started coalescing moves yet. Basically, we just replaced
the MERGE instruction with an equivalent sequence of partial writes to the
destination. The tricky part comes when we try to merge a' with a
and b' with b. We need to transfer the compound information from a' to a
and b' to b, which copyCompound() does, but we also need to transfer it
to any defs coalesced with a and b, which the code failed to do. Similarly,
if x is the argument to a phi instruction, then when we try to merge it
with other arguments to the same phi by coalescing moves, we'd have
problems guaranteeing that all the other merged defs stay up-to-date.

One tricky part of fixing this is that in order to properly propagate
the information from a' to a, we need to do it before the defs for a and
a' are merged in coalesceValues(), since we need to know which defs are
merged with a but not a' -- after coalesceValues() returns, all the defs
have been combined, so we don't know which is which. I took the approach
of calling copyCompound() inside coalesceValues(), instead of
afterwards.

v2: (mhenning) This now loops over mergedDefs in copyCompound, to update
    it for changes made in bcf6a9ec

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Karol Herbst <kherbst@redhat.com>
Tested-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17115>
2022-06-30 11:35:56 +00:00
..
amd radv: do not emit SQTT user data packets on the SDMA queue 2022-06-29 06:41:31 +00:00
android_stub
asahi agx: Handle loop { if { loop { .. } } } 2022-06-22 21:23:50 +00:00
broadcom v3d/ci: Add flake test 2022-06-29 14:01:20 +02:00
c11 c11: reinstate the original license and authorship 2022-06-27 11:46:22 +00:00
compiler nir/types: fix glsl_matrix_type_is_row_major() assert 2022-06-30 00:41:46 +00:00
drm-shim drm-shim: Cleanup on device file close 2022-05-02 19:50:33 +00:00
egl egl/wayland: Don't try to access modifiers u_vector as dynarray 2022-06-23 16:12:15 +00:00
etnaviv ci/bare-metal: Consolidate needs declarations in .baremetal-test-*. 2022-06-22 20:59:54 +00:00
freedreno turnip: keep the depth_clip_disable state at the pipeline builder. 2022-06-30 01:08:17 +00:00
gallium zink: remove the workaround for depth_clip_enable on turnip 2022-06-30 01:08:17 +00:00
gbm gallium: Learn about kopper 2022-04-07 00:17:40 +00:00
getopt
glx glx/dri: Fix DRI drawable release at MakeCurrent time 2022-06-27 20:03:26 +00:00
gtest gtest: Fix maybe-uninitialized compiler warning 2022-06-29 21:02:18 +00:00
hgl
imagination pvr: Rename loop iterator variable. 2022-06-24 09:15:53 +00:00
imgui
intel anv: remove device features handling now in runtime 2022-06-29 10:47:36 +00:00
loader gallium/dri: add missing PIPE_BIND_DRI_PRIME handling 2022-02-08 00:13:07 +00:00
mapi meson: Using get_argument_syntax as the --compiler_id option for gen_vs_module_defs.py 2022-06-16 19:59:58 +00:00
mesa mesa/st: Fix border color type for stencil sampling 2022-06-29 03:00:56 +00:00
microsoft vulkan: Depend on vk_pipeline_layout in vk_cmd_enqueue 2022-06-29 20:31:58 +00:00
nouveau nv50/ir/ra: Fix copying compound for moves 2022-06-30 11:35:56 +00:00
panfrost vulkan: Depend on vk_pipeline_layout in vk_cmd_enqueue 2022-06-29 20:31:58 +00:00
tool meson/pps: Check if libdrm exists to compile pps 2022-06-22 11:52:36 +03:00
util util/xmlconfig: fix -Wmaybe-uninitialized warning 2022-06-29 20:06:13 +00:00
virtio venus: support VK_KHR_copy_commands2 2022-06-24 23:20:05 +00:00
vulkan vulkan: Depend on vk_pipeline_layout in vk_cmd_enqueue 2022-06-29 20:31:58 +00:00
meson.build meson: Use cc.get_argument_syntax instead cc.get_id when possible. 2022-06-16 19:59:58 +00:00