Commit Graph

417 Commits

Author SHA1 Message Date
Boris Brezillon a5ba2e2045 pan/bi: Add support for gl_DrawID
We simply pass the drawid as a sysval.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10417>
2021-05-12 07:03:51 +00:00
Boris Brezillon 7cc4c8c5e5 pan/bi: Add support for gl_{BaseVertex,BaseInstance}
Extend the VERTEX_INSTANCE_OFFSETS sysval to pass
BaseVertex/BaseInstance information to the shader.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10417>
2021-05-12 07:03:51 +00:00
Alyssa Rosenzweig 69d81edaf8 pan/bi: Add first_vertex to vertex ID
Apparently r61 is zero based.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10417>
2021-05-12 07:03:51 +00:00
Alyssa Rosenzweig aa765c54bd pan/bi: Add divergent intrinsic lowering pass
This is undefined behaviour in the hardware but perfectly legal NIR, so
lower to an if ladder predicated on the lane ID (the blob's preferred
strategy).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10022>
2021-05-07 18:20:30 +00:00
Alyssa Rosenzweig 7e4ee9bd2f pan/bi: Map load_subgroup_invocation to FAU
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10022>
2021-05-07 18:20:30 +00:00
Alyssa Rosenzweig 754c192e04 pan/bi: Drop load_sampler_lod_parameters_pan
Only used for an erratum workaround on Mali T720.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10022>
2021-05-07 18:20:30 +00:00
Alyssa Rosenzweig 793d18b79b pan/bi: Enable mediump BLEND lowering
Other lowerings will wait until we iron out various missing features.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig d3ba26be37 pan/bi: Garbage collect bifrost_nir.h
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig 1049bb4374 pan/bi: Fix int<-->float size converts
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig 0f6e45f8b2 pan/bi: Enable NIR vectorization
We don't vectorize transcendentals, since those are scalar only in
hardware. Also don't vectorize a few places where impedance mismatches
between NIR and the hardware make handling vectors infeasible for now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig 646e03c451 pan/bi: Temporarily switch back to 0/~0 bools
Keeps things simpler while debugging vectorization woes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig 8db4166c58 pan/bi: Handle make_vec with 1-bit bools
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig 7793c9ab02 pan/bi: Adapt branching for 1-bit bools
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9239>
2021-05-06 23:26:21 +00:00
Alyssa Rosenzweig 1378c67bcf panfrost/blend: Inline blend constants
If we're going to key them in NIR, we might as well get the benefit of
constant folding them too.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10652>
2021-05-06 16:40:50 +00:00
Alyssa Rosenzweig a67347d496 pan/bi: Use nir_lower_to_bit_size
Last holdout of the backend algebraic pass. Delete it.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10627>
2021-05-05 02:19:04 +00:00
Alyssa Rosenzweig 2db8048aaa pan/bi: Switch to 1-bit bools
In prep for FP16.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10627>
2021-05-05 02:19:04 +00:00
Alyssa Rosenzweig 578f5d0000 pan/bi: Track scalarness of 16-bit ALU
Needed for optimal swizzle lowering.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10627>
2021-05-05 02:19:03 +00:00
Alyssa Rosenzweig 59afff8708 pan/bi: Handle b2i8/16
Missing from the algebraic rules, get it right this time.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10627>
2021-05-05 02:19:03 +00:00
Alyssa Rosenzweig 1c17a91731 pan/bi: Handle b2f ourselves
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10627>
2021-05-05 02:19:03 +00:00
Alyssa Rosenzweig 0906d75479 pan/bi: Handle ineg
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10627>
2021-05-05 02:19:03 +00:00
Alyssa Rosenzweig ab56471955 pan/bi: Handle integer min/max ourselves
total instructions in shared programs: 158197 -> 158181 (-0.01%)
instructions in affected programs: 169 -> 153 (-9.47%)
helped: 3
HURT: 0

total nops in shared programs: 116393 -> 116397 (<.01%)
nops in affected programs: 60 -> 64 (6.67%)
helped: 0
HURT: 2

total clauses in shared programs: 28628 -> 28627 (<.01%)
clauses in affected programs: 10 -> 9 (-10.00%)
helped: 1
HURT: 0

