Commit Graph

447 Commits

Author SHA1 Message Date
Alyssa Rosenzweig 5996622050 pan/bi: Calculate dependency graph when bundling
Code is ported from Midgard, modified to be scalar, post-RA, and to put
the arrays on the worklist instead of the instruction to save memory.
This enables out-of-order scheduling.

total tuples in shared programs: 128691 -> 125304 (-2.63%)
tuples in affected programs: 114091 -> 110704 (-2.97%)
helped: 844
HURT: 377
helped stats (abs) min: 1.0 max: 150.0 x̄: 4.88 x̃: 3
helped stats (rel) min: 0.30% max: 26.42% x̄: 5.56% x̃: 4.35%
HURT stats (abs)   min: 1.0 max: 8.0 x̄: 1.94 x̃: 1
HURT stats (rel)   min: 0.20% max: 33.33% x̄: 6.84% x̃: 3.23%
95% mean confidence interval for tuples value: -3.16 -2.38
95% mean confidence interval for tuples %-change: -2.19% -1.27%
Tuples are helped.

total clauses in shared programs: 27579 -> 26059 (-5.51%)
clauses in affected programs: 20606 -> 19086 (-7.38%)
helped: 941
HURT: 39
helped stats (abs) min: 1.0 max: 21.0 x̄: 1.66 x̃: 1
helped stats (rel) min: 0.69% max: 44.44% x̄: 10.48% x̃: 9.09%
HURT stats (abs)   min: 1.0 max: 2.0 x̄: 1.15 x̃: 1
HURT stats (rel)   min: 1.89% max: 10.00% x̄: 4.73% x̃: 4.55%
95% mean confidence interval for clauses value: -1.63 -1.47
95% mean confidence interval for clauses %-change: -10.27% -9.48%
Clauses are helped.

total cycles in shared programs: 12262.54 -> 12154.79 (-0.88%)
cycles in affected programs: 2210.54 -> 2102.79 (-4.87%)
helped: 374
HURT: 56
helped stats (abs) min: 0.041665999999999315 max: 6.25 x̄: 0.30 x̃: 0
helped stats (rel) min: 0.42% max: 26.00% x̄: 6.90% x̃: 7.14%
HURT stats (abs)   min: 0.041665999999999315 max: 0.5833319999999986 x̄: 0.11 x̃: 0
HURT stats (rel)   min: 0.16% max: 100.00% x̄: 55.17% x̃: 50.00%
95% mean confidence interval for cycles value: -0.29 -0.21
95% mean confidence interval for cycles %-change: -1.37% 3.73%
Inconclusive result (%-change mean confidence interval includes 0).

total arith in shared programs: 4852.29 -> 4658.13 (-4.00%)
arith in affected programs: 4525.17 -> 4331 (-4.29%)
helped: 1112
HURT: 166
helped stats (abs) min: 0.041665999999999315 max: 6.25 x̄: 0.19 x̃: 0
helped stats (rel) min: 0.42% max: 33.33% x̄: 6.59% x̃: 5.36%
HURT stats (abs)   min: 0.041665999999999315 max: 0.5833319999999986 x̄: 0.07 x̃: 0
HURT stats (rel)   min: 0.16% max: 100.00% x̄: 25.05% x̃: 2.40%
95% mean confidence interval for arith value: -0.17 -0.14
95% mean confidence interval for arith %-change: -3.44% -1.51%
Arith are helped.

total quadwords in shared programs: 117141 -> 111394 (-4.91%)
quadwords in affected programs: 104390 -> 98643 (-5.51%)
helped: 1245
HURT: 76
helped stats (abs) min: 1.0 max: 69.0 x̄: 4.74 x̃: 4
helped stats (rel) min: 0.28% max: 35.00% x̄: 7.88% x̃: 6.45%
HURT stats (abs)   min: 1.0 max: 8.0 x̄: 2.01 x̃: 1
HURT stats (rel)   min: 0.20% max: 10.00% x̄: 3.52% x̃: 4.25%
95% mean confidence interval for quadwords value: -4.61 -4.09
95% mean confidence interval for quadwords %-change: -7.56% -6.88%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10961>
2021-07-12 23:29:12 +00:00
Alyssa Rosenzweig 6bf8e960fa pan/bi: Do helper termination analysis on clauses
Unlike the dependency analysis for the skip bits which is a function of
the data flow graph, the thread termination analysis is dependent on the
actual sequence of instructions. As such, it must be done after
scheduling to be correct in the presence of out-of-order scheduling.

