Erik Faye-Lund
ec9d7872ac
glcpp: remove outdated msvc hack
...
While MSVC doesn't do __STDC_VERSION__ correctly for C99, it does for
C11, which is what we now require. So we can remove this hack.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16908 >
2022-06-14 15:08:37 +00:00
Alejandro Piñeiro
481df13f27
nir: get res binding using component 0, instead of asssumig an uint
...
Needed to be able to call nir_opt_gcm on the v3dv driver. This change
is needed as on v3dv we honor vulkan resource index returning a vec2.
See commit 21b0a4c80c
for more info.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16986 >
2022-06-14 13:12:46 +00:00
Christian Gmeiner
d364d445ad
isaspec: Handle patterns bigger then 64 bit
...
Currently uint64_t_to_bitmask(..) is used in combination with
the pattern 'match'. This only works for values smaller then
64 bit. Add support for bigger isa sizes.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com >
Reviewed-by: Rob Clark <robdclark@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16996 >
2022-06-14 12:35:39 +00:00
Christian Gmeiner
119d8488dd
isaspec: Extend split_bits(..) to accept a bitsize
...
Make split_bits(..) more generic.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com >
Reviewed-by: Rob Clark <robdclark@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16996 >
2022-06-14 12:35:39 +00:00
Boris Brezillon
d9ec7df2f4
nir: Fix flat new_var assignment in create_new_io_vars()
...
If the type is not an array, glsl_get_length() returns 0 and we don't
update the new_vars[]/flat_vars[] entries.
Fixes: bcd14756ee
("nir/lower_io_to_vector: add flat mode")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16960 >
2022-06-10 08:06:46 +00:00
Emma Anholt
cf265c6606
nir: Rename is_arb_asm to use_legacy_math_rules and document its meaning.
...
On iris and crocus, this flag is used to set "alt mode" math on the shader
as a whole. Some other drivers have a similar mode for DX9/ARB-program
behavior, so document what it does so we can start using it.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16176 >
2022-06-10 03:26:32 +00:00
Jason Ekstrand
133620196d
compiler/types: Don't place members in the previous substruct's end padding
...
With the following structures :
struct StructA
{
uint64_t value0;
uint8_t value1;
};
struct TopStruct
{
struct StructA a;
uint8_t value3;
};
Currently offsetof(struct TopStruct, value3) = 9. While the same code
on the CPU gives offsetof(struct TopStruct, value3) = 16.
This is impacting OpenCL kernels we're trying to use to build
acceleration structures.
v2: Add comment/link to some description of the alignment/size
computation
Cc: mesa-stable
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16940 >
2022-06-09 22:55:37 +00:00
Konstantin Seurer
08577bbb70
nir/nir_lower_io: Optimize 32-bit inbounds access
...
Perform address calculation in 32 bits when
dealing with inbounds array derefs.
Closes : #6562
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16729 >
2022-06-09 16:20:16 +00:00
Konstantin Seurer
f19cbe98e3
nir,spirv: Preserve inbounds access information
...
Preserving information about inbounds access and
the required bit size for the bounds will help
with avoiding 64-bit operations when lowering io.
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16729 >
2022-06-09 16:20:16 +00:00
Timothy Arceri
893b4d98f8
glsl: inline do_common_optimization() call
...
The function was previously a helper for when some drivers still
called the GLSL IR optimisations in a loop. No drivers do that
anymore.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16924 >
2022-06-08 22:58:50 +00:00
Timothy Arceri
d09a37ef54
glsl: remove never true do_dead_code() parameter
...
Since we have now switched all drivers to using NIR and therefore
the NIR based uniform linker this param never needs to be set to
true so remove it.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16924 >
2022-06-08 22:58:50 +00:00
Jason Ekstrand
4655ff1f5b
nir/deref: Handle RESTRICT for SSBO deref bindings
...
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: M Henning <drawoc@darkrefraction.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Jason Ekstrand
8492e78f9d
nir/deref: Handle SSBO array bindings specially
...
Instead of just checking for the variables to match, check that the
entire deref up to the interface type matches.
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: M Henning <drawoc@darkrefraction.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Jason Ekstrand
a5b1274275
nir/vars_tests: Use nir_var_mem_global instead of ssbo
...
We're about to add a bunch of SSBO special cases which will depend on
SSBOs always being either structs or arrays of structs. All those
little vector SSBOs we're creating will no longer be valid. Switch to
nir_var_mem_global to avoid this.
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Jason Ekstrand
2d221c64e7
nir: Increase nir_variable_data::mode to 16 bits
...
This is required if we want to have variables with nir_var_mem_global
which we will for CL eventually. Also, they're useful in unit tests
because they're the most generic thing imaginable and can't get
eliminated by normal means.
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Jason Ekstrand
0ad2dfe942
nir/deref: Re-arrange variable checks in compare_deref_paths
...
Instead of having a bunch of mode checks as special cases, assert that
the modes equal and then switch on the mode. This should make the
special cases a bit easier to understand. Handling of `a_var == b_var`
looks redundant now but it won't be in the next patch.
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: M Henning <drawoc@darkrefraction.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Jason Ekstrand
130d9d80db
nir/deref: Make compare_deref_paths take a stop callback
...
This will let us use it to compare only the first part of a pair of
deref paths and continue the comparison later.
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: M Henning <drawoc@darkrefraction.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Jason Ekstrand
7ebcdada00
nir/deref: Use an index in compare_deref_paths
...
Instead of incrementing pointers, use an integer index. This makes it
clear that we always increment them together. It'll also make the next
change a bit easier. We use a pointer to an integer because the next
patch is going to let us abort the walk and we want to be able to
continue where we left off.
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: M Henning <drawoc@darkrefraction.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Jason Ekstrand
4d80b3217e
nir/deref: Break out a helper for compare_deref_paths
...
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: M Henning <drawoc@darkrefraction.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Rhys Perry
cb5c1bcb7c
nir/deref: stop assuming coherent accesses of different SSBOs may alias
...
Whether it's coherent should be irrelevant and the ACCESS_RESTRICT check
above should consider all cases aliasing unless NIR makes it clear they're
not.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Tested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: M Henning <drawoc@darkrefraction.com >
Cc: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16894 >
2022-06-08 21:30:59 +00:00
Georg Lehmann
1b68d3e43a
nir/lower_tex: Add lower_array_layer_round_even option.
...
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com >
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16871 >
2022-06-08 20:57:22 +00:00
Konstantin Seurer
16585664cd
radv: vkCmdTraceRaysIndirect2KHR
...
This changes the trace rays logic to always use
VkTraceRaysIndirectCommand2KHR and implements
vkCmdTraceRaysIndirect2KHR. I renamed the
load_sbt_amd to sbt_base_amd and moved the SBT
load lowering from ACO to NIR.
Note that we can not just upload one pointer to
all the trace parameters because that would
be incompatible with traceRaysIndirect.
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16430 >
2022-06-08 20:20:21 +00:00
Konstantin Seurer
3aa0ea8279
nir: Handle ray_launch_size_addr in opt_preamble
...
Found this while working on traceRaysIndirect2.
I don't think this is relevant for now at least
since we don't use the pass in RADV.
Fixes: 938c9d9
("nir: Add a ray launch size addr intrinsic")
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16430 >
2022-06-08 20:20:21 +00:00
Konstantin Seurer
2e0e150e69
spirv: Add plumbing for ray_cull_mask
...
Add a new cull_mask system value that is exposed
by the ray_cull_mask capability of
SPV_KHR_ray_cull_mask.
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16430 >
2022-06-08 20:20:21 +00:00
Konstantin Seurer
7c44cb6f5e
vulkan: Spec update to 1.3.216
...
Update the vulkan headers and xml to 1.3.216
including the spirv headers. The new spirv spec
added new OpAlias*INTEL ops, which we ignore in
vtn_gather_types_c.py.
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16430 >
2022-06-08 20:20:21 +00:00
Timur Kristóf
02c87e66e9
nir: Introduce new intrinsics for AMD specific mesh shader task ring.
...
The mesh shader task ring is a buffer in VRAM which we will use to
store some mesh shader outputs that don't fit into LDS.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16737 >
2022-06-08 08:43:51 +00:00
Emma Anholt
ab3a1d41c5
glsl: Drop INT_DIV_TO_MUL_RCP lowering.
...
nir_lower_int_to_float() does this at the end of compilation, no need to
do it up front.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823 >
2022-06-07 02:38:42 +00:00
Emma Anholt
5c499d6d1a
nir: Fix idiv lowering on !NativeIntegers when lower_fdiv is also set.
...
Avoids a regression when turning off GLSL's int div lowering.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823 >
2022-06-07 02:38:42 +00:00
Emma Anholt
464b32c030
glsl: Drop the div-to-mul-rcp lowering for floats.
...
NIR has fdiv, and all the NIR backends have to have lower_fdiv set
appropriately already since various passes (format conversions,
tgsi_to_nir, nir_fast_normalize(), etc.) might generate one.
This causes softpipe and llvmpipe to now do actual divides, since
lower_fdiv is not set there. Note that llvmpipe's rcp implementation is a
divide of 1.0 by x, so now we're going to be just doing div(x, y) instead
of mul(x, div(1.0, y)).
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823 >
2022-06-07 02:38:42 +00:00
Emma Anholt
0fbd1b1f4c
glsl: Move exp/log-to-exp2/log2 lowering to glsl-to-NIR.
...
It's way more concise to write as nir_builder calls.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823 >
2022-06-07 02:38:42 +00:00
Emma Anholt
d024eb6fab
glsl: Remove stale lower_instructions comments.
...
Should have been in 3a42e92a4f
("glsl: Drop the dead MOD_TO_FLOOR path.")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823 >
2022-06-07 02:38:42 +00:00
Emma Anholt
8c4b88ee48
gallium+glsl: Remove EmitNoSat/PIPE_CAP_VERTEX_SHADER_SATURATE
...
The drivers not setting it were:
- nv30, which gets lowering using NIR's lower_fsat flag.
- r300, which gets lowering using NIR's lower_fsat flag.
- a2xx, which has was getting it optimized back to fsat anyway.
This drops the check for the cap from gallium nine. While nine does have
a non-nir path, I think it's safe to assume that if you have SM3
texturing, you can do fsat.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16823 >
2022-06-07 02:38:42 +00:00
Timur Kristóf
f7f2770e72
ac/nir: Add remappability to tess and ESGS I/O lowering passes.
...
This will be used for radeonsi to map common I/O location to fixed
slots agreed by different shader stages.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418 >
2022-06-07 01:40:14 +00:00
Qiang Yu
33b4b923ee
nir: add nir_intrinsic_load_lshs_vertex_stride_amd
...
For loading LS-HS vertex stride by shader argument in radeonsi.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16418 >
2022-06-07 01:40:14 +00:00
Timothy Arceri
4237932685
glsl: tidy up link_varyings_and_uniforms()
...
All uniform linking is now done via nir based linker not via this
code so we drop that from its name. We also drop a bunch of unused
parameters.
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16880 >
2022-06-07 01:11:19 +00:00
Timothy Arceri
f00be793e4
glsl: drop extra optimise swizzles call
...
As per the comment this was meant to tidy things up after varying
linking but varying linking has been moved into a nir based linker
so this extra call is no longer needed.
This optimisation pass is still called in the regular glsl ir
optimisation loop.
No shader-db change on Iris (BDW).
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16880 >
2022-06-07 01:11:19 +00:00
Qiang Yu
19f3737262
mesa: pass select result buffer offset as attribute/varying
...
Will be used by geometry shader to store hit result.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765 >
2022-06-06 18:23:49 +00:00
Qiang Yu
ff8ae4e589
nir/builder: add load/store array variable helper functions
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15765 >
2022-06-06 18:23:49 +00:00
Mike Blumenkrantz
06859ba69c
mesa: handle atomic counter lowering for drivers with big ssbo offset aligns
...
according to the spec, atomic counters can be bound at any offset divisible by 4,
which means that any driver that uses the ssbo lowering pass and doesn't have
a min offset align of 4 is potentially broken
to handle this, use a statevar to inject the misaligned remainder of the offset
into the shader as a uniform. for well-aligned counter binds, the uniform offset
will be 0
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16749 >
2022-06-05 23:16:36 +00:00
Vinson Lee
3e679219a1
clc: Fix build with llvm-15.
...
opencl_c_h is defined only for llvm < 15.
Fixes: bcc2df4890
("clc: speed up compilation by not relying on opencl-c.h")
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16808 >
2022-06-04 22:27:55 -07:00
Timothy Arceri
5aec67a1e1
glsl: remove the now unused GLSL IR loop unrolling code
...
This code was slow, buggy and hard to understand. All drivers
have now switched to using the NIR unrolling code \o/
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366 >
2022-06-04 16:11:49 +00:00
Alyssa Rosenzweig
dc2d8a643f
nir: Export nir_io_add_intrinsic_xfb_info
...
This is useful for drivers which wish to consume XFB information. These
hopefully-uncontroversial hunks are extracted from the much more controversial
"st,nir,radeons: Move nir_lower_io_passes to si_nir_lower_io" by Jason.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15720 >
2022-06-04 14:35:56 +00:00
Alyssa Rosenzweig
5c79d649af
nir: Add transform feedback system values
...
These will be used to facilitate transform feedback lowering for Panfrost,
although other backends could use the sysvals in the future.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15720 >
2022-06-04 14:35:56 +00:00
Timothy Arceri
87aaa0f915
glsl: remove now unused lower_const_arrays_to_uniforms()
...
We now use a NIR version instead.
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
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
4488b577a1
glsl/nir: skip adding hidden uniforms to the remap tables
...
The remap tables are used with the GL API so there is no need to
add hidden uniforms to them. Also when we switch to lowering some
constant arrays to uniforms in NIR in a following patch there
will no longer be enough room in the tables as we assign their
size in the GLSL IR linker not the NIR linker currently.
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
44d6068c5b
nir: add nir based version of the lower_const_arrays_to_uniforms pass
...
Doing this in NIR should give better results, but also allows us to
stop calling more GLSL IR optimisations passes.
v2: Skip 8bit and 16bit type that would require further processing
I believe this is an existing bug in the GLSL IR pass also.
v3: rebuild constant initialisers as we want to call this pass
after nir has already lowered them and performed optimisations.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com > (v1)
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