total quadwords in shared programs: 124146 -> 124140 (<.01%)
quadwords in affected programs: 127 -> 121 (-4.72%)
helped: 3

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10627>
2021-05-05 02:19:03 +00:00
Alyssa Rosenzweig 03e3e65cd4 panfrost: Assume lower_fragcolor has been called
Allows us to clean up quite a bit.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig c6bb55ffcf pan/bi: Lower 8-bit fragment input
Same reasons/technique as fragment output lowering, just need the NIR.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig 3cc6a4c5d0 pan/bi: Handle swizzles in i2i8
Otherwise they get copypropped away.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig e180374ab1 pan/bi: Add single-component 8-bit mkvec lowering
So we can implement scalar i2i8.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig ba17342a1f pan/bi: Handle different sizes of LD_TILE
v2: Fix overflow.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig f412801768 pan/bi: Track dual-src blend type
Will be needed for fp16 outputs. I am acutely aware dual-src blending is
broken on Bifrost right now anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10393>
2021-05-04 20:04:03 +00:00
Alyssa Rosenzweig b88cb49e4b pan/bi: Add and use bi_negzero helper
-0.0 is the additive identity in IEEE 754 arithmetic, not +0.0!

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig 5fe4f245a5 pan/bi: Implement vectorized int downcasts
Just MKVEC but needs the usual special handling.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig caebca4aa7 pan/bi: Improve assert for vector size errors
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig 2f4bb3d6b9 pan/bi: Fix 16-bit fsat
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig d43c0f35ff pan/bi: Implement vectorized f32_to_f16
f2f16 needs special treatment since it can access multiple 32-bit words.
Corresponds to the two-op instruction V2F32_TO_V2F16.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig 1fb681e51d pan/bi: Emit int CSEL instead of float by default
Will be needed when we use 1-bit booleans.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig cf2d575d63 pan/bi: Support 16-bit load_interpolated_input
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig 68c4a30434 pan/bi: Don't reference nir_lower_mediump_outputs
Nonexistant.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig 1cb11969be pan/bi: Add simple constant folding pass
Cleans up swizzle lowering, and will be used for other cleanup as
well (fancy texturing tends to create a lot of foldable code).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Alyssa Rosenzweig f9070f937f pan/bi: Add missing sr_count to pseudo-atomics
Fixes missing prints for these.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10392>
2021-05-03 15:10:20 +00:00
Icecream95 ab3a72cc20 pan/bi: Skip nir_opt_move/sink for blend shaders
Otherwise the dual-source input load is moved further down in the
shader, so the registers can get clobbered before then.

Fixes text not being visible in Alacritty.

Fixes: 52863f2e60 ("pan/bi: Enable all nir_opt_move/sink optimizations")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10089>
2021-04-22 23:13:27 +00:00
Michel Dänzer 2928c21eb7 Convert most remaining free-form fall-through comments to FALLTHROUGH
One exception is src/amd/addrlib/, for which -Wimplicit-fallthrough is
explicitly disabled.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10220>
2021-04-15 16:01:22 +00:00
Rhys Perry a2619b97f5 nir/lower_idiv: add options to use fp32 for 8-bit division lowering
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/10081>
2021-04-12 16:19:46 +00:00
Icecream95 51a812bb60 panfrost: Flush output after disassembling shaders
Fixes text printed to stderr appearing in the middle of disassembly
when piping stdout and stderr to the same place.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10088>
2021-04-09 23:45:26 +00:00
Alyssa Rosenzweig 266de379c2 pan/bi: Generalize f2i16, f2u16
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10065>
2021-04-06 19:35:33 +00:00
Alyssa Rosenzweig be74b84e6f pan/bi: Fill in some more conversions
The trick is that downcasts are just swizzling out what you don't want,
so things like U32_TO_F16 can be synthesized as V2U16_TO_V2F16 with
src.h00

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10065>
2021-04-06 19:35:33 +00:00
Alyssa Rosenzweig 435800e750 pan/bi: Lower swizzles
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10065>
2021-04-06 19:35:33 +00:00
Alyssa Rosenzweig e3e2c5b594 pan/bi: Optimize MKVEC.v2i16 generation
Prefer SWZ.v2i16 in cases where that's possible, it will be easier to
optimize later.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10065>
2021-04-06 19:35:33 +00:00
Alyssa Rosenzweig 11010b932b pan/bi: Lower large arrays to scratch
No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10020>
2021-04-03 19:18:55 +00:00
Alyssa Rosenzweig f5d1a8bf6f pan/bi: Split writemasks for memory stores
Will avoid a regression in the following commit, and probably fixes some
GLES3.1 stuff.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10020>
2021-04-03 19:18:55 +00:00
Alyssa Rosenzweig 52863f2e60 pan/bi: Enable all nir_opt_move/sink optimizations
total instructions in shared programs: 116716 -> 116716 (0.00%)

total nops in shared programs: 86280 -> 84996 (-1.49%)
nops in affected programs: 50485 -> 49201 (-2.54%)
Nops are helped.

total clauses in shared programs: 20993 -> 20732 (-1.24%)
clauses in affected programs: 7737 -> 7476 (-3.37%)
Clauses are helped.

total quadwords in shared programs: 91697 -> 91155 (-0.59%)
quadwords in affected programs: 52123 -> 51581 (-1.04%)
Quadwords are helped.

total spills in shared programs: 0 -> 0
total fills in shared programs: 0 -> 0

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10020>
2021-04-03 19:18:55 +00:00
Alyssa Rosenzweig 6a9936f5b5 pan/bi: Remove stale todo/assert
Was already handled, just untested.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9421>
2021-04-03 12:47:29 -04:00
Alyssa Rosenzweig 10b736f160 pan/bi: Remove TODO: RA warnings
We'll make this perfectly valid syntax for precolouring.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9421>
2021-04-03 12:47:29 -04:00