Furthermore it's specified in terms of clauses, not instructions.
Reflecting this in our code gets a nice simplification. As a side effect
this puts extra td flags on subsequent clauses, which matches the DDK's
behaviour. (Maybe td is just a hint?)

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10961>
2021-07-12 23:29:12 +00:00
Alyssa Rosenzweig 499397700c pan/bi: Don't lower fpow
We can fuse the intermediate multiply with the FMA_RSCALE in the
exponent code and save an instruction. Whether this is better than
adding a NIR op remains to be seen.

total instructions in shared programs: 146614 -> 146190 (-0.29%)
instructions in affected programs: 40724 -> 40300 (-1.04%)
helped: 157
HURT: 0
helped stats (abs) min: 1.0 max: 9.0 x̄: 2.70 x̃: 2
helped stats (rel) min: 0.22% max: 10.34% x̄: 1.37% x̃: 1.20%
95% mean confidence interval for instructions value: -3.00 -2.40
95% mean confidence interval for instructions %-change: -1.58% -1.15%
Instructions are helped.

total tuples in shared programs: 128116 -> 127696 (-0.33%)
tuples in affected programs: 33421 -> 33001 (-1.26%)
helped: 150
HURT: 0
helped stats (abs) min: 1.0 max: 16.0 x̄: 2.80 x̃: 2
helped stats (rel) min: 0.28% max: 4.37% x̄: 1.36% x̃: 1.07%
95% mean confidence interval for tuples value: -3.24 -2.36
95% mean confidence interval for tuples %-change: -1.50% -1.21%
Tuples are helped.

total clauses in shared programs: 27531 -> 27483 (-0.17%)
clauses in affected programs: 719 -> 671 (-6.68%)
helped: 20
HURT: 0
helped stats (abs) min: 1.0 max: 8.0 x̄: 2.40 x̃: 1
helped stats (rel) min: 1.61% max: 12.90% x̄: 6.96% x̃: 5.33%
95% mean confidence interval for clauses value: -3.48 -1.32
95% mean confidence interval for clauses %-change: -9.10% -4.82%
Clauses are helped.

total cycles in shared programs: 12250.81 -> 12233.69 (-0.14%)
cycles in affected programs: 1251.50 -> 1234.38 (-1.37%)
helped: 141
HURT: 0
helped stats (abs) min: 0.041665999999999315 max: 0.6666670000000003 x̄: 0.12 x̃: 0
helped stats (rel) min: 0.29% max: 5.00% x̄: 1.48% x̃: 1.20%
95% mean confidence interval for cycles value: -0.14 -0.10
95% mean confidence interval for cycles %-change: -1.63% -1.32%
Cycles are helped.

total arith in shared programs: 4840.25 -> 4822.71 (-0.36%)
arith in affected programs: 1324.08 -> 1306.54 (-1.32%)
helped: 151
HURT: 0
helped stats (abs) min: 0.041665999999999315 max: 0.6666670000000003 x̄: 0.12 x̃: 0
helped stats (rel) min: 0.29% max: 5.00% x̄: 1.43% x̃: 1.13%
95% mean confidence interval for arith value: -0.13 -0.10
95% mean confidence interval for arith %-change: -1.59% -1.28%
Arith are helped.

total texture in shared programs: 1666.50 -> 1666.50 (0.00%)
texture in affected programs: 0 -> 0
helped: 0
HURT: 0

total vary in shared programs: 639.06 -> 639.06 (0.00%)
vary in affected programs: 0 -> 0
helped: 0
HURT: 0

total ldst in shared programs: 9682 -> 9682 (0.00%)
ldst in affected programs: 0 -> 0
helped: 0
HURT: 0

