Timothy Arceri
06f3988c58
glsl: move disable_varying_optimizations_for_sso() to NIR linker
...
Reviewed-by: Emma Anholt <emma@anholt.net >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846 >
2023-07-06 01:21:06 +00:00
Timothy Arceri
a8c485efee
glsl: remove unused system vars
...
System vars are added to the resource list as inputs so remove any
dead ones before building the list.
Reviewed-by: Emma Anholt <emma@anholt.net >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846 >
2023-07-06 01:21:06 +00:00
Timothy Arceri
cbff8f8c5c
glsl: remove unused buffer objects with packed layout
...
These are currently removed by the GLSL IR DCE pass but we will
drop that in a following patch. Also there are scenarios where these
might not be detected as unused until the NIR optimisations have
been run so we really need to do it here too anyway.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846 >
2023-07-06 01:21:06 +00:00
Timothy Arceri
fa56e911b8
glsl: call assign_attribute_or_color_locations() in NIR linker
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846 >
2023-07-06 01:21:06 +00:00
Timothy Arceri
6786a39940
glsl: move lowering linker code out of st
...
Move all these lowering calls into the linker where they belong. This
makes future changes to the linker more flexible and is needed to
allow some following patches as we need to call things in a specific
order.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846 >
2023-07-06 01:21:06 +00:00
Timothy Arceri
a513107424
glsl: move some compiler code out of st
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846 >
2023-07-06 01:21:06 +00:00
Yonggang Luo
dcf9cfd297
glsl: Switch to use nir_foreach_function_impl from nir_foreach_function
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23920 >
2023-06-29 11:29:54 +00:00
Timothy Arceri
d336bc3926
glsl: call nir_opt_find_array_copies() when linking
...
shader-db results IRIS (BDW):
total instructions in shared programs: 17883388 -> 17859658 (-0.13%)
instructions in affected programs: 48100 -> 24370 (-49.33%)
helped: 6
HURT: 0
helped stats (abs) min: 1450 max: 7028 x̄: 3955.00 x̃: 3387
helped stats (rel) min: 40.31% max: 51.92% x̄: 47.07% x̃: 48.96%
95% mean confidence interval for instructions value: -6613.28 -1296.72
95% mean confidence interval for instructions %-change: -52.73% -41.40%
Instructions are helped.
total cycles in shared programs: 866961809 -> 863521521 (-0.40%)
cycles in affected programs: 9179396 -> 5739108 (-37.48%)
helped: 6
HURT: 0
helped stats (abs) min: 252584 max: 972430 x̄: 573381.33 x̃: 495130
helped stats (rel) min: 21.80% max: 48.65% x̄: 35.01% x̃: 34.58%
95% mean confidence interval for cycles value: -917157.00 -229605.67
95% mean confidence interval for cycles %-change: -47.61% -22.40%
Cycles are helped.
total spills in shared programs: 20417 -> 15521 (-23.98%)
spills in affected programs: 6966 -> 2070 (-70.28%)
helped: 6
HURT: 0
total fills in shared programs: 25151 -> 21005 (-16.48%)
fills in affected programs: 4374 -> 228 (-94.79%)
helped: 6
HURT: 0
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9055
Fixes: d75a36a9ee
("glsl: remove do_copy_propagation_elements() optimisation pass")
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23737 >
2023-06-23 09:10:15 +10:00
Yonggang Luo
f9860a84b3
compiler: Combine duplicated implementation of is_gl_identifier into glsl_types.h
...
As glsl_types.cpp also called is_gl_identifier, so move it into glsl_types.h,
this will help the decouple glsl_types.h from src/compiler/glsl/*
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23420 >
2023-06-07 00:33:33 +00:00
Rob Clark
f136f89487
mesa/nir: Add some perfetto traces
...
Signed-off-by: Rob Clark <robdclark@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22646 >
2023-04-24 22:42:04 +00:00
Timothy Arceri
5a29af262c
glsl: move some GL ES checks to the NIR linker
...
Eventually we should aim to remove the GLSL IR linker.
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22305 >
2023-04-06 08:07:35 +00:00
Patrick Lerda
b2c340c106
mesa/st: fix possible crash related to arb invalid memory access
...
This invalid memory access is a consequence of wrong assumptions,
for instance:
"prog->sh.data is NULL if it's ARB_fragment_program"
This issue is triggered with piglit/fp-formats -auto -fbo:
==9747==ERROR: AddressSanitizer: heap-use-after-free on address 0x007f7c812d90 at pc 0x007f833c09f8 bp 0x007fd7eca750 sp 0x007fd7eca768
READ of size 4 at 0x007f7c812d90 thread T0
#0 0x7f833c09f4 in st_get_sampler_views ../src/mesa/state_tracker/st_atom_texture.c:109
#1 0x7f833c0b48 in update_textures ../src/mesa/state_tracker/st_atom_texture.c:266
#2 0x7f82b2d120 in st_validate_state ../src/mesa/state_tracker/st_util.h:128
#3 0x7f82b2d120 in prepare_draw ../src/mesa/state_tracker/st_draw.c:88
#4 0x7f82b2de64 in st_draw_gallium ../src/mesa/state_tracker/st_draw.c:141
#5 0x7f83105940 in _mesa_draw_arrays ../src/mesa/main/draw.c:1202
#6 0x7f8d5fa5cc in piglit_draw_rect_from_arrays piglit/tests/util/piglit-util-gl.c:711
#7 0x7f8d5fac34 in piglit_draw_rect_custom piglit/tests/util/piglit-util-gl.c:833
#8 0x4019e0 in piglit_display piglit/tests/shaders/fp-formats.c:67
#9 0x7f8d643fc4 in run_test piglit/tests/util/piglit-framework-gl/piglit_fbo_framework.c:52
#10 0x401624 in main piglit/tests/shaders/fp-formats.c:39
Signed-off-by: Patrick Lerda <patrick9876@free.fr >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21175 >
2023-02-10 04:45:29 +00:00
Yonggang Luo
bf338c3d7f
mesa: #include "util/glheader.h" instead GL/gl.h in shared code
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Brian Paul brianp@vmware.com
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19472 >
2022-11-03 16:07:31 +00:00
SoroushIMG
1e8e785a07
nir: allow to fine tune unrolling for loops with soft fp64 ops
...
Lowered fp64 ops can blow up the loop bodies while still being
suitable for unrolling.
Allow for using different parameters to unroll loops with
soft fp64.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18863 >
2022-09-30 17:07:37 +00:00
Pierre-Eric Pelloux-Prayer
70891edd97
nir: add a nir_opt_if_options enum
...
And don't enable nir_opt_if_optimize_phi_true_false on radeonsi with
LLVM 14 because it crashes Blender.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6976
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17949 >
2022-08-10 12:55:39 +00:00
Timothy Arceri
c573260c9b
glsl: switch to NIR based implementation of lower_const_arrays_to_uniforms()
...
Shader-db results iris (BDW):
total instructions in shared programs: 17523543 -> 17513909 (-0.05%)
instructions in affected programs: 218091 -> 208457 (-4.42%)
helped: 69
HURT: 327
helped stats (abs) min: 2 max: 2919 x̄: 160.84 x̃: 12
helped stats (rel) min: 0.21% max: 96.88% x̄: 14.87% x̃: 6.40%
HURT stats (abs) min: 1 max: 47 x̄: 4.48 x̃: 1
HURT stats (rel) min: 0.10% max: 22.02% x̄: 3.33% x̃: 0.18%
95% mean confidence interval for instructions value: -45.02 -3.63
95% mean confidence interval for instructions %-change: -1.16% 1.47%
Inconclusive result (%-change mean confidence interval includes 0).
total loops in shared programs: 4875 -> 4868 (-0.14%)
loops in affected programs: 7 -> 0
helped: 7
HURT: 0
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00%
95% mean confidence interval for loops value: -1.00 -1.00
95% mean confidence interval for loops %-change: -100.00% -100.00%
Loops are helped.
total cycles in shared programs: 858032406 -> 857984712 (<.01%)
cycles in affected programs: 22940290 -> 22892596 (-0.21%)
helped: 155
HURT: 312
helped stats (abs) min: 1 max: 49696 x̄: 1697.70 x̃: 62
helped stats (rel) min: <.01% max: 70.84% x̄: 5.60% x̃: 0.82%
HURT stats (abs) min: 1 max: 19640 x̄: 690.54 x̃: 100
HURT stats (rel) min: <.01% max: 217.23% x̄: 33.57% x̃: 0.92%
95% mean confidence interval for cycles value: -436.09 231.84
95% mean confidence interval for cycles %-change: 15.39% 25.75%
Inconclusive result (value mean confidence interval includes 0).
total spills in shared programs: 16289 -> 15205 (-6.65%)
spills in affected programs: 2753 -> 1669 (-39.38%)
helped: 9
HURT: 1
total fills in shared programs: 20347 -> 20324 (-0.11%)
fills in affected programs: 1642 -> 1619 (-1.40%)
helped: 9
HURT: 1
total sends in shared programs: 972151 -> 971960 (-0.02%)
sends in affected programs: 1910 -> 1719 (-10.00%)
helped: 25
HURT: 20
helped stats (abs) min: 1 max: 50 x̄: 9.00 x̃: 2
helped stats (rel) min: 0.87% max: 53.76% x̄: 13.89% x̃: 6.25%
HURT stats (abs) min: 1 max: 8 x̄: 1.70 x̃: 1
HURT stats (rel) min: 8.33% max: 200.00% x̄: 52.36% x̃: 33.33%
95% mean confidence interval for sends value: -8.19 -0.29
95% mean confidence interval for sends %-change: -1.07% 32.18%
Inconclusive result (%-change mean confidence interval includes 0).
LOST: 3
GAINED: 27
Note a small number of tests fail on lima and r300 after this patch.
However since we are doing the correct thing here and they only
fail due to a slight increase in instruction count pushing them
over their instruction count limit, we are defering that issue
to a different bug report for further discussion.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6540
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770 >
2022-06-04 03:13:36 +00:00
Timothy Arceri
1805ee8d7b
glsl: move gl_nir_link_opts() call out of the st code
...
Calling this directly in the linker code allows us to place it between
the varying linker and uniform linker calls which allows for better
optimisation/removal of uniforms.
Also in a later patch it allows us to insert a new nir based
lower_const_arrays_to_uniforms() call after the gl_nir_link_opts()
call. This is important because it allows the linking opts to
move constant arrays to later stages if possible before
lower_const_arrays_to_uniforms() turns them into uniforms.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6541
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770 >
2022-06-04 03:13:36 +00:00
Timothy Arceri
a14e2733ce
glsl: move common link time optimisation calls to linker code
...
In the following patch we will move the users of this function to
this file too and make it static again.
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770 >
2022-06-04 03:13:36 +00:00
Timothy Arceri
64dbc3f03a
glsl/nir: allow the nir linker to remove dead uniforms we created
...
Some backends lower constant arrays to uniforms in GLSL IR. These
create so called hidden uniforms. Since we know these are added
per stage it is safe to remove them if we detect they are dead.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Acked-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770 >
2022-06-04 03:13:36 +00:00
Timothy Arceri
792c9a0a24
glsl: move validation of sampler indirects to the nir linker
...
This will allow us to disable the GLSL IR loop unroller in a
following patch and rely on the NIR loop unroller instead.
This allows the piglit test spec@!opengl 2.0@max-samplers border
to pass on the v3d rpi4 driver.
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16543 >
2022-05-17 02:12:21 +00:00
Timothy Arceri
7647023f3b
glsl: enable the use of the nir based varying linker
...
Here as well as calling the pass we need to switch the order of
some of the information gathering and optimisation calls. We also
need to create a custom callback for the dead variables removal
pass to clean up dead builtin varying in SSO programs without
causing piglit regressions.
shader-db results IRIS (BDW):
total instructions in shared programs: 17487900 -> 17477072 (-0.06%)
instructions in affected programs: 128682 -> 117854 (-8.41%)
helped: 587
HURT: 82
helped stats (abs) min: 1 max: 145 x̄: 18.82 x̃: 20
helped stats (rel) min: 0.21% max: 77.78% x̄: 17.41% x̃: 8.85%
HURT stats (abs) min: 1 max: 6 x̄: 2.68 x̃: 2
HURT stats (rel) min: 0.25% max: 9.76% x̄: 2.94% x̃: 2.16%
95% mean confidence interval for instructions value: -17.71 -14.66
95% mean confidence interval for instructions %-change: -16.40% -13.42%
Instructions are helped.
total cycles in shared programs: 857442520 -> 857170199 (-0.03%)
cycles in affected programs: 112252720 -> 111980399 (-0.24%)
helped: 13733
HURT: 13349
helped stats (abs) min: 1 max: 7293 x̄: 81.44 x̃: 10
helped stats (rel) min: <.01% max: 90.32% x̄: 3.30% x̃: 0.62%
HURT stats (abs) min: 1 max: 7424 x̄: 63.38 x̃: 8
HURT stats (rel) min: <.01% max: 192.23% x̄: 3.28% x̃: 0.54%
95% mean confidence interval for cycles value: -14.01 -6.10
95% mean confidence interval for cycles %-change: -0.17% 0.06%
Inconclusive result (%-change mean confidence interval includes 0).
total sends in shared programs: 971443 -> 970010 (-0.15%)
sends in affected programs: 4596 -> 3163 (-31.18%)
helped: 446
HURT: 39
helped stats (abs) min: 1 max: 6 x̄: 3.40 x̃: 4
helped stats (rel) min: 3.03% max: 85.71% x̄: 46.48% x̃: 50.00%
HURT stats (abs) min: 1 max: 3 x̄: 2.15 x̃: 2
HURT stats (rel) min: 6.67% max: 25.00% x̄: 15.16% x̃: 10.53%
95% mean confidence interval for sends value: -3.13 -2.78
95% mean confidence interval for sends %-change: -44.16% -38.88%
Sends are helped.
LOST: 235
GAINED: 262
Shader-db results radeonsi (RX580):
169505 shaders in 102144 tests
Totals:
SGPRS: 7698832 -> 7696552 (-0.03 %)
VGPRS: 5547296 -> 5545280 (-0.04 %)
Spilled SGPRs: 14795 -> 14773 (-0.15 %)
Spilled VGPRs: 3782 -> 3782 (0.00 %)
Private memory VGPRs: 1152 -> 1152 (0.00 %)
Scratch size: 3872 -> 3872 (0.00 %) dwords per thread
Code Size: 162946528 -> 162895264 (-0.03 %) bytes
Max Waves: 2449334 -> 2449736 (0.02 %)
Totals from affected shaders:
SGPRS: 215024 -> 212744 (-1.06 %)
VGPRS: 151976 -> 149960 (-1.33 %)
Spilled SGPRs: 162 -> 140 (-13.58 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 5249916 -> 5198652 (-0.98 %) bytes
Max Waves: 54588 -> 54990 (0.74 %)
Panfrost trace checksum is updated as per discussion in:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/6343
Some virpipe tess shader piglit tests are added as failures to CI
these failures are not a regression but an uncovered existing bug
exposed due to the linker no longer sorting internally facing
shader interfaces in alphabetical order. See details in:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/6481
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15731 >
2022-05-16 03:33:18 +00:00
Timothy Arceri
43a8454ea8
glsl: add new build program resource helpers
...
These will be used by a new nir based glsl varying linker that will
add varyings directly to the list before the are packed and we lose
the information.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15731 >
2022-05-16 03:33:18 +00:00
Timothy Arceri
bfa096a0b9
glsl/st: move st_nir_opts() into gl compiler common code
...
This will allow us to use this in future NIR linker work. It also makes
more sense to move it here as the classic drivers are gone, tgsi is
going away and we are merging more of the st into the gl common code.
Reviewed-by: Emma Anholt <emma@anholt.net >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14785 >
2022-01-31 11:49:21 +00:00
Dave Airlie
23b361ae12
glsl: move off mtypes.h in lots of places.
...
This moves to the new split out header files, should mean less recompiling
for unrelated changes.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
ccbf700d6c
nir: remove gl.h include from nir headers.
...
This saves a lot of pointless gl.h includes across the board,
it moves the one place that needs GLenum into a separate file
only used in those passes that require it.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605 >
2022-01-19 21:54:58 +00:00
Dave Airlie
e943af6a55
glsl/nir/linker: avoid passing gl_context inside gl_nir linker
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14433 >
2022-01-07 06:19:49 +00:00
Dave Airlie
34090712c6
glsl/linker: remove gl_context from check image resources
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14433 >
2022-01-07 06:19:49 +00:00
Dave Airlie
4d6e866b7b
glsl/linker: get rid of gl_context from atomic counters paths
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14433 >
2022-01-07 06:19:49 +00:00
Dave Airlie
e9ec1429ba
glsl/linker: get rid of gl_context from uniform assign paths
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14433 >
2022-01-07 06:19:49 +00:00
Marek Olšák
dea558cbd2
glsl: add gl_resource_name to precompute "name" properties later
...
This just adds the structure with a name and its update function.
strlen and others will be added in the following commits. The idea is to
parse and analyze the name in advance to make glGetUniformLocation faster.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13507 >
2021-10-29 07:19:18 -04:00
Jason Ekstrand
0bbb32ece4
glsl/nir/linker: Also remove image variables
...
If we don't, then the array shrinker may shrink them to an array of zero
images which can cause GLSL serialization to blow up but only the next
time the GLSL shader is loaded from the disk cache.
Fixes: b8ee37472d
("glsl: Use nir_var_mem_image for images")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5520
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13412 >
2021-10-27 01:45:13 -05:00
Caio Marcelo de Oliveira Filho
cb7352ae95
nir: Add a data pointer to the callback in nir_remove_dead_variables
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8706 >
2021-01-26 05:58:34 +00:00
Pierre-Eric Pelloux-Prayer
805b6b426e
nir: update fallthrough comments
...
clang doesn't support /* fallthrough */ so switch to fallthrough
attribute.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7747 >
2020-12-01 10:04:41 +01:00
Jason Ekstrand
fc1363cc60
nir/gl_nir_linker: Call add_vars_with_modes once for GL_PROGRAM_INPUT
...
Now that nir_foreach_variable_with_modes can handle multiple modes at
one time, we can simplify things a bit and only walk the list once.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966 >
2020-07-29 17:38:58 +00:00
Jason Ekstrand
77c41ce04b
nir/gl_nir_linker: Use nir_foreach_variable_with_modes
...
Reviewed-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966 >
2020-07-29 17:38:58 +00:00
Timothy Arceri
f692131641
glsl: move fallthrough comment to where gcc can see it
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5705 >
2020-07-02 23:52:52 +00:00
Timothy Arceri
7873276f68
glsl/spirv: remove dead uniforms in spirv nir linker
...
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797 >
2020-06-03 02:22:23 +00:00
Timothy Arceri
a494b62410
glsl: remove dead uniforms in the nir linker
...
This is now possible as we do uniform linking via a nir based linker.
Shader-db results for IRIS (SKL):
total instructions in shared programs: 14947192 -> 14946397 (<.01%)
instructions in affected programs: 39498 -> 38703 (-2.01%)
helped: 230
HURT: 18
total cycles in shared programs: 324868402 -> 324847058 (<.01%)
cycles in affected programs: 706701 -> 685357 (-3.02%)
helped: 599
HURT: 449
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797 >
2020-06-03 02:22:23 +00:00
Timothy Arceri
60bee4c70c
glsl: add can_remove_uniform() helper to the NIR linker
...
This helper reflects the rules we follow in the GLSL IR linker when
deciding if we can remove a dead uniform. This check is required to
avoid regressions when turning on NIR dead uniform clean up in the
following patch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797 >
2020-06-03 02:22:23 +00:00
Timothy Arceri
95f555a93a
st/glsl_to_nir: make use of nir linker for linking uniforms
...
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4395 >
2020-04-21 01:57:34 +00:00
Alejandro Piñeiro
2ba272135a
nir/linker: remove reference to just SPIR-V linking
...
Several files had a initial comment about the purpose of such files,
including a reference that the NIR linker was implemented with just
ARB_gl_spirv in mind.
Since the nice job Timothy is doing to use the NIR linker on GLSL,
that is not true anymore, so let's remove that reference and also
tweak some other comments.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com >
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4081 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4081 >
2020-03-06 12:28:08 +00:00
Timothy Arceri
87e0dd68f5
glsl: call calculate_subroutine_compat() from the nir linker
...
Reviewed-by: Tapani Pälli <tapani.palli@intel.com >
2020-01-10 00:41:20 +00:00
Timothy Arceri
c60d0bd92f
glsl: call uniform resource checks from the nir linker
...
Reviewed-by: Tapani Pälli <tapani.palli@intel.com >
2020-01-10 00:41:20 +00:00
Timothy Arceri
b85985dd51
glsl: call check_subroutine_resources() from the nir linker
...
Reviewed-by: Tapani Pälli <tapani.palli@intel.com >
2020-01-10 00:41:20 +00:00
Timothy Arceri
3bd4bcd418
glsl: use nir version of check_image_resources() for nir linker
...
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
2020-01-07 09:53:51 +11:00
Timothy Arceri
feffd1fa65
glsl: add check_image_resources() for the nir linker
...
This is adapted from the GLSL IR code but doesn't need to
iterate over the IR. I believe this also fixes a potential bug in
the GLSL IR code which potentially counts the same output twice.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
2020-01-07 09:53:51 +11:00
Timothy Arceri
ed325ac4dd
glsl: add new gl_nir_link_glsl() helper
...
This will allow us to do some linking in NIR that was previously
done by the GLSL IR linker. To start with this just has calls for
linking atomics.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
2020-01-07 08:39:16 +11:00
Timothy Arceri
432ed13dec
glsl: rename gl_nir_link() to gl_nir_link_spirv()
...
A NIR based glsl linking function will be too different to the
spirv version to bother attempting any sharing. So lets change
the name to be explicit.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
2020-01-07 08:38:41 +11:00
Timothy Arceri
a6aedc662e
st/glsl_to_nir: use nir based program resource list builder
...
Here we use the NIR based builder to add everything to the resource
list execpt for SSO packed varyings. Since the details of those
varyings get lost during packing we leave the special handing to
the GLSL IR pass for now. In order to do this we add some bools
to the build resource list functions.
Using the NIR based resource list builder gets us a step closer to
using a native NIR based linker. It should also be faster than the
GLSL IR builder, one because the NIR optimisations should mean we
add less entries due to better optimisations, and two because nir
gives us better lists to work with and we don't need to walk the
entire IR to find the resources.
Ack-by: Alejandro Piñeiro <apinheiro@igalia.com >
2019-12-13 00:07:19 +00:00
Timothy Arceri
d0259f4159
glsl: add subroutine support to nir_build_program_resource_list()
...
This is required so we can use the NIR linker to link GLSL in
addition to spirv.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
2019-12-13 00:07:19 +00:00