Erik Faye-Lund
bc0222d471
compiler/nir: add texcoord replace lowering pass
...
This lowering pass allows us to replace point-sprites to gl_PointCoord,
which better match what modern hardware does.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6473 >
2021-01-25 17:32:33 +00:00
Connor Abbott
6ca1ab3bb4
nir/lower_tex: Assume that nir_tex_instr::dest_type is sized
...
This reverts the code back to the form it was before, but with an
explicitly sized float32 instead of float, now that all producers are
switched over.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:59 +01:00
Connor Abbott
708c47e663
nir: Validate nir_tex_instr::dest_type bitsize
...
In theory, we could also verify this against the sampler type for
sampler derefs, but there are a number of complications there:
- SPIR-V 1.4 lets you override the signedness of integer samplers
per-instruction. So the base type may not match.
- mediump/RelaxedPrecision samplers may get lowered to f16 in the
instruction or may not. So the bitsize may not match.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:53 +01:00
Connor Abbott
6af5181f13
vtn: Use sized types for nir_tex_instr::dest_type
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:53 +01:00
Connor Abbott
d5e54c6edb
glsl/nir: Use sized types for nir_tex_instr::dest_type
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:53 +01:00
Connor Abbott
b2da598ff9
nir: Use sized types for nir_tex_instr::dest_type
...
Revieweeviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:48 +01:00
Connor Abbott
3d803893da
nir/lower_bool: Rewrite dest_type for boolean destinations
...
This happens with nir_texop_samples_identical, and we need to keep
things consistent and (soon) keep the validator happy when expanding
booleans once we switch that to having a dest_type of bool1.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:42 +01:00
Connor Abbott
acd6616eab
nir/lower_tex: Handle sized tex destination types
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:26 +01:00
Mike Blumenkrantz
64fd191d8a
spirv: handle NoContraction in GLSL450 alu ops
...
we were dropping this when it was set, leading to incorrect algebraic
optimizations that broke various types of tests, e.g., running
spec@arb_gpu_shader5@execution@precise@fs-fract-of-nan in zink
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6116 >
2021-01-23 01:39:09 +00:00
Jason Ekstrand
178820212b
nir/lower_int64: Lower 64-bit vote_ieq
...
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7329 >
2021-01-22 18:38:37 +00:00
Jason Ekstrand
731adf1e17
nir/lower_int64: Add lowering for 64-bit iadd shuffle/reduce
...
Lowering iadd is a bit trickier because we have to deal with potential
overflow but it's still not bad to do in NIR.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7329 >
2021-01-22 18:38:37 +00:00
Jason Ekstrand
bf7a114246
nir/lower_int64: Add lowering for some 64-bit subgroup ops
...
These are all pretty trivial because we can just split the op into one
subgroup op per half of the value. There's some question as to whether
these belong in lower_int64 or lower_subgroups but, on Intel, they key
decider of whether or not we need the lowering is based on whether or
not we have hardware int64 support.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7329 >
2021-01-22 18:38:37 +00:00
Jason Ekstrand
da331f814f
nir/lower_int64: Fix lowering of f2[ui]64 for 16-bit float
...
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7329 >
2021-01-22 18:38:37 +00:00
Jason Ekstrand
70b4524de5
nir/lower_int64: Add a level of wrapper functions
...
We're about to start lowering a few intrinsics so we need support more
than just ALU.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7329 >
2021-01-22 18:38:37 +00:00
Marek Olšák
fb73058ad2
mesa: add upper bound to limit program state var iterations
...
State parameters are sometimes not perfectly sorted.
This optimizes the number of iterations we have to do for fetch_state.
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183 >
2021-01-21 21:59:29 +00:00
Marek Olšák
0c77190b31
glsl: split gl_CurrentAttribFragMESA into elements
...
This reduces the constant buffer size by eliminating unused elements
because it's no longer a uniform array that the compiler can't split.
This looks silly, but there is no other way because all elements must be
globally declared, which means they can't be generated by a loop.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183 >
2021-01-21 21:59:29 +00:00
Marek Olšák
e3a7acf958
glsl: remove unused internal builtin gl_CurrentAttribVertMESA
...
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183 >
2021-01-21 21:59:29 +00:00
Marek Olšák
0eccba1ac0
mesa: flatten STATE_MATERIAL and STATE_LIGHTPROD tokens
...
Flattening continue to get optimal code in fetch_state.
This merges the "face" field with the "attrib" field using the combined
MAT_ATTRIB_* enums. The outcome is that the inner switch statements can
be flatten because we can use MAT_ATTRIB_* to index into the attrib array
directly.
With LightSource attributes that don't have two sides, more math is
involved to get the correct index but it works out nicely too.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183 >
2021-01-21 21:59:29 +00:00
Marek Olšák
b4f3497786
mesa: remove STATE_INTERNAL
...
Let's flatten the tokens to generate optimal code for fetch_state.
There was only one name conflict: STATE_NORMAL_SCALE was used both as
internal and non-internal.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8183 >
2021-01-21 21:59:29 +00:00
Rhys Perry
a6d92eaf4f
nir/sink,nir/move: sink/move reorderable load_ssbo
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6490 >
2021-01-21 18:07:03 +00:00
Rhys Perry
e200ce0996
nir/lower_io: fix array_length lowering if buffer is smaller than offset
...
Matches SPIR-V -> NIR implementation of OpArrayLength.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8163 >
2021-01-21 11:53:12 +00:00
Jesse Natalie
13b21156e4
nir: Work around MSVC x86 internal compiler error
...
Fixes: 1fd8b466 ("nir,spirv: add sparse image loads")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4108
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8581 >
2021-01-20 20:42:48 +00:00
Ilia Mirkin
a0f4affcf6
glsl: only expose int64 atomics when extension is enabled
...
This limits the exposure of these functions to when the extension is
available. Prevents crashes otherwise, as the rest of the infrastructure
doesn't necessarily expect these functions when the extension is not
available.
Fixes: 40c1f9883e ("mesa,glsl: add support for GL_NV_shader_atomic_int64")
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8533 >
2021-01-16 18:21:03 +00:00
Mike Blumenkrantz
652e51e1f3
nir/lower_uniforms_to_ubo: set explicit_binding on uniform_0
...
this variable is always bound to buffer index 0, so the binding info
here is actually useful
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7935 >
2021-01-14 17:29:09 +00:00
Mike Blumenkrantz
491e7decad
util/set: add the found param to search_or_add
...
this brings parity with the internal api
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8450 >
2021-01-14 13:51:35 +00:00
Rhys Perry
dfe429eb41
nir/loop_unroll: unroll more aggressively if it can improve load scheduling
...
Significantly improves performance of a Control compute shader. Also seems
to increase FPS at the very start of the game by ~5% (RX 580, 1080p,
medium settings, no MSAA).
fossil-db (Sienna):
Totals from 81 (0.06% of 139391) affected shaders:
SGPRs: 3848 -> 4362 (+13.36%); split: -0.99%, +14.35%
VGPRs: 4132 -> 4648 (+12.49%)
CodeSize: 275532 -> 659188 (+139.24%)
MaxWaves: 986 -> 906 (-8.11%)
Instrs: 54422 -> 126865 (+133.11%)
Cycles: 1057240 -> 750464 (-29.02%); split: -42.61%, +13.60%
VMEM: 26507 -> 61829 (+133.26%); split: +135.56%, -2.30%
SMEM: 4748 -> 5895 (+24.16%); split: +31.47%, -7.31%
VClause: 1933 -> 6802 (+251.89%); split: -0.72%, +252.61%
SClause: 1179 -> 1810 (+53.52%); split: -3.14%, +56.66%
Branches: 1174 -> 1157 (-1.45%); split: -23.94%, +22.49%
PreVGPRs: 3219 -> 3387 (+5.22%); split: -0.96%, +6.18%
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6538 >
2021-01-13 18:54:18 +00:00
Daniel Schürmann
08fbd5d454
nir/divergence_analysis: mark load_push_constant as uniform
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8439 >
2021-01-12 14:46:13 +00:00
Mike Blumenkrantz
f7527f7f65
glcpp: disable 'windows' tests
...
these timeout a lot
Acked-by: Daniel Stone <daniels@collabora.com >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Acked-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8321 >
2021-01-12 01:51:16 +00:00
Daniel Schürmann
bd8e84eb8d
nir: replace .lower_sub with .has_fsub and .has_isub
...
This allows a more fine-grained control about whether
a backend supports one of these instructions.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597 >
2021-01-11 19:13:51 +00:00
Daniel Schürmann
b3ce55b445
nir,vc4: Lower fneg to fmul(x, -1.0)
...
This patch also replaces lower_negate with lower_ineg / lower_fneg.
The fneg semantics have been clarified as of Version 1.5, Revision 1
of the SPIR-V specification, which means that the previous lowering
to fsub is not a viable solution anymore, and is replaced with
lowering to fmul(x, -1.0).
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597 >
2021-01-11 19:13:51 +00:00
Erico Nunes
faaba0d6af
nir/lower_vec_to_movs: don't vectorize unsupports ops
...
If the instruction being coalesced would be vectorized but the target
doesn't support vectorizing that op, skip coalescing.
Reuse the callbacks from alu_to_scalar to describe which ops should not
be vectorized.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Eric Anholt <eric@anholt.net >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6506 >
2021-01-11 13:13:30 +00:00
Rhys Perry
b634d7f3e2
nir/opt_vectorize: fix srcs_equal() with two different non-const
...
To match hash_alu_src(), this should return false if both are different
non-const ssa defs.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8391 >
2021-01-09 11:14:05 +00:00
Rhys Perry
bdf316ae7b
nir/opt_vectorize: fix typo in instr_can_rewrite()
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8391 >
2021-01-09 11:14:05 +00:00
Eric Anholt
670944ba04
nir/lower_locals_to_regs: Use the imul_imm helper instead of forcing it.
...
Cleaned up a bit of addressing math in the shader I just had to debug.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8373 >
2021-01-08 21:04:31 +00:00
Rhys Perry
f5adf27fb9
nir,radv: add and use nir_vectorize_tess_levels()
...
fossil-db (Sienna):
Totals from 1342 (0.97% of 138791) affected shaders:
CodeSize: 3287996 -> 3269572 (-0.56%); split: -0.56%, +0.00%
Instrs: 629896 -> 628191 (-0.27%); split: -0.31%, +0.04%
Cycles: 2619244 -> 2612424 (-0.26%); split: -0.30%, +0.04%
VMEM: 388807 -> 389273 (+0.12%); split: +0.14%, -0.02%
SMEM: 90655 -> 90700 (+0.05%); split: +0.06%, -0.01%
VClause: 21831 -> 21812 (-0.09%)
PreVGPRs: 44155 -> 44058 (-0.22%)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4202 >
2021-01-07 16:34:53 +00:00
Rhys Perry
f199b7188b
nir/load_store_vectorize: add data as callback args
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4202 >
2021-01-07 16:34:53 +00:00
Rhys Perry
00c8bec47b
nir: add nir_load_store_vectorize_options
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4202 >
2021-01-07 16:34:53 +00:00
Rhys Perry
f4eb833a12
nir/load_store_vectorize: don't ignore subgroup memory barriers
...
Not sure why I thought this was correct, but we should consider them for
optimization purposes.
Fixes: ce9205c03b ('nir: add a load/store vectorization pass')
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4202 >
2021-01-07 16:34:53 +00:00
Rhys Perry
c73c246e05
nir: gather whether a compute shader uses non-quad subgroup intrinsics
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7918 >
2021-01-07 15:01:02 +00:00
Rhys Perry
f7a5b8ed35
vtn: support SpvCapabilitySparseResidency
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Rhys Perry
7d1d4acbd5
nir/lower_tex: fix lower_tg4_offsets with sparse fetches
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Rhys Perry
2d2decc905
nir: add sparse_residency_code_and
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Rhys Perry
4cbdf9ec4d
nir,spirv: implement SpvOpImageSparseTexelsResident
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Rhys Perry
1fd8b46667
nir,spirv: add sparse image loads
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Rhys Perry
3a7972f72a
nir,spirv: add sparse texture fetches
...
Like SPIR-V and GL_ARB_sparse_texture2, these return a residency code. It
is placed in the destination after the rest of the result. If it's zero,
then the texel is resident. Otherwise, it's not resident.
Besides the larger destination and the residency code, sparse fetches
work the same as normal fetches.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Rhys Perry
95819663b7
nir: allow 5 component vectors
...
These will be useful for sparse texture instructions and image load
intrinsics.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Rhys Perry
ba4a73a502
nir/tests: fix callback for load/store vectorizer tests
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Daniel Schürmann
22b89d9a52
nir/opt_vectorize: fix call to filter function
...
Due to the typo, it could happen that instructions
got further vectorized than intended.
Fixes: 8eaf9c61d1 ('nir/opt_vectorize: don't hash filtered instructions')
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8352 >
2021-01-06 19:03:07 +00:00
Christian Gmeiner
c0fe111d64
nir: use intrinsic builders
...
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295 >
2021-01-06 14:34:41 +00:00
Mike Blumenkrantz
b5fb66a5ed
nir: preserve explicit_binding in lower_atomics_to_ssbo
...
it's important to be able to tell whether this is explicitly set by the
user
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7489 >
2021-01-06 12:56:09 +00:00