total quadwords in shared programs: 116758 -> 116378 (-0.33%)
quadwords in affected programs: 28054 -> 27674 (-1.35%)
helped: 148
HURT: 2
helped stats (abs) min: 1.0 max: 16.0 x̄: 2.58 x̃: 2
helped stats (rel) min: 0.29% max: 5.13% x̄: 1.54% x̃: 1.23%
HURT stats (abs)   min: 1.0 max: 1.0 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.67% max: 0.85% x̄: 0.76% x̃: 0.76%
95% mean confidence interval for quadwords value: -2.94 -2.12
95% mean confidence interval for quadwords %-change: -1.69% -1.33%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig 91f130fa1e pan/bi: Factor out exp2/log2 code
Will be reused for fpow.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig 0991e9592d pan/bi: Comment the fexp2 implementation
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig 297ac6e453 pan/bi: Simplify cube map descriptor generation
We don't need to do the bitwise manipulation ourselves, we can just use
a bitwise MUX instead.

total instructions in shared programs: 146840 -> 146614 (-0.15%)
instructions in affected programs: 15037 -> 14811 (-1.50%)
helped: 109
HURT: 0
helped stats (abs) min: 2.0 max: 4.0 x̄: 2.07 x̃: 2
helped stats (rel) min: 0.86% max: 4.00% x̄: 1.70% x̃: 1.77%
95% mean confidence interval for instructions value: -2.15 -2.00
95% mean confidence interval for instructions %-change: -1.81% -1.59%
Instructions are helped.

total tuples in shared programs: 128149 -> 128116 (-0.03%)
tuples in affected programs: 2896 -> 2863 (-1.14%)
helped: 16
HURT: 0
helped stats (abs) min: 1.0 max: 5.0 x̄: 2.06 x̃: 1
helped stats (rel) min: 0.65% max: 2.33% x̄: 1.16% x̃: 0.70%
95% mean confidence interval for tuples value: -3.01 -1.12
95% mean confidence interval for tuples %-change: -1.50% -0.83%
Tuples are helped.

total cycles in shared programs: 12257.10 -> 12250.81 (-0.05%)
cycles in affected programs: 449.87 -> 443.58 (-1.40%)
helped: 92
HURT: 0
helped stats (abs) min: 0.0416660000000002 max: 0.20833400000000069 x̄: 0.07 x̃: 0
helped stats (rel) min: 0.93% max: 2.53% x̄: 1.40% x̃: 1.26%
95% mean confidence interval for cycles value: -0.08 -0.06
95% mean confidence interval for cycles %-change: -1.48% -1.32%
Cycles are helped.

total arith in shared programs: 4847.33 -> 4840.25 (-0.15%)
arith in affected programs: 490.37 -> 483.29 (-1.44%)
helped: 109
HURT: 0
helped stats (abs) min: 0.0416660000000002 max: 0.20833400000000069 x̄: 0.06 x̃: 0
helped stats (rel) min: 0.93% max: 5.56% x̄: 1.51% x̃: 1.26%
95% mean confidence interval for arith value: -0.07 -0.06
95% mean confidence interval for arith %-change: -1.64% -1.39%
Arith are helped.

total quadwords in shared programs: 116775 -> 116758 (-0.01%)
quadwords in affected programs: 1331 -> 1314 (-1.28%)
helped: 7
HURT: 0
helped stats (abs) min: 1.0 max: 4.0 x̄: 2.43 x̃: 3
helped stats (rel) min: 0.91% max: 2.38% x̄: 1.65% x̃: 1.39%
95% mean confidence interval for quadwords value: -3.48 -1.38
95% mean confidence interval for quadwords %-change: -2.27% -1.04%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig 99b2dddebf pan/bi: Add a constant subexpression elimination pass
ALU only. Intended to clean up the lowerings used with complex
texturings. Ex: if a shader reads two cube maps at the same coordinates,
this deduplicates the cube map transformation.

This needs to happen in the backend since we do the cube map
transformation with the backend builder, rather than special NIR ops.
This is a tradeoff.

Pass based on ir3's, which in turn is inspired by NIR's.

total instructions in shared programs: 148799 -> 147348 (-0.98%)
instructions in affected programs: 20509 -> 19058 (-7.07%)
helped: 145
HURT: 0
helped stats (abs) min: 4.0 max: 30.0 x̄: 10.01 x̃: 8
helped stats (rel) min: 1.92% max: 54.55% x̄: 10.87% x̃: 7.41%
95% mean confidence interval for instructions value: -10.73 -9.28
95% mean confidence interval for instructions %-change: -12.81% -8.94%
Instructions are helped.

