mesa.git
4 years agopan/bit: Make run more useful
Alyssa Rosenzweig [Sun, 5 Apr 2020 22:45:00 +0000 (18:45 -0400)]
pan/bit: Make run more useful

..by printing some output.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add csel tests
Alyssa Rosenzweig [Sun, 5 Apr 2020 21:48:01 +0000 (17:48 -0400)]
pan/bit: Add csel tests

..and pull out common instruction generation to reduce duplication in
tests a bit.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add CSEL to interpreter
Alyssa Rosenzweig [Wed, 1 Apr 2020 22:50:27 +0000 (18:50 -0400)]
pan/bit: Add CSEL to interpreter

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add FMA tests
Alyssa Rosenzweig [Wed, 1 Apr 2020 22:27:54 +0000 (18:27 -0400)]
pan/bit: Add FMA tests

Now that the earlier reg ctrl issue is fixed these should pass.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add 16-bit fmod tests
Alyssa Rosenzweig [Wed, 1 Apr 2020 20:45:55 +0000 (16:45 -0400)]
pan/bit: Add 16-bit fmod tests

These raise another set of issues -- indeed, not all of these tests are
passing, since it turns out I have an actual bug in the packing code. So
after all this work, test bringup has identified an actual issue :)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add verbose printing for tests
Alyssa Rosenzweig [Wed, 1 Apr 2020 20:45:09 +0000 (16:45 -0400)]
pan/bit: Add verbose printing for tests

We'd like to dump both the generated IR (so we know exactly what's being
tested) as well as the compiled program (so we know what's running for
comparison).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add helper for generating floating mod tests
Alyssa Rosenzweig [Wed, 1 Apr 2020 20:24:15 +0000 (16:24 -0400)]
pan/bit: Add helper for generating floating mod tests

We can iterate them, isn't that adorable!

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add packing test framework
Alyssa Rosenzweig [Wed, 1 Apr 2020 18:40:33 +0000 (14:40 -0400)]
pan/bit: Add packing test framework

Given an instruction, we'd like to wrap it in a clause with some I/O on
each end so we can pack it up and send it to the hardware to compare
against the simulator.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Implement floating source mods
Alyssa Rosenzweig [Wed, 1 Apr 2020 17:13:50 +0000 (13:13 -0400)]
pan/bit: Implement floating source mods

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Implement outmods
Alyssa Rosenzweig [Wed, 1 Apr 2020 17:08:00 +0000 (13:08 -0400)]
pan/bit: Implement outmods

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Add preliminary FMA/ADD/MOV implementations
Alyssa Rosenzweig [Wed, 1 Apr 2020 14:04:13 +0000 (10:04 -0400)]
pan/bit: Add preliminary FMA/ADD/MOV implementations

Missing some details about modifiers but the core structure should
look like this for 32 and 16-bit, I think. My sincerest apologies for
the macro magic, I tried to make it the least bad I could but trying to
keep down repitition.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Handle read/write
Alyssa Rosenzweig [Wed, 1 Apr 2020 13:50:38 +0000 (09:50 -0400)]
pan/bit: Handle read/write

We case the various sources and destinations to model register file
access and passthrough in particular.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bit: Stub out BIR interpreter
Alyssa Rosenzweig [Wed, 1 Apr 2020 13:41:20 +0000 (09:41 -0400)]
pan/bit: Stub out BIR interpreter

We'd like to step through a BIR program to evaluate it for testing.
Let's stub out some infrastructure for modeling Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Match CSEL argument order with hw
Alyssa Rosenzweig [Sun, 5 Apr 2020 23:22:01 +0000 (19:22 -0400)]
pan/bi: Match CSEL argument order with hw

It turns out ports need to be in order of the arguments of an
instruction (port 3, that is), which breaks on instructions whose IR
argument order is different from the packed order, like csel. So fix
that.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Add helper to debug port assignment
Alyssa Rosenzweig [Sun, 5 Apr 2020 22:06:08 +0000 (18:06 -0400)]
pan/bi: Add helper to debug port assignment

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Handle BIFROST_FIRST_WRITE_FMA_P2_READ_P3
Alyssa Rosenzweig [Wed, 1 Apr 2020 22:22:01 +0000 (18:22 -0400)]
pan/bi: Handle BIFROST_FIRST_WRITE_FMA_P2_READ_P3

It's a special case for unclear reasons, and if you mess it up you get
INSTR_INVALID_ENC. Isn't hardware fun?

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Allow BI_FMA to take mods
Alyssa Rosenzweig [Wed, 1 Apr 2020 22:13:55 +0000 (18:13 -0400)]
pan/bi: Allow BI_FMA to take mods

It doesn't take abs but it can take outmod/neg.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Don't gobble zero ports
Alyssa Rosenzweig [Wed, 1 Apr 2020 22:08:32 +0000 (18:08 -0400)]
pan/bi: Don't gobble zero ports

In case we've reading/writing R0.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Fix negation in ADD.v2f16
Alyssa Rosenzweig [Wed, 1 Apr 2020 20:51:30 +0000 (16:51 -0400)]
pan/bi: Fix negation in ADD.v2f16

When we flip the sources we need to flip the negates as well to stay
consistent.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Fix duplicated source in ADD.v2f16
Alyssa Rosenzweig [Wed, 1 Apr 2020 20:51:17 +0000 (16:51 -0400)]
pan/bi: Fix duplicated source in ADD.v2f16

Typo.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agopan/bi: Export bi_class_name
Alyssa Rosenzweig [Wed, 1 Apr 2020 20:23:12 +0000 (16:23 -0400)]
pan/bi: Export bi_class_name

For use in naming tests.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4458>

4 years agolima: avoid situations when scissor minx > maxx or miny > maxy
Vasily Khoruzhick [Fri, 3 Apr 2020 09:17:06 +0000 (02:17 -0700)]
lima: avoid situations when scissor minx > maxx or miny > maxy

Clip scissor to viewport and then to framebuffer to avoid that since
hardware can't handle this case.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4427>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4427>

4 years agoetnaviv: convert perfmon queries to acc queries
Christian Gmeiner [Tue, 23 Jul 2019 20:02:56 +0000 (22:02 +0200)]
etnaviv: convert perfmon queries to acc queries

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: move generic perfmon functionality into own file
Christian Gmeiner [Fri, 19 Jul 2019 13:27:39 +0000 (15:27 +0200)]
etnaviv: move generic perfmon functionality into own file

This change removes the basic infrastructure to work with perfmon
from the perfmon query impl and puts it into its own place.
Makes the whole series easier to review and ends smaller changes.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: extend acc sample provide with an allocate(..)
Christian Gmeiner [Wed, 31 Jul 2019 20:40:45 +0000 (22:40 +0200)]
etnaviv: extend acc sample provide with an allocate(..)

We might be able to sub-class etna_acc_query.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: extend result(..) to return if data is ready
Christian Gmeiner [Fri, 19 Jul 2019 10:57:11 +0000 (12:57 +0200)]
etnaviv: extend result(..) to return if data is ready

For the upcoming conversion of perfmon queries to the acc query
framework we need a way to tell that the data is not ready.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: make use of a fixed size array to track of all acc query provider
Christian Gmeiner [Fri, 19 Jul 2019 10:43:43 +0000 (12:43 +0200)]
etnaviv: make use of a fixed size array to track of all acc query provider

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: extend acc query provider with supports(..) function
Christian Gmeiner [Fri, 19 Jul 2019 09:45:36 +0000 (11:45 +0200)]
etnaviv: extend acc query provider with supports(..) function

Move the logic if a query provider supports a query_type
directly to the provider.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: rework wait/flush logic
Christian Gmeiner [Wed, 31 Jul 2019 10:38:53 +0000 (12:38 +0200)]
etnaviv: rework wait/flush logic

Saves us from doing an extra flush in !wait case and seems more
logical now. Also evaluate etna_bo_cpu_prep(..) retun value.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: reset no_wait_cnt after triggered flush
Christian Gmeiner [Fri, 26 Jul 2019 10:32:40 +0000 (12:32 +0200)]
etnaviv: reset no_wait_cnt after triggered flush

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: explicitly call resource_written(..)
Christian Gmeiner [Wed, 31 Jul 2019 18:10:14 +0000 (20:10 +0200)]
etnaviv: explicitly call resource_written(..)

We might end in cases where etna_acc_get_query_result(..) gets called
within one draw call (aka before flushing). At this point the status
of the resource was not set but gets used in etna_acc_get_query_result(..)
to handle different wait cases. Fix this issue by calling resource_written(..)
explicitly.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: rework etna_acc_sample_provider
Christian Gmeiner [Fri, 26 Jul 2019 08:18:44 +0000 (10:18 +0200)]
etnaviv: rework etna_acc_sample_provider

Simplify the interface a sampler provider needs to implement. The start(..)
and stop(..) functions got called by resume(..) and suspend(..) so lets
get rid of start(..) and stop(..). Also the way we count and use samples
is much easier to follow now.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoetnaviv: rename hw queries to acc queries
Christian Gmeiner [Fri, 26 Jul 2019 08:01:15 +0000 (10:01 +0200)]
etnaviv: rename hw queries to acc queries

The name hw queries was choosen as occlusion queries are 'feeling'
like nothing special. It is possible to interact with them only
via the command stream - unlike perfom queries where some kernel
magic is needed.

Accumulated HW queries is a much better name for this type of queries.
We read some hardware values over some draw calls and need to accumulate
them to get the final result.

This is some prep work for the following perfmon changes.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1530>

4 years agoglx: use anonymous namespace to avoid -Wodr issues when building with LTO enabled
Eric Engestrom [Sun, 2 Feb 2020 18:31:26 +0000 (18:31 +0000)]
glx: use anonymous namespace to avoid -Wodr issues when building with LTO enabled

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2597>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2597>

4 years agoglx: fix 630 times -Wlto-type-mismatch when building with LTO enabled
Eric Engestrom [Sun, 2 Feb 2020 18:31:36 +0000 (18:31 +0000)]
glx: fix 630 times -Wlto-type-mismatch when building with LTO enabled

The prototypes are simply copied from include/GL/gl*.h

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2597>

4 years agoRevert "spirv: Rewrite CFG construction"
Jason Ekstrand [Sat, 4 Apr 2020 14:47:00 +0000 (09:47 -0500)]
Revert "spirv: Rewrite CFG construction"

This reverts commit fa5a36dbd474fb3c755da51553c6ca18dab76a06.

4 years agoRevert "gallivm: disable rgtc/latc SNORM accellerated fetches"
Dave Airlie [Fri, 3 Apr 2020 01:09:20 +0000 (11:09 +1000)]
Revert "gallivm: disable rgtc/latc SNORM accellerated fetches"

This reverts commit 4897e70ccd3987d470ec8622d473ee3405f6e96f.

Fixed in previous commits.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4425>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4425>

4 years agogallivm/rgtc: enable fast path for snorm types.
Dave Airlie [Fri, 3 Apr 2020 04:25:51 +0000 (14:25 +1000)]
gallivm/rgtc: enable fast path for snorm types.

As per Roland's suggestions it should be easy to enable the
fast path fetch for rgtc snorm as well here.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4425>

4 years agogallivm/rgtc: fix the truncation to 8-bit
Dave Airlie [Fri, 3 Apr 2020 03:54:17 +0000 (13:54 +1000)]
gallivm/rgtc: fix the truncation to 8-bit

The 8 bit type wasn't 8-bit so when doing signed work we lost
the sign bit. This fixes it to use a proper vector type,
even if we just end up in here with the 1-wide path for now.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4425>

4 years agoglsl: don't limit fp16 lowering to frag
Rob Clark [Thu, 2 Apr 2020 21:08:54 +0000 (14:08 -0700)]
glsl: don't limit fp16 lowering to frag

This restriction doesn't belong in core code.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno: limit fp16 to frag and compute
Rob Clark [Thu, 2 Apr 2020 21:07:51 +0000 (14:07 -0700)]
freedreno: limit fp16 to frag and compute

To avoid dealing w/ some backend varying linking issues when mixing
precision vs geom/tess.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno/ir3: also precompile compute shaders for shaderdb
Rob Clark [Thu, 2 Apr 2020 19:13:38 +0000 (12:13 -0700)]
freedreno/ir3: also precompile compute shaders for shaderdb

Similar as with draw shaders, nothing will trigger the final variant in
shader-db.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno: fix missing locking
Rob Clark [Thu, 2 Apr 2020 19:12:32 +0000 (12:12 -0700)]
freedreno: fix missing locking

Fixes: d0b3ccb0607 ("freedreno: Fix detection of being in a blit for acc queries.")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno/a6xx: add some compute logging
Rob Clark [Wed, 1 Apr 2020 17:40:35 +0000 (10:40 -0700)]
freedreno/a6xx: add some compute logging

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno/ir3/cf: use ssa-uses
Rob Clark [Mon, 16 Mar 2020 22:34:08 +0000 (15:34 -0700)]
freedreno/ir3/cf: use ssa-uses

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno/ir3: add a pass to collect SSA uses
Rob Clark [Thu, 12 Mar 2020 21:18:04 +0000 (14:18 -0700)]
freedreno/ir3: add a pass to collect SSA uses

We don't really track these as the ir is transformed, but it would be a
useful thing for some passes to have.  So add a pass to collect this
information.  It uses instr->data (generic per-pass ptr), with the
hashsets hanging under a mem_ctx for easy disposal at the end of the
pass.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno/ir3/cf: skip array load/store
Rob Clark [Mon, 16 Mar 2020 21:50:32 +0000 (14:50 -0700)]
freedreno/ir3/cf: skip array load/store

Don't fold conversions into array (incl phi lowered to regs/array).
These aren't SSA.  Avoids crashes in particular in frag shaders with
flow control, which would leave a dangling array write disconnect from
the original cov src.

Possibly this could be slightly relaxed, if there is no other consumer
of the src, and it were in the same block.  But it would require
updating block->keeps, and taking care of barrier state.  Which isn't a
thing the cf pass does currently.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno/ir3: fixup cat3 32b vs 16b
Rob Clark [Mon, 16 Mar 2020 14:05:01 +0000 (07:05 -0700)]
freedreno/ir3: fixup cat3 32b vs 16b

These should be keyed on src arg type.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agofreedreno/ir3/cf: handle widening too
Rob Clark [Mon, 16 Mar 2020 13:47:05 +0000 (06:47 -0700)]
freedreno/ir3/cf: handle widening too

We can also fold f16->f32 conversions.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agonir: fix definition of imadsh_mix16 for vectors
Rob Clark [Wed, 11 Mar 2020 20:55:17 +0000 (13:55 -0700)]
nir: fix definition of imadsh_mix16 for vectors

Fixes: c27b3758fa0 ("nir/opcodes: Add new 'umul_low' and 'imadsh_mix16' opcodes")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4423>

4 years agoaco: use MUBUF to load subdword SSBO
Daniel Schürmann [Thu, 27 Feb 2020 16:52:21 +0000 (17:52 +0100)]
aco: use MUBUF to load subdword SSBO

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002>

4 years agoaco: implement 8bit/16bit store_ssbo
Daniel Schürmann [Fri, 14 Feb 2020 16:53:11 +0000 (17:53 +0100)]
aco: implement 8bit/16bit store_ssbo

Currently without alignment check, so that
we can only use the _byte and _short versions
and multi-component stores are split.

Reviewed-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/4002>

4 years agoaco: implement 8bit/16bit load_buffer
Daniel Schürmann [Fri, 14 Feb 2020 14:54:56 +0000 (15:54 +0100)]
aco: implement 8bit/16bit load_buffer

Reviewed-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/4002>

4 years agoaco: implement storagePushConstant8 & storagePushConstant16
Daniel Schürmann [Thu, 13 Feb 2020 15:51:38 +0000 (16:51 +0100)]
aco: implement storagePushConstant8 & storagePushConstant16

Reviewed-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/4002>

4 years agoaco: implement vec2/3/4 with subdword operands
Daniel Schürmann [Thu, 2 Apr 2020 16:50:46 +0000 (17:50 +0100)]
aco: implement vec2/3/4 with subdword operands

Reviewed-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/4002>

4 years agoaco: prepare helper functions for subdword handling
Daniel Schürmann [Thu, 2 Apr 2020 16:26:00 +0000 (17:26 +0100)]
aco: prepare helper functions for subdword handling

- get_alu_src()
- emit_extract_vector()
- emit_split_vector()

Reviewed-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/4002>

4 years agoaco: add byte_align_scalar() & trim_subdword_vector() helper functions
Daniel Schürmann [Wed, 1 Apr 2020 12:34:33 +0000 (13:34 +0100)]
aco: add byte_align_scalar() & trim_subdword_vector() helper functions

Reviewed-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/4002>

4 years agoaco: add missing conversion operations for small bitsizes
Daniel Schürmann [Fri, 28 Feb 2020 19:17:44 +0000 (20:17 +0100)]
aco: add missing conversion operations for small bitsizes

Reviewed-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/4002>

4 years agoaco: don't vectorize 8/16bit load/store_ssbo
Daniel Schürmann [Tue, 25 Feb 2020 10:52:08 +0000 (11:52 +0100)]
aco: don't vectorize 8/16bit load/store_ssbo

Reviewed-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/4002>

4 years agoaco: don't assume split_vector(create_vector) has the same number of elements when...
Daniel Schürmann [Thu, 27 Feb 2020 12:06:36 +0000 (13:06 +0100)]
aco: don't assume split_vector(create_vector) has the same number of elements when optimizing

Reviewed-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/4002>

4 years agoaco: don't propagate SGPRs into subdword PSEUDO instructions
Daniel Schürmann [Fri, 21 Feb 2020 16:06:32 +0000 (17:06 +0100)]
aco: don't propagate SGPRs into subdword PSEUDO instructions

Reviewed-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/4002>

4 years agoaco: lower subdword shuffles correctly.
Daniel Schürmann [Thu, 27 Feb 2020 12:07:21 +0000 (13:07 +0100)]
aco: lower subdword shuffles correctly.

Note that subdword swaps are not yet implemented

Reviewed-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/4002>

4 years agoaco: add builder function for subdword copy()
Daniel Schürmann [Thu, 27 Feb 2020 12:04:39 +0000 (13:04 +0100)]
aco: add builder function for subdword copy()

Reviewed-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/4002>

4 years agoaco: small refactoring of shuffle code lowering
Daniel Schürmann [Thu, 20 Feb 2020 10:34:40 +0000 (11:34 +0100)]
aco: small refactoring of shuffle code lowering

Uses now bytes instead of 32bit size

Reviewed-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/4002>

4 years agoaco: align subdword registers during RA when necessary
Daniel Schürmann [Wed, 25 Mar 2020 11:06:41 +0000 (12:06 +0100)]
aco: align subdword registers during RA when necessary

Reviewed-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/4002>

4 years agoaco: adapt register allocation for subdword registers
Daniel Schürmann [Tue, 25 Feb 2020 20:40:38 +0000 (21:40 +0100)]
aco: adapt register allocation for subdword registers

Reviewed-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/4002>

4 years agoaco: create helper function to collect variables from register area
Daniel Schürmann [Thu, 2 Apr 2020 18:13:03 +0000 (19:13 +0100)]
aco: create helper function to collect variables from register area

Reviewed-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/4002>

4 years agoaco: add notion of subdword registers to register allocator
Daniel Schürmann [Thu, 2 Apr 2020 17:27:50 +0000 (18:27 +0100)]
aco: add notion of subdword registers to register allocator

To not having to split the register file into single bytes,
we maintain a map with registers which contain subdword variables.

Reviewed-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/4002>

4 years agoaco: remove unnecessary reg_file.fill() operation in get_reg_create_vector()
Daniel Schürmann [Thu, 2 Apr 2020 17:07:22 +0000 (18:07 +0100)]
aco: remove unnecessary reg_file.fill() operation in get_reg_create_vector()

No pipelinedb changes

Reviewed-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/4002>

4 years agoaco: fix Temp and assignment of renamed operands during RA
Daniel Schürmann [Wed, 25 Mar 2020 11:15:54 +0000 (12:15 +0100)]
aco: fix Temp and assignment of renamed operands during RA

Reviewed-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/4002>

4 years agoaco: print subdword registers
Daniel Schürmann [Wed, 25 Mar 2020 10:32:18 +0000 (11:32 +0100)]
aco: print subdword registers

Reviewed-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/4002>

4 years agoaco: validate RA of subdword assignments
Daniel Schürmann [Wed, 25 Mar 2020 10:32:47 +0000 (11:32 +0100)]
aco: validate RA of subdword assignments

Reviewed-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/4002>

4 years agoaco: validate uninitialized operands
Daniel Schürmann [Wed, 25 Mar 2020 10:03:33 +0000 (11:03 +0100)]
aco: validate uninitialized operands

Reviewed-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/4002>

4 years agoaco: validate register alignment of subdword operands and definitions
Daniel Schürmann [Tue, 24 Mar 2020 17:24:23 +0000 (18:24 +0100)]
aco: validate register alignment of subdword operands and definitions

Reviewed-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/4002>

4 years agoaco: validate p_create_vector with subdword elements properly
Daniel Schürmann [Thu, 27 Feb 2020 12:08:45 +0000 (13:08 +0100)]
aco: validate p_create_vector with subdword elements properly

Also allows for undef operands

Reviewed-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/4002>

4 years agoaco: refactor regClass setup for subdword VGPRs
Daniel Schürmann [Wed, 19 Feb 2020 08:39:42 +0000 (09:39 +0100)]
aco: refactor regClass setup for subdword VGPRs

Reviewed-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/4002>

4 years agoaco: add emission support for register-allocated sdwa sels
Rhys Perry [Fri, 7 Feb 2020 12:08:09 +0000 (12:08 +0000)]
aco: add emission support for register-allocated sdwa sels

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002>

4 years agoaco: add sub-dword regclasses
Daniel Schürmann [Mon, 17 Feb 2020 16:34:45 +0000 (17:34 +0100)]
aco: add sub-dword regclasses

Co-authored-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/4002>

4 years agoaco: print and validate opsel
Rhys Perry [Thu, 30 Jan 2020 11:41:34 +0000 (11:41 +0000)]
aco: print and validate opsel

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002>

4 years agoaco: add SDWA_instruction
Rhys Perry [Wed, 4 Dec 2019 20:18:05 +0000 (20:18 +0000)]
aco: add SDWA_instruction

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002>

4 years agoaco: add comparison operators for PhysReg
Daniel Schürmann [Thu, 27 Feb 2020 12:05:24 +0000 (13:05 +0100)]
aco: add comparison operators for PhysReg

Reviewed-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/4002>

4 years agoaco: make PhysReg in units of bytes
Rhys Perry [Fri, 7 Feb 2020 11:55:43 +0000 (11:55 +0000)]
aco: make PhysReg in units of bytes

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002>

4 years agonir: fix unpack_64_4x16 in lower_alu_to_scalar()
Daniel Schürmann [Fri, 14 Feb 2020 09:12:03 +0000 (10:12 +0100)]
nir: fix unpack_64_4x16 in lower_alu_to_scalar()

Reviewed-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/4002>

4 years agodrm-shim: stub libdrm's use of realpath()
Lionel Landwerlin [Fri, 3 Apr 2020 12:13:43 +0000 (15:13 +0300)]
drm-shim: stub libdrm's use of realpath()

libdrm started using realpath to get the type of bus associated with a
given device. This stubs the very specific usage that prevents
drm-shim's device from being listed.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4429>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4429>

4 years agodrm-shim: return device platform as specified
Lionel Landwerlin [Mon, 10 Feb 2020 14:15:58 +0000 (16:15 +0200)]
drm-shim: return device platform as specified

v2: Embed the libdrm dependency inside the drm-shim dependency

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Eric Anholt <eric@anholt.net> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4429>

4 years agospirv: Rewrite CFG construction
Jason Ekstrand [Thu, 13 Feb 2020 05:30:58 +0000 (23:30 -0600)]
spirv: Rewrite CFG construction

This commit completely rewrites the way we extract a structured CFG from
SPIR-V.  The new approach is different in a few ways:

 1. It does a breadth-first search instead of depth-first.  This means
    that we've visited the merge node for a construct before we visit
    any of the nodes inside the construct.  This makes it easier to
    validate things like loop and switch nesting.

 2. We record more information in the CFG.  Earlier commits added a
    parent pointer to vtn_cf_node but we now record all of the merge and
    other special blocks for each CFG node.  This lets us validate
    things more precisely.

 3. It makes heavy use of merge blocks for walking the CFG.  Previously,
    we sort of used them as hints for trying to guess the CFG structure
    but things got dicey whenever a merge was missing.  We had some
    heuristics for how to handle short-circuiting if statements but it
    was a bunch of special cases.

    Now, we make them a fundamental part of walking the CFG.  When we
    encounter a control-flow construct, we add the body components of
    the construct to the BFS work list and then jump to the merge block
    if one exists to continue scanning the current CFG nesting level.
    If no merge block exists, we assume that means that control-flow
    never re-converges in a normal way and that the only way to get back
    to normality is with a direct jump such as a loop break or continue.
    This should make things far more robust when trying to deal with the
    more creative placement (or lack thereof) of merge instructions.

Reviewed-by: Alan Baker <alanbaker@google.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>

4 years agospirv: Add a parent field to vtn_cf_node
Jason Ekstrand [Wed, 12 Feb 2020 21:31:50 +0000 (15:31 -0600)]
spirv: Add a parent field to vtn_cf_node

This makes it easier to crawl up the CF tree when trying to validate the
incoming SPIR-V control-flow.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>

4 years agospirv: Make vtn_function a vtn_cf_node
Jason Ekstrand [Wed, 12 Feb 2020 21:28:46 +0000 (15:28 -0600)]
spirv: Make vtn_function a vtn_cf_node

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>

4 years agospirv: Make vtn_case a vtn_cf_node
Jason Ekstrand [Wed, 12 Feb 2020 21:19:20 +0000 (15:19 -0600)]
spirv: Make vtn_case a vtn_cf_node

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>

4 years agospirv: Add cast and loop helpers for vtn_cf_node
Jason Ekstrand [Wed, 12 Feb 2020 21:00:30 +0000 (15:00 -0600)]
spirv: Add cast and loop helpers for vtn_cf_node

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>

4 years agospirv: Add a vtn_block() helper
Jason Ekstrand [Wed, 12 Feb 2020 20:00:23 +0000 (14:00 -0600)]
spirv: Add a vtn_block() helper

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3820>

4 years agointel/nir: Enable load/store vectorization
Jason Ekstrand [Sat, 14 Dec 2019 16:44:39 +0000 (10:44 -0600)]
intel/nir: Enable load/store vectorization

This commit enables the I/O vectorization pass that was originally
written for ACO for Intel drivers.  We enable it for UBOs, SSBOs, global
memory, and SLM.  We only enable vectorization for the scalar back-end
because it vec4 makes certain alignment assumptions.

Shader-db results with iris on ICL:

    total instructions in shared programs: 16077927 -> 16068236 (-0.06%)
    instructions in affected programs: 199839 -> 190148 (-4.85%)
    helped: 324
    HURT: 0
    helped stats (abs) min: 2 max: 458 x̄: 29.91 x̃: 4
    helped stats (rel) min: 0.11% max: 38.94% x̄: 4.32% x̃: 1.64%
    95% mean confidence interval for instructions value: -37.02 -22.80
    95% mean confidence interval for instructions %-change: -5.07% -3.58%
    Instructions are helped.

    total cycles in shared programs: 336806135 -> 336151501 (-0.19%)
    cycles in affected programs: 16009735 -> 15355101 (-4.09%)
    helped: 458
    HURT: 154
    helped stats (abs) min: 1 max: 77812 x̄: 1542.50 x̃: 75
    helped stats (rel) min: <.01% max: 34.46% x̄: 5.16% x̃: 2.01%
    HURT stats (abs)   min: 1 max: 22800 x̄: 336.55 x̃: 20
    HURT stats (rel)   min: <.01% max: 17.11% x̄: 2.12% x̃: 1.00%
    95% mean confidence interval for cycles value: -1596.83 -542.49
    95% mean confidence interval for cycles %-change: -3.83% -2.82%
    Cycles are helped.

    total sends in shared programs: 814177 -> 809049 (-0.63%)
    sends in affected programs: 15422 -> 10294 (-33.25%)
    helped: 324
    HURT: 0
    helped stats (abs) min: 1 max: 256 x̄: 15.83 x̃: 2
    helped stats (rel) min: 1.33% max: 67.90% x̄: 21.21% x̃: 15.38%
    95% mean confidence interval for sends value: -19.67 -11.98
    95% mean confidence interval for sends %-change: -23.03% -19.39%
    Sends are helped.

    LOST:   7
    GAINED: 2

Most of the helped shaders were in the following titles:

 - Doom
 - Deus Ex: Mankind Divided
 - Aztec Ruins
 - Shadow of Mordor
 - DiRT Showdown
 - Tomb Raider (Rise, I think)

Five of the lost programs are SIMD16 shaders we lost from dirt showdown.
The other two are compute shaders in Aztec Ruins which switched from
SIMD8 to SIMD16.

Vulkan pipeline-db stats on ICL:

    Instructions in all programs: 296780486 -> 293493363 (-1.1%)
    Loops in all programs: 149669 -> 149669 (+0.0%)
    Cycles in all programs: 90999206722 -> 88513844563 (-2.7%)
    Spills in all programs: 1710217 -> 1730691 (+1.2%)
    Fills in all programs: 1931235 -> 1958138 (+1.4%)

By far the most help was in the Tomb Raider games.  A couple of Batman
games with DXVK were also helped.  In Shadow of the Tomb Raider:

    Instructions in all programs: 41614336 -> 39408023 (-5.3%)
    Loops in all programs: 32200 -> 32200 (+0.0%)
    Cycles in all programs: 1875498485 -> 1667034831 (-11.1%)
    Spills in all programs: 196307 -> 214945 (+9.5%)
    Fills in all programs: 282736 -> 307113 (+8.6%)

Benchmarks of real games I've done on this patch:

 - Rise of the Tomb Raider: +3%
 - Shadow of the Tomb Raider: +10%

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agonir/load_store_vectorize: Add support for nir_var_mem_global
Jason Ekstrand [Tue, 31 Mar 2020 08:22:57 +0000 (03:22 -0500)]
nir/load_store_vectorize: Add support for nir_var_mem_global

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agonir/load_store_vectorize: Use nir_iadd_imm for offsets
Jason Ekstrand [Tue, 31 Mar 2020 17:40:36 +0000 (12:40 -0500)]
nir/load_store_vectorize: Use nir_iadd_imm for offsets

This makes it capable of handling 64-bit offsets

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agonir/load_store_vectorize: Fix shared atomic info
Jason Ekstrand [Tue, 31 Mar 2020 08:19:39 +0000 (03:19 -0500)]
nir/load_store_vectorize: Fix shared atomic info

These were clearly copied and pasted from SSBOs.  The shared atomics
don't have an SSBO index so their offset is src0 and data is src1.

Fixes: ce9205c03bd20 "nir: add a load/store vectorization pass"
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agointel/nir: Lower memory access bit sizes later
Jason Ekstrand [Sat, 28 Mar 2020 04:33:27 +0000 (23:33 -0500)]
intel/nir: Lower memory access bit sizes later

We're about to do load/store vectorization right before this but we need
that to happen after we've done a round of optimization.  Otherwise,
we'll be getting unoptimized NIR in from ANV and the vectorizer won't be
able to do anything with it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agoiris: Set alignments on cbuf0 and constant reads
Jason Ekstrand [Tue, 31 Mar 2020 04:00:15 +0000 (23:00 -0500)]
iris: Set alignments on cbuf0 and constant reads

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agoanv: Improve brw_nir_lower_mem_access_bit_sizes
Jason Ekstrand [Fri, 27 Mar 2020 01:10:40 +0000 (20:10 -0500)]
anv: Improve brw_nir_lower_mem_access_bit_sizes

This commit makes us take both bit size and alignment into account so
that we can properly handle cases such as when we have a 32-bit store
to an 8-bit-aligned address.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agointel/fs: Choose memory message type based on bit size
Jason Ekstrand [Thu, 26 Mar 2020 22:06:52 +0000 (17:06 -0500)]
intel/fs: Choose memory message type based on bit size

Thanks to the NIR vectorizing pass, we're about to see alignments that
are higher than the bit size.  Previously, we could use either and we
just happened to choose alignment (probably the wrong choice) so it's
harmless to switch to detecting based on bit size.  This commit changes
things to take both into account which is more accurate to what the
messages we're using do.  We also beef up the asserts and make them more
consistent, more accurate, and more complete.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4367>

4 years agoir3: Disable copy prop for immediate ldlw offsets
Brian Ho [Fri, 3 Apr 2020 18:53:55 +0000 (11:53 -0700)]
ir3: Disable copy prop for immediate ldlw offsets

Immediate offsets are currently collapsed for ldlw, but ldlw does
behave correctly with immediate values. For example,
`ldlw.u32 r0.x, l[4], 1` actually means to use the value of
regid 4 (r1.x) as the offset when we actually want it to use the
imm value of 4 as the offset.

This commit disables copy prop for ldlw offsets so the same
intrinsic gets compiled to:
  mov.u32u32 r0.y, 0x00000004
  ldlw.u32 r0.x, l[r0.y], 1

Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4439>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4439>