lima/ppir: duplicate intrinsics in nir
authorErico Nunes <nunes.erico@gmail.com>
Mon, 13 Apr 2020 13:30:25 +0000 (15:30 +0200)
committerMarge Bot <eric+marge@anholt.net>
Sat, 9 May 2020 11:30:07 +0000 (11:30 +0000)
commit5e6c3861182cbf481ce3d25d0bbbcad4916c92dd
treef6baf0af07d56c1f1716f8477cb6aceba16873ea
parent09003ba0700ed0ddc57d85e82320f15a2a90c8dd
lima/ppir: duplicate intrinsics in nir

Move the duplicate uniform and varying steps to a nir pass, along with
some changes in the duplicating strategy.

Node duplication is now done per user of the varying/uniform. This is
inspired by what the offline shader compiler seems to usually do, and as
usual aims to reduce register pressure and better utilize the ld_uni and
ld_var instruction slots.
It is worth noting that due to a bug/feature, ppir was already
duplicating uniforms per successor in ppir_node_add_src even if the
comment indicated it was meant to be per-block.
Additionally, ppir was duplicating load uniform nodes twice for nodes
that use the same uniform in more than one source, resulting in one
unnecessary (and unpipelineable) load. This new implementation in nir
only creates one load in that case.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4535>
src/gallium/drivers/lima/Android.mk
src/gallium/drivers/lima/ir/lima_ir.h
src/gallium/drivers/lima/ir/lima_nir_duplicate_intrinsic.c [new file with mode: 0644]
src/gallium/drivers/lima/ir/pp/nir.c
src/gallium/drivers/lima/lima_program.c
src/gallium/drivers/lima/meson.build