Commit Graph

193 Commits

Author SHA1 Message Date
Marek Olšák 610fb0e19c st/mesa: call nir_sweep in st_finalize_nir
This is invoked sooner before (pre-)compiling the first variant and is
also applied to fixed-func and ARB programs.
2019-11-19 18:02:06 -05:00
Marek Olšák 1375217116 st/mesa: cleanups after unification of st_vertex/common program
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2019-11-19 18:02:06 -05:00
Marek Olšák 5fed208285 st/mesa: rename st_common_program to st_program
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2019-11-19 18:02:06 -05:00
Marek Olšák 2e39e8b972 st/mesa: trivially merge st_vertex_program into st_common_program
a later commit will add back st_vertex_program as a subclass of
st_common_program

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
2019-11-19 18:02:06 -05:00
Iago Toral Quiroga f512965b0b mesa/st: make sure we remove dead IO variables before handing NIR to backends
Commit "1c2bf82d24a glsl: disable lower_fragdata_array() for NIR drivers"
disabled the GLSL IR lowering that turned gl_FragData from an array into a
collection of scalar outputs under the assumption that this was already being
handled properly elsewhere, however there are some corner cases where NIR
would fail to do this, leaving gl_FragData[] as an array variable. This can
break backends that assume that all their outputs will be scalar and use the
variable definitions from the shader to do their output setup, such as the
case of V3D.

At least one corner case was found in some Portal shaders from shader-db, where
NIR would optimize out the full body of a fragment shader. In this scenario,
the empty shader would keep the original array definition of gl_FragData[],
causing the backend to assert.

We need to do this late enough for it to be effective, since doing it in
st_nir_preprocess does not fix the original problem.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2091
Fixes: 1c2bf82d ("glsl: disable lower_fragdata_array() for NIR drivers")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-11-14 10:49:00 +01:00
Marek Olšák 4b4b383f38 st/mesa: call nir_lower_flrp only once per shader
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2019-11-04 16:49:44 -05:00
Marek Olšák 7d00218aed st/mesa: call nir_opt_access only once
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
2019-11-04 16:49:42 -05:00
Timothy Arceri 0e186c18ba glsl: just use NIR to lower outputs when driver can't read outputs
This will allow us to stop lowering gl_FragData in GLSL IR for NIR
drivers which means we won't need the special GLSL IR type
handling for building the resource list in a NIR based linker.

i965 has been doing this since b828f7a27b.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-11-01 11:33:33 +11:00
Marek Olšák 92196fe74b st/mesa: use pipe_screen::finalize_nir
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-10-23 21:12:52 -04:00
Marek Olšák 28199aeee5 st/mesa: assign driver locations for VS inputs for NIR before caching
fix up edge flags in the NIR pass, because st/mesa doesn't touch the inputs
after caching

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-10-23 21:12:52 -04:00
Marek Olšák eaffdad108 st/mesa: don't lower_global_vars_to_local for VS if there are no dead inputs
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-10-23 21:12:52 -04:00
Marek Olšák 3634dca99a st/mesa: move some NIR lowering before shader caching
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-10-23 21:12:52 -04:00
Marek Olšák 48b4843c30 st/mesa: merge st_fragment_program into st_common_program
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-10-17 20:31:34 -04:00
Marek Olšák 33d53f0614 st/mesa: rename st_xxx_program::tgsi to state
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-10-17 20:31:34 -04:00
Marek Olšák dd4d791821 st/mesa: lower doubles for NIR after linking
This allows dropping 1 call to st_nir_opts, because shaders are always
optimized after linking.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-10-17 20:31:37 -04:00
Marek Olšák 7908e82f60 st/mesa: call st_nir_opts for linked shaders only once
The removed st_nir_opts calls are mostly redundant.

There is an improvement with shader-db on radeonsi:

Before:
    real	1m54.047s
    user	28m37.857s
    sys 	0m7.573s

After:
    real	1m52.012s
    user	28m3.412s
    sys 	0m7.808s

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-10-17 20:31:34 -04:00
Marek Olšák f54dcaf232 st/mesa: don't call translate_*_program functions for NIR
move the initializaton to st_link_nir

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-10-16 20:10:47 -04:00
Marek Olšák 1cc866c264 st/mesa: remove st_compute_program in favor of st_common_program
The conversion from pipe_shader_state to pipe_compute_state is done
at the end.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-10-16 20:10:47 -04:00
Marek Olšák b596bb5b66 st/mesa: use *prog at the end of st_link_nir
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-10-16 20:10:47 -04:00
Marek Olšák e4f7d2576e st/mesa: use nir_shader_compiler_options::lower_to_scalar
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-10-10 15:49:19 -04:00
Marek Olšák 3340c066a1 nir: move gl_nir_opt_access from glsl directory
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-10-10 15:49:18 -04:00
Caio Marcelo de Oliveira Filho f479878ce6 mesa/st: Fallback to name lookup when the variable have no Parameter
This brings back the fallback previously present in
st_nir_lookup_parameter_index(): if there's no parameter associated
with the variable, use a parameter from a variable with the same
prefix.