total tuples in shared programs: 129992 -> 128908 (-0.83%)
tuples in affected programs: 17624 -> 16540 (-6.15%)
helped: 145
HURT: 0
helped stats (abs) min: 2.0 max: 25.0 x̄: 7.48 x̃: 7
helped stats (rel) min: 0.74% max: 42.86% x̄: 9.16% x̃: 7.22%
95% mean confidence interval for tuples value: -7.96 -6.99
95% mean confidence interval for tuples %-change: -10.52% -7.79%
Tuples are helped.

total clauses in shared programs: 27632 -> 27582 (-0.18%)
clauses in affected programs: 1077 -> 1027 (-4.64%)
helped: 44
HURT: 0
helped stats (abs) min: 1.0 max: 3.0 x̄: 1.14 x̃: 1
helped stats (rel) min: 2.50% max: 16.67% x̄: 4.99% x̃: 4.45%
95% mean confidence interval for clauses value: -1.26 -1.01
95% mean confidence interval for clauses %-change: -5.70% -4.27%
Clauses are helped.

total cycles in shared programs: 12323 -> 12285.63 (-0.30%)
cycles in affected programs: 618.25 -> 580.88 (-6.05%)
helped: 120
HURT: 0
helped stats (abs) min: 0.08333299999999966 max: 0.5416680000000014 x̄: 0.31 x̃: 0
helped stats (rel) min: 0.77% max: 66.67% x̄: 7.60% x̃: 7.37%
95% mean confidence interval for cycles value: -0.33 -0.29
95% mean confidence interval for cycles %-change: -8.73% -6.47%
Cycles are helped.

total arith in shared programs: 4916.75 -> 4866.88 (-1.01%)
arith in affected programs: 677.79 -> 627.92 (-7.36%)
helped: 145
HURT: 0
helped stats (abs) min: 0.08333299999999966 max: 1.0833329999999997 x̄: 0.34 x̃: 0
helped stats (rel) min: 0.77% max: 66.67% x̄: 12.81% x̃: 7.87%
95% mean confidence interval for arith value: -0.37 -0.32
95% mean confidence interval for arith %-change: -15.33% -10.29%
Arith are helped.

total quadwords in shared programs: 118117 -> 117262 (-0.72%)
quadwords in affected programs: 15283 -> 14428 (-5.59%)
helped: 143
HURT: 0
helped stats (abs) min: 1.0 max: 23.0 x̄: 5.98 x̃: 5
helped stats (rel) min: 0.44% max: 25.71% x̄: 7.56% x̃: 5.56%
95% mean confidence interval for quadwords value: -6.46 -5.50
95% mean confidence interval for quadwords %-change: -8.59% -6.53%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig 3fef3b6afc pan/bi: Analyze helper invocations
Set the .skip bit on texture instructions and the terminate discarded
threads bit on the clause header based on data flow analysis of helper
invocations. This code is adapted from Midgard, which requires the same
analysis with a few details changed.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig 134c74e301 pan/bi: Track LOD mode even for TEXC
Redundant with the texture operation descriptor, but we don't want to
parse that in the rest of the compiler. Handling it as a pseudo-modifier
lets us share a code path with TEXS.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig b7ca125278 pan/bi: Report cycle counts
Based on analysis of results from the Mali Offline Compiler. I am
uncertain how well these translate to real life, and they are
normalized counts only...

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Alyssa Rosenzweig 113157dafe pan/bi: Try to hit full occupancy on v7
Bifrost v7 trades off register pressure and occupancy. If we restrict to
[R0, R15] U [R48, R63], we get full occupancy, but if we use the full
register file, we only get half occupancy. Try to allocate just 32
registers, and only use the full 64 registers if that would spill.

