mesa/src
Ian Romanick 46a9df6aac glsl: Don't try to emit the "linear sequence" in lower_variable_index_to_cond_assign
When there are four or fewer elements left in the array partition, the
strategy changes from a binary search of nested flow control to sequence
of conditional assignments like

    (assign, dest, src[constant_i+0], index == constant_i+0)
    (assign, dest, src[constant_i+1], index == constant_i+1)
    (assign, dest, src[constant_i+2], index == constant_i+2)
    (assign, dest, src[constant_i+3], index == constant_i+3)

or

    (assign, dest[constant_i+0], src, index == constant_i+0)
    (assign, dest[constant_i+1], src, index == constant_i+1)
    (assign, dest[constant_i+2], src, index == constant_i+2)
    (assign, dest[constant_i+3], src, index == constant_i+3)

Realistically, the first case should use ir_triop_csel instead.

The second case will either get turned back into flow control like

    if (index == constant_i+0)
        (assign, dest[constant_i+0], src)

    if (index == constant_i+1)
        (assign, dest[constant_i+1], src)

    if (index == constant_i+2)
        (assign, dest[constant_i+2], src)

    if (index == constant_i+3)
        (assign, dest[constant_i+3], src)

or a sequence of conditional selects like

    (assign, dest[constant_i+0], (csel, index == constant_i+0, src, dest[constant_i+0]))
    (assign, dest[constant_i+1], (csel, index == constant_i+1, src, dest[constant_i+1]))
    (assign, dest[constant_i+2], (csel, index == constant_i+2, src, dest[constant_i+2]))
    (assign, dest[constant_i+3], (csel, index == constant_i+3, src, dest[constant_i+3]))

The former case should continue to use the binary search.  The later
case could be generated from the binary search by other lowering passes.

At the end of the day, conditional assignments don't really help
anything here, so stop using them.

Radeon R430
total instructions in shared programs: 2398683 -> 2398419 (-0.01%)
instructions in affected programs: 5143 -> 4879 (-5.13%)
helped: 9
HURT: 8

total vinst in shared programs: 616292 -> 616010 (-0.05%)
vinst in affected programs: 4467 -> 4185 (-6.31%)
helped: 9
HURT: 8

total sinst in shared programs: 315417 -> 315667 (0.08%)
sinst in affected programs: 2568 -> 2818 (9.74%)
helped: 2
HURT: 15

total flowcontrol in shared programs: 1049 -> 1048 (-0.10%)
flowcontrol in affected programs: 7 -> 6 (-14.29%)
helped: 1
HURT: 0

total presub in shared programs: 47027 -> 47027 (0.00%)
presub in affected programs: 127 -> 127 (0.00%)
helped: 1
HURT: 1

total omod in shared programs: 3618 -> 3615 (-0.08%)
omod in affected programs: 8 -> 5 (-37.50%)
helped: 3
HURT: 0

total temps in shared programs: 450757 -> 451312 (0.12%)
temps in affected programs: 837 -> 1392 (66.31%)
helped: 8
HURT: 6

total consts in shared programs: 1031928 -> 1031920 (<.01%)
consts in affected programs: 1211 -> 1203 (-0.66%)
helped: 6
HURT: 7

The shaders that were hurt for temps... are all lies.  None of those
shaders should have compiled as all 6 had more than 32 temps to begin
with.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14573>
2022-02-11 17:25:33 +00:00
..
amd radv/winsys: fix initializing debug/perftest options if multiple instances 2022-02-11 16:12:47 +01:00
android_stub android_stub: update platform headers to include atrace 2021-10-09 00:42:32 +00:00
asahi agx: Don't kill helper threads in ld_var 2022-02-06 15:02:39 +00:00
broadcom v3dv: Use the common command pool implementation 2022-02-11 08:06:25 +00:00
compiler glsl: Don't try to emit the "linear sequence" in lower_variable_index_to_cond_assign 2022-02-11 17:25:33 +00:00
drm-shim
egl egl/wayland: Don't replace existing backbuffer in get_buffers 2022-02-07 09:57:41 +00:00
etnaviv etnaviv: add support for INTEL_blackhole_render 2022-01-31 16:52:29 +00:00
freedreno vulkan: Take a vk_command_pool in vk_command_buffer_init() 2022-02-11 08:06:25 +00:00
gallium r300: transform fs sin and cos input to [0,1) range in NIR 2022-02-11 16:09:45 +00:00
gbm replace 0 with NULL for NULL pointers 2022-01-10 22:53:32 +00:00
getopt
glx glx: Use the new no-error driver interface 2022-02-04 18:36:24 +00:00
gtest gtest: Fix output of array ASSERT/EXPECT macros 2021-11-11 09:53:09 -08:00
hgl
imgui
intel anv: Handle VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE for descriptor sets 2022-02-11 12:03:42 +00:00
loader gallium/dri: add missing PIPE_BIND_DRI_PRIME handling 2022-02-08 00:13:07 +00:00
mapi glthread: call _mesa_glthread_BindBuffer unconditionally 2022-02-01 06:11:22 +00:00
mesa st/mesa: only enable ARB_enhanced_layouts if there are xfb buffers 2022-02-09 03:31:16 +00:00
microsoft microsoft/compiler: Fill interpolation for sysval inputs to non-vertex shader 2022-02-11 00:19:17 +00:00
nouveau
panfrost vulkan: Take a vk_command_pool in vk_command_buffer_init() 2022-02-11 08:06:25 +00:00
tool ci: Use a dlclose-disabling preload library for leak checking in Vulkan. 2022-01-27 23:47:46 +00:00
util driconf: Add Heaven entries for Windows .exe 2022-02-10 20:19:00 +00:00
virtio venus: fix two VN_TRACE_SCOPE's in the same scope 2022-02-10 05:11:46 +00:00
vulkan vulkan: Implement of a bunch of VkCommandPool functions 2022-02-11 08:06:25 +00:00
meson.build meson: start building intel earlier. 2022-01-20 06:41:17 +00:00