We'll have to sort out something for SPIR-V, but in the meantime let's
fix GLSL.

Fixes: b6384e57f5 ("mesa/st: Lookup parameters without using names")
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Eric Anholt <eric@anholt.net>
2019-09-12 17:53:54 +00:00
Brian Paul d714415208 st/nir: fix illegal designated initializer in st_glsl_to_nir.cpp
IIRC, designated initializers are not legal C++.
Fixes the MSVC build.

Fixes: 83fd1e58 ("glsl/nir: Add and use a gl_nir_link() function")

Reviewed-by: Neha Bhende <bhenden@vmware.com>
2019-09-11 09:38:07 -06:00
Caio Marcelo de Oliveira Filho 83fd1e58d8 glsl/nir: Add and use a gl_nir_link() function
Perform all the NIR linking steps in order.  Change iris and i965 to
use it.  Suggested by Alejandro.

v2: Add gl_nir_linker_options struct.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> [v1]
2019-09-10 14:36:46 -07:00
Caio Marcelo de Oliveira Filho 1a12b0fe36 mesa/st: Don't expect prog->nir to already exist
There's no such case, if we load prog->nir from the shader cache, we
shouldn't hit this path.

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-09-10 14:36:46 -07:00
Caio Marcelo de Oliveira Filho b4b39d9859 mesa/st: Add support for SPIR-V shaders
The SPIR-V codepath uses NIR linking, so we have to preprocess after
the linking steps, which makes things slightly different than GLSL.
To make more clear when the preprocess is happening, I've ended up
inlining st_nir_get_mesa_program() into its caller.

The goal was to make both GLSL and SPIR-V to use the same preprocess
function, the exceptions are:

- SPIR-V codepath don't support NIR state slots yet;
- GLSL lowers shared memory early, so we don't do the deref lowering
  for those.

For now I didn't bother to rename other functions and files (now that
many of them apply to both GLSL and SPIR-V), but we should do this in
further patches.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-09-10 14:36:46 -07:00
Caio Marcelo de Oliveira Filho 18e79e97e5 mesa/st: Extract preprocessing NIR steps
Refactor to split the glsl_to_nir conversion from the preprocessing
NIR passes into separate functions, so we can use them in SPIR-V.
Unlike in GLSL, there we'll need to perform a few passes with the NIR
linker before doing the individual preprocess calls.

No behavior should change with this patch.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-09-10 14:36:46 -07:00
Caio Marcelo de Oliveira Filho b6384e57f5 mesa/st: Lookup parameters without using names
Use the new MainUniformStorageIndex field in Parameter instead.  It
was added so we could match those in the SPIR-V case, where names are
optional.