Clever heuristics could make this both more effective (live range
splitting, shuffling, spilling if deemed acceptable) and cheaper at
compile-time (tracking maximum liveness to determine if it's possible to
hit at all). For now, this should suffice.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
2021-07-09 23:15:28 +00:00
Icecream95 c246af0dd8 panfrost: Only upload UBOs when needed
If all of the used values from a UBO are pushed, it doesn't need to be
uploaded.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11700>
2021-07-03 13:23:29 +00:00
Jason Ekstrand 0afbfee8da nir,panfrost: Suffix fsat_signed and fclamp_pos with _mali
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11463>
2021-06-21 09:03:34 -05:00
Alyssa Rosenzweig 295e65bb50 pan/bi: Add back custom algebraic opts
Right now just do a trivial one to test the infrastructure. In the next
commit we'll use this for a more interesting optimization that's a bit
painful in BIR but trivial with nir_search.

total instructions in shared programs: 149566 -> 149562 (<.01%)
instructions in affected programs: 502 -> 498 (-0.80%)
helped: 3
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.33 x̃: 1
helped stats (rel) min: 0.38% max: 1.30% x̄: 0.97% x̃: 1.21%

total tuples in shared programs: 130957 -> 130487 (-0.36%)
tuples in affected programs: 54752 -> 54282 (-0.86%)
helped: 303
HURT: 2
helped stats (abs) min: 1 max: 29 x̄: 1.56 x̃: 1
helped stats (rel) min: 0.13% max: 7.14% x̄: 1.08% x̃: 0.92%
HURT stats (abs)   min: 1 max: 2 x̄: 1.50 x̃: 1
HURT stats (rel)   min: 1.89% max: 2.99% x̄: 2.44% x̃: 2.44%
95% mean confidence interval for tuples value: -1.79 -1.30
95% mean confidence interval for tuples %-change: -1.17% -0.95%
Tuples are helped.

total clauses in shared programs: 27877 -> 27827 (-0.18%)
clauses in affected programs: 1556 -> 1506 (-3.21%)
helped: 45
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.11 x̃: 1
helped stats (rel) min: 1.43% max: 9.52% x̄: 3.88% x̃: 3.57%
95% mean confidence interval for clauses value: -1.21 -1.02
95% mean confidence interval for clauses %-change: -4.38% -3.39%
Clauses are helped.

total quadwords in shared programs: 119058 -> 118563 (-0.42%)
quadwords in affected programs: 33777 -> 33282 (-1.47%)
helped: 250
HURT: 2
helped stats (abs) min: 1 max: 29 x̄: 1.99 x̃: 1
helped stats (rel) min: 0.23% max: 11.11% x̄: 1.67% x̃: 1.40%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 1.64% max: 2.00% x̄: 1.82% x̃: 1.82%
95% mean confidence interval for quadwords value: -2.27 -1.66
95% mean confidence interval for quadwords %-change: -1.80% -1.49%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig 41070fedca pan/bi: Propagate fabs/neg/sat
Initial support for modifier propagation. Bifrost makes this
unreasonably hard.

total instructions in shared programs: 151604 -> 150761 (-0.56%)
instructions in affected programs: 48773 -> 47930 (-1.73%)
helped: 212
HURT: 0
helped stats (abs) min: 1 max: 28 x̄: 3.98 x̃: 1
helped stats (rel) min: 0.29% max: 12.70% x̄: 1.75% x̃: 1.26%
95% mean confidence interval for instructions value: -4.71 -3.25
95% mean confidence interval for instructions %-change: -1.97% -1.53%
Instructions are helped.

total tuples in shared programs: 131876 -> 131560 (-0.24%)
tuples in affected programs: 25393 -> 25077 (-1.24%)
helped: 104
HURT: 3
helped stats (abs) min: 1 max: 28 x̄: 3.08 x̃: 2
helped stats (rel) min: 0.34% max: 8.57% x̄: 1.55% x̃: 1.04%
HURT stats (abs)   min: 1 max: 2 x̄: 1.33 x̃: 1
HURT stats (rel)   min: 0.51% max: 2.86% x̄: 1.30% x̃: 0.53%
95% mean confidence interval for tuples value: -3.63 -2.28
95% mean confidence interval for tuples %-change: -1.73% -1.21%
Tuples are helped.

total clauses in shared programs: 28122 -> 28032 (-0.32%)
clauses in affected programs: 2720 -> 2630 (-3.31%)
helped: 58
HURT: 1
helped stats (abs) min: 1 max: 6 x̄: 1.57 x̃: 1
helped stats (rel) min: 0.88% max: 14.29% x̄: 4.06% x̃: 3.67%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 7.69% max: 7.69% x̄: 7.69% x̃: 7.69%
95% mean confidence interval for clauses value: -1.85 -1.20
95% mean confidence interval for clauses %-change: -4.60% -3.13%
Clauses are helped.

total quadwords in shared programs: 119778 -> 119509 (-0.22%)
quadwords in affected programs: 20698 -> 20429 (-1.30%)
helped: 95
HURT: 1
helped stats (abs) min: 1 max: 28 x̄: 2.85 x̃: 2
helped stats (rel) min: 0.38% max: 7.14% x̄: 1.50% x̃: 1.13%
HURT stats (abs)   min: 2 max: 2 x̄: 2.00 x̃: 2
HURT stats (rel)   min: 3.23% max: 3.23% x̄: 3.23% x̃: 3.23%
95% mean confidence interval for quadwords value: -3.49 -2.11
95% mean confidence interval for quadwords %-change: -1.71% -1.20%
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig e41d8ed007 pan/bi: Report tuples, not nops, in shader-db
More useful in practice, I find.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig ecd9a3fed5 pan/bi: Handle fsat_signed and fclamp_pos
Translates to Mali-specific clamps.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
2021-06-15 20:27:22 +00:00
Alyssa Rosenzweig a5ec1e7f75 pan/bi: Force u32 for flat varyings
Since the GLSL compilers will pack together flat varyings with no regard
to type, under the assumption the backend can deal with it. I guess we
can deal with it then... Fixes fails in
dEQP-GLES31.functional.separate_shader.random.*

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig 6dbaae77d9 pan/bi: Emit a dummy ATEST if needed
Match what the blob does, since Bifrost has so many random errata we'd
be fools not to.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig b947ab8b10 pan/bi: Lower 64-bit ints again
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig 95458c4033 pan/bi: Lower stores with component != 0
If the shader packs multiple varyings into the same location with
different location_frac, we'll need to lower to a single varying store
that collects all of the channels together. This is not trivial during
code gen, but it is trivial to do in NIR right before codegen by relying
on nir_lower_io_to_temporaries. Since we're guaranteed all varyings will
be written exactly once, in the exit block, we can scan the shader
linearly and collect stores together in a single pass.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig de42707101 pan/bi: Lower loads with component > 0
We have no native way to swizzle out a nonzero component in a load, but
we can simply load extra components and do the swizzle in shader
instructions. This is inefficient, since it loads data to discard
immediately, but it's required for conformance in some edge cases.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig 5c0e5d4d2d pan/bi: Handle images in vertex shaders
We need to offset by the number of attributes, since the primary
attribute table is shared for images and vertex attributes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig 35c7fefc8f pan/bi: Allow move/sink in blend shaders
Now that we handle precolouring we don't need to workaround anything.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig 20809daa9a pan/bi: Add post-RA optimizer
Delete coalesced moves. Now this is trivial! See e.g shaders/tesseract/118.shader_test

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig 4ed000cf3f pan/bi: Bundle after RA
Flag day change to swap the order of the "scheduler" with the register
allocator. This gives RA much more freedom without significantly
hndering bundling.

It also opens up the door to Adult-level Scheduling which would occur
prior to bundling.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:10 +00:00
Alyssa Rosenzweig 246beb15cf pan/bi: Simplify TEXC codegen for sr_count=0
Obscure case.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:09 +00:00
Alyssa Rosenzweig de8fe8c0b1 pan/bi: Use TEXS_2D for rect textures
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
2021-06-10 18:06:09 +00:00
Caio Marcelo de Oliveira Filho c8a7bd0dc8 nir: Rename WORK_GROUP (and similar) to WORKGROUP
Be consistent with other usages in Vulkan and SPIR-V, and the recently
added workgroup_size field.

Acked-by: Emma Anholt <emma@anholt.net>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190>
2021-06-07 22:34:42 +00:00
Caio Marcelo de Oliveira Filho a71a780598 nir: Rename nir_intrinsic_load_local_group_size to nir_intrinsic_load_workgroup_size
Acked-by: Emma Anholt <emma@anholt.net>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190>
2021-06-07 22:34:42 +00:00
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