iris: Reconfigure the URB only if it's necessary or possibly useful
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 26 Jan 2021 06:25:51 +0000 (22:25 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 27 Jan 2021 18:30:54 +0000 (18:30 +0000)
commit939bc0c5889358d4afda1404659d67da66db2b61
tree81086526064fbcb88ecc710017f66d7d3d54168e
parenta710145b5bf60ef47460eea87b072077e3ddaa72
iris: Reconfigure the URB only if it's necessary or possibly useful

Reconfiguring the URB partitioning is likely to cause shader stalls,
as the dividing line between each stage's section of memory is moving.
(Technically, 3DSTATE_URB_* are pipelined commands, but that mostly
means that the command streamer doesn't need to stall.)  So it should
be beneficial to update the URB configuration less often.

If the previous URB configuration already has enough space for our
current shader's needs, we can just continue using it, assuming we
are able to allocate the maximum number of URB entries per stage.
However, if we ran out of URB space and had to limit the number of
URB entrties for a stage, and the per-entry size is larger than we
need, we should reconfigure it to try and improve concurrency.

So, we begin tracking the last URB configuration in the context,
and compare against that when updating shader variants.

Cuts 36% of the URB reconfigurations (excluding BLORP) from a
Shadow of Mordor trace, and 46% from a GFXBench Manhattan 3.0 trace.

One nice thing is that this removes the need to look at the old
prog_data when updating shaders, which should make it possible to
unbind shader variants without causing spurious URB updates.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8721>
src/gallium/drivers/iris/iris_blorp.c
src/gallium/drivers/iris/iris_context.c
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_program.c
src/gallium/drivers/iris/iris_state.c