v2: Use MainUniformStorageIndex for all cases.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> [v1]
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-09-10 14:36:46 -07:00
Caio Marcelo de Oliveira Filho 1a96811fe1 mesa/st: Do not rely on name to identify special uniforms
Every uniform that have the "gl_" name also have some state slots.  So
use the state_slots like we did in 57b6184931 ("i965: account for NIR
uniforms without name").

This removes the dependency on names, which are optional when using
ARB_gl_spirv.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
2019-09-10 14:36:46 -07:00
Vasily Khoruzhick 9367d2ca37 nir: allow specifying filter callback in lower_alu_to_scalar
Set of opcodes doesn't have enough flexibility in certain cases. E.g.
Utgard PP has vector conditional select operation, but condition is always
scalar. Lowering all the vector selects to scalar increases instruction
number, so we need a way to filter only those ops that can't be handled
in hardware.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2019-09-06 01:51:28 +00:00
Connor Abbott 49503ae74e st/nir: Don't lower indirects when linking
I believe this was stuck here early because otherwise
nir_opt_copy_prop_vars could undo what lower_io_to_temporaries does.
However that has since been fixed. Also, we now use scratch for large
variables so the comment is stale.

On radeonsi these are the shader-db results:

Totals:
SGPRS: 3955968 -> 3955968 (0.00 %)
VGPRS: 2220208 -> 2220220 (0.00 %)
Spilled SGPRs: 11387 -> 11387 (0.00 %)
Spilled VGPRs: 97 -> 97 (0.00 %)
Private memory VGPRs: 2528 -> 2528 (0.00 %)
Scratch size: 2656 -> 2656 (0.00 %) dwords per thread
Code Size: 76002108 -> 76002204 (0.00 %) bytes
LDS: 740 -> 740 (0.00 %) blocks
Max Waves: 772779 -> 772776 (-0.00 %)
Wait states: 0 -> 0 (0.00 %)

Totals from affected shaders:
SGPRS: 176 -> 176 (0.00 %)
VGPRS: 144 -> 156 (8.33 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 12104 -> 12200 (0.79 %) bytes
LDS: 0 -> 0 (0.00 %) blocks
Max Waves: 28 -> 25 (-10.71 %)
Wait states: 0 -> 0 (0.00 %)

The few small regressions are due to nir_opt_large_constants kicking in
when indirect lowering happens to result in smaller code after
optimization since the array is very simple.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-09-05 12:38:22 +02:00
Connor Abbott 7d2d7b5d5f st/nir: Call nir_remove_unused_variables() in the opt loop
This prevents regressions when disabling indirect lowering. Sometimes
the only use of an input array was copying it to the array created by
nir_lower_io_to_temporaries, and without lowering indirects we wouldn't
have eliminated the temporary array until after linking, which was too
late to remove unused code in the producer.

No shader-db changes with radeonsi NIR.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-09-05 12:37:28 +02:00
Connor Abbott 3eb4aeed60 st/nir: Fix num_inputs for VS inputs
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-08-23 11:05:31 +02:00
Jason Ekstrand 110669c85c st,i965: Stop looping on 64-bit lowering
Now that the 64-bit lowering passes do a complete lowering in one go, we
don't need to loop anymore.  We do, however, have to ensure that int64
lowering happens after double lowering because double lowering can
produce int64 ops.

Reviewed-by: Eric Anholt <eric@anholt.net>
2019-07-16 16:05:16 +00:00
Kenneth Graunke ce93bf1876 compiler: Save a single copy of the softfp64 shader in the context.
We were recompiling the softfp64 library of functions from GLSL to NIR
every time we compiled a shader that used fp64.  Worse, we were ralloc
stealing it to the GL context.  This meant that we'd accumulate lots of
copies for the lifetime of the context, which was a big space leak.

Instead, we can simply stash a single copy in the GL context, and use
it for subsequent compiles.  Having a single copy should be fine from
a memory context point of view: nir_inline_function_impl already clones
the necessary nir_function_impl's as it inlines.

KHR-GL45.enhanced_layouts.ssb_member_align_non_power_of_2 was previously
OOM'ing a system with 16GB of RAM when using softfp64.  Now it finishes
much more quickly and uses only ~200MB of RAM.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2019-07-10 22:14:36 -07:00
Connor Abbott fd5ed6b9d6 nir: Move st_nir_assign_var_locations() to common code
It isn't really doing anything Gallium-specific, and it's needed for
handling component packing, overlapping, etc.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-07-08 14:15:06 +02:00
Connor Abbott 6fc83c253f st/nir: Use gl_nir_opt_access
Nothing uses its results yet, that will come with the following commits.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-06-19 14:08:28 +02:00
Caio Marcelo de Oliveira Filho f03b21ae69 st/glsl: Perform some var optimizations
Perform those before some derefs are gone when we lower the buffers
after the st_nir_opts() call.

Intel SKL shader-db results:

    total instructions in shared programs: 15593685 -> 15590708 (-0.02%)
    instructions in affected programs: 378078 -> 375101 (-0.79%)
    helped: 777
    HURT: 44
    helped stats (abs) min: 1 max: 68 x̄: 4.07 x̃: 4
    helped stats (rel) min: 0.04% max: 31.58% x̄: 2.88% x̃: 1.37%
    HURT stats (abs)   min: 1 max: 24 x̄: 4.20 x̃: 2
    HURT stats (rel)   min: 0.17% max: 8.00% x̄: 1.60% x̃: 1.27%
    95% mean confidence interval for instructions value: -4.02 -3.23
    95% mean confidence interval for instructions %-change: -2.93% -2.35%
    Instructions are helped.

    total loops in shared programs: 4815 -> 4815 (0.00%)
    loops in affected programs: 0 -> 0
    helped: 0
    HURT: 0

    total cycles in shared programs: 371965528 -> 371788566 (-0.05%)
    cycles in affected programs: 184190307 -> 184013345 (-0.10%)
    helped: 3650
    HURT: 2855
    helped stats (abs) min: 1 max: 59400 x̄: 99.45 x̃: 15
    helped stats (rel) min: <.01% max: 43.18% x̄: 2.60% x̃: 1.02%
    HURT stats (abs)   min: 1 max: 16362 x̄: 65.16 x̃: 10
    HURT stats (rel)   min: <.01% max: 66.22% x̄: 2.78% x̃: 0.81%
    95% mean confidence interval for cycles value: -53.73 -0.68
    95% mean confidence interval for cycles %-change: -0.39% -0.08%
    Cycles are helped.

    total spills in shared programs: 11936 -> 11956 (0.17%)
    spills in affected programs: 443 -> 463 (4.51%)
    helped: 0
    HURT: 8

    total fills in shared programs: 25644 -> 25619 (-0.10%)
    fills in affected programs: 2306 -> 2281 (-1.08%)
    helped: 24
    HURT: 2

    LOST:   7
    GAINED: 16

    Total CPU time (seconds): 1679.04 -> 1695.69 (0.99%)

shader-db results radeonsi (VEGA64):

    Totals from affected shaders:
    SGPRS: 180160 -> 179552 (-0.34 %)
    VGPRS: 115368 -> 114544 (-0.71 %)
    Spilled SGPRs: 5627 -> 5603 (-0.43 %)
    Spilled VGPRs: 0 -> 0 (0.00 %)
    Private memory VGPRs: 0 -> 0 (0.00 %)
    Scratch size: 0 -> 0 (0.00 %) dwords per thread
    Code Size: 7808364 -> 7803268 (-0.07 %) bytes
    LDS: 192 -> 192 (0.00 %) blocks
    Max Waves: 19202 -> 19340 (0.72 %)
    Wait states: 0 -> 0 (0.00 %)

Radeonsi results provided by Timothy.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-06-11 14:53:54 -07:00
Timothy Arceri fea36a8f43 st/glsl: make sure to propagate initialisers to driver storage
This essentially reverts 20234cfe3a.

Fixes piglit test:
tests/spec/arb_get_program_binary/execution/uniform-after-restore.shader_test

Fixes: 20234cfe3a "st/mesa: don't propagate uniforms when restoring from cache"

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110784
2019-06-04 11:36:45 +10:00
Kenneth Graunke c31b4420e7 st/nir: Re-vectorize shader IO
We scalarize IO to enable further optimizations, such as propagating
constant components across shaders, eliminating dead components, and
so on.  This patch attempts to re-vectorize those operations after
the varying optimizations are done.

Intel GPUs are a scalar architecture, but IO operations work on whole
vec4's at a time, so we'd prefer to have a single IO load per vector
rather than 4 scalar IO loads.  This re-vectorization can help a lot.

Broadcom GPUs, however, really do want scalar IO.  radeonsi may want
this, or may want to leave it to LLVM.  So, we make a new flag in the
NIR compiler options struct, and key it off of that, allowing drivers
to pick.  (It's a bit awkward because we have per-stage settings, but
this is about IO between two stages...but I expect drivers to globally
prefer one way or the other.  We can adjust later if needed.)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-05-28 01:06:48 -07:00
Jonathan Marek d0bff89159 nir: allow specifying a set of opcodes in lower_alu_to_scalar
This can be used by both etnaviv and freedreno/a2xx as they are both vec4
architectures with some instructions being scalar-only.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2019-05-10 15:10:41 +00:00
Ian Romanick 1f1007a4ed nir: Initialize lower_flrp_progress everywhere
I don't know why I thought NIR_PASS always set the progress variable.
Derp.

Fixes: d41cdef2a5 ("nir: Use the flrp lowering pass instead of nir_opt_algebraic")
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Coverity CID: 1444996
Coverity CID: 1444995
Coverity CID: 1444994
Coverity CID: 1444993
Coverity CID: 1444991
Coverity CID: 1444989
2019-05-09 10:03:51 -07:00
Ian Romanick d41cdef2a5 nir: Use the flrp lowering pass instead of nir_opt_algebraic
I tried to be very careful while updating all the various drivers, but I
don't have any of that hardware for testing. :(

i965 is the only platform that sets always_precise = true, and it is
only set true for fragment shaders.  Gen4 and Gen5 both set lower_flrp32
only for vertex shaders.  For fragment shaders, nir_op_flrp is lowered
during code generation as a(1-c)+bc.  On all other platforms 64-bit
nir_op_flrp and on Gen11 32-bit nir_op_flrp are lowered using the old
nir_opt_algebraic method.

No changes on any other Intel platforms.

v2: Add panfrost changes.

Iron Lake and GM45 had similar results. (Iron Lake shown)
total cycles in shared programs: 188647754 -> 188647748 (<.01%)
cycles in affected programs: 5096 -> 5090 (-0.12%)
helped: 3
HURT: 0
helped stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2
helped stats (rel) min: 0.12% max: 0.12% x̄: 0.12% x̃: 0.12%

Reviewed-by: Matt Turner <mattst88@gmail.com>
2019-05-06 22:52:29 -07:00
Marek Olšák d3ce8a7f6b nir: optimize gl_SampleMaskIn to gl_HelperInvocation for radeonsi when possible
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-04-16 10:24:19 -04:00
Timothy Arceri d62d434fe9 ac/nir_to_llvm: add image bindless support
With this all piglit bindless image tests pass on radeonsi.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2019-04-12 09:02:59 +02:00
Eric Anholt 771adffec1 st: Lower uniforms in st in the !PIPE_CAP_PACKED_UNIFORMS case as well.
PIPE_CAP_PACKED_UNIFORMS conflates several things: Lowering uniforms i/o
at the st level instead of the backend, packing uniforms with no padding
at all, and lowering to UBOs.

Requiring backends to lower uniforms i/o for !PIPE_CAP_PACKED_UNIFORMS
leads to the driver needing to either link against the type size function
in mesa/st, or duplicating it in the backend.  Given that all backends
want this lower-io as far as I can tell, just move it to mesa/st to
resolve the link issue and avoid the driver author needing to understand
st's uniforms layout.

Incidentally, fixes uniform layout failures in nouveau in:

dEQP-GLES2.functional.shaders.struct.uniform.sampler_nested_fragment
dEQP-GLES2.functional.shaders.struct.uniform.sampler_nested_vertex
dEQP-GLES2.functional.shaders.struct.uniform.sampler_array_fragment
dEQP-GLES2.functional.shaders.struct.uniform.sampler_array_vertex

and I think in Lima as well.

v2: fix indents

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-10 11:44:20 -07:00
Timothy Arceri e30804c602 nir/radv: remove restrictions on opt_if_loop_last_continue()
When I implemented opt_if_loop_last_continue() I had restricted
this pass from moving other if-statements inside the branch opposite
the continue. At the time it was causing a bunch of spilling in
shader-db for i965.

However Samuel Pitoiset noticed that making this pass more aggressive
significantly improved the performance of Doom on RADV. Below are
the statistics he gathered.

28717 shaders in 14931 tests
Totals:
SGPRS: 1267317 -> 1267549 (0.02 %)
VGPRS: 896876 -> 895920 (-0.11 %)
Spilled SGPRs: 24701 -> 26367 (6.74 %)
Code Size: 48379452 -> 48507880 (0.27 %) bytes
Max Waves: 241159 -> 241190 (0.01 %)

Totals from affected shaders:
SGPRS: 23584 -> 23816 (0.98 %)
VGPRS: 25908 -> 24952 (-3.69 %)
Spilled SGPRs: 503 -> 2169 (331.21 %)
Code Size: 2471392 -> 2599820 (5.20 %) bytes
Max Waves: 586 -> 617 (5.29 %)

The codesize increases is related to Wolfenstein II it seems largely
due to an increase in phis rather than the existing jumps.

This gives +10% FPS with Doom on my Vega56.

Rhys Perry also benchmarked Doom on his VEGA64:

Before: 72.53 FPS
After:  80.77 FPS

v2: disable pass on non-AMD drivers

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
2019-04-09 11:29:41 +10:00
Tapani Pälli 3cea9f981a st/nir: run st_nir_opts after 64bit ops lowering
CID: 1444309
Fixes: 9ab1b1d022 "st/nir: Move 64-bit lowering later"
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2019-04-04 07:38:10 +03:00
Rob Clark 1ae0c030cb nir: add lower_all_io_to_elements
I need this part of lower_all_io_to_temps but without the actual
lowering to temps part.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2019-03-30 12:56:01 -04:00
Kenneth Graunke 1d72de3bcc st/nir: Free the GLSL IR after linking.
i965 does this, and st's tgsi path does this.  st/nir did not.

Cuts 138MB of memory from a DiRT Rally trace, which is about 44%
of the total GLSL IR memory.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2019-03-28 09:31:12 -07:00