Commit Graph

569 Commits

Author SHA1 Message Date
Alyssa Rosenzweig 6a9936f5b5 pan/bi: Remove stale todo/assert
Was already handled, just untested.

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

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9421>
2021-04-03 12:47:29 -04:00
Alyssa Rosenzweig 93cdb072a8 pan/bi: Only run DCE once
No more progress loop needed. I'm skeptical we really want a dataflow
approach long-term, though, this is annoyingly expensive.

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9421>
2021-04-03 12:47:29 -04:00
Alyssa Rosenzweig b7a339bc97 pan/bi: Only run copyprop once
We need to update `replacement` with the results of copyprop earlier
within the pass, but after that there's no point running more than once
if we're not going to materialize any new moves.

No shader-db changes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9421>
2021-04-03 12:47:29 -04:00
Alyssa Rosenzweig 69666723f8 pan/bi: Handle 16-bit blend sr_count
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9421>
2021-04-03 12:47:29 -04:00
Timur Kristóf 1d571c6bc1 pan/bi: Use correct enum type for NIR intrinsics.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9632>
2021-03-16 21:46:52 +00:00
Boris Brezillon 3559efb9bf panfrost: Allow passing an explicit UBO index for the sysval UBO
UBO index assignment is a bit special in Vulkan, it's based on the
descriptor set layout, which doesn't know about shaders' internal UBOs
(our sysval UBOs). Extend the backend compilers so we can place sysval
UBOs where we want: after all explicit UBOs.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9517>
2021-03-11 15:10:58 +00:00
Alyssa Rosenzweig 5487847d8c pan/bi: Implement u{add, sub}_sat
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9520>
2021-03-11 14:30:19 +00:00
Boris Brezillon 3c7634f7d2 pan/bi: Extend the bi_builder to support type variants correctly
Some opcodes come with both type and size variants. Right now, only the
size is taken into account. Extend the builder to provide wrappers that
take a nir_type in addition to the bitsize.

While at it, fix wrappers taking a compare operator to use the proper
.{i,s,u} variant based on the comparison (equal and non-equal should
use .i, other comparisons should use .{u,s}).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9520>
2021-03-11 14:30:19 +00:00
Boris Brezillon 691c47dd6c pan/bi: Move int64 lowering before idiv lowering
Otherwise all 64 divisions will be skipped.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9520>
2021-03-11 14:30:19 +00:00
Boris Brezillon f7bbfbaeb5 Revert "pan/bi: Optimize out redundant jumps to #0x0"
A block that has all its successors empty is not necessarily a leaf
block in the CFG, and removing the JUMP in that causes the shader
to continue executing code from another block instead of exiting.

This reverts commit a496b41d50.

Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9520>
2021-03-11 14:30:19 +00:00
Alyssa Rosenzweig 718bfdb3da pan/bi: Implement fsin/fcos
Instead of lowering it in NIR, use the lookup tables as inputs to a
second-order Taylor expansion. shader-db results aren't amazing but keep
in mind this is without backend CSE yet.

total instructions in shared programs: 115913 -> 115707 (-0.18%)
instructions in affected programs: 3151 -> 2945 (-6.54%)
helped: 12
HURT: 0
Instructions are helped.

total nops in shared programs: 84045 -> 84041 (<.01%)
nops in affected programs: 1571 -> 1567 (-0.25%)
helped: 1
HURT: 7
Inconclusive result (value mean confidence interval includes 0).

total clauses in shared programs: 20498 -> 20489 (-0.04%)
clauses in affected programs: 188 -> 179 (-4.79%)
helped: 6
HURT: 0
Clauses are helped.

total quadwords in shared programs: 90395 -> 90291 (-0.12%)
quadwords in affected programs: 2287 -> 2183 (-4.55%)
helped: 12
HURT: 0
Quadwords are helped.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9420>
2021-03-05 15:15:10 +00:00
Alyssa Rosenzweig 4f71801aa2 pan/bi: Adapt builder to dest count
If there are no destinations, don't produce a _to version, and let the
bare version return the bi_instr.

If there are multiple destinations, take each in the _to version and
don't produce a bare version.

Both cares are probably what you wanted anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>
2021-02-22 19:17:50 +00:00
Alyssa Rosenzweig 9882a59a2f pan/bi: Reduce liveness calculations in DCE
Forward port of fc06b8b7 ("pan/mdg: Optimize liveness computation in
DCE")

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>
2021-02-22 19:17:50 +00:00
Alyssa Rosenzweig 3a4d985997 pan/bi: Use nir_opt_sink/move for constants
Fixes excessive (and failing) spilling in dEQP-GLES31.functional.ssbo.layout.*

shader-db results are a toss up (I suspect we'd see better results if we
tracked register pressure directly):

total instructions in shared programs: 161377 -> 161377 (0.00%)

total nops in shared programs: 121159 -> 121203 (0.04%)
nops in affected programs: 1839 -> 1883 (2.39%)
Nops are HURT.

total clauses in shared programs: 31604 -> 31606 (<.01%)
clauses in affected programs: 38 -> 40 (5.26%)
Inconclusive result (value mean confidence interval includes 0).

total quadwords in shared programs: 130847 -> 130845 (<.01%)
quadwords in affected programs: 1246 -> 1244 (-0.16%)
Inconclusive result (value mean confidence interval includes 0).

total loops in shared programs: 18 -> 18 (0.00%)
total spills in shared programs: 705 -> 705 (0.00%)
total fills in shared programs: 1645 -> 1645 (0.00%)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9164>
2021-02-22 19:17:50 +00:00
Alyssa Rosenzweig 04be7934df pan/bi: Fix elimination of repeated branches
How many times can I break such a small pass?

Fixes: a805d999c0 ("pan/bi: Fix jumps to terminal block again")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9137>
2021-02-22 17:12:55 +00:00
Alyssa Rosenzweig a496b41d50 pan/bi: Optimize out redundant jumps to #0x0
If it's the last instruction, that's silly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9137>
2021-02-22 17:12:55 +00:00
Alyssa Rosenzweig 46384d0dcc pan/bi: Fix more jumps to terminal blocks
Here's another edge case: there could be instructions in the last block
after NIR->BIR but they could be optimized out by backend DCE, causing
the block to become a terminal block.

Noticed while toying with geometry shaders.

Fixes: a805d999c0 ("pan/bi: Fix jumps to terminal block again")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9137>
2021-02-22 17:12:55 +00:00
Alyssa Rosenzweig ed29a2beb8 pan/bi: Use explicit move even for RT#0 of MRT
Otherwise we get a bad RA if RT 0 = RT 3 (for example), fixes
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.const_literal.fragment.sampler2d

Fixes: a6f1500bed ("pan/bi: Workaround BLEND precolour with explicit moves")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 02d68b9b83 pan/bi: Allow dynamically uniform tex indices
Passes the relevant tests of
dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.*, a few
failures that seem to relate to MRT instead of this.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig dfe309e707 pan/bi: Implement interpolateAtOffset
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig e4ae458df8 pan/bi: Implement interpolateAtSample
Passes dEQP-GLES31.functional.shaders.multisample_interpolation.interpolate_at_sample.*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 7f2d618867 pan/bi: Flesh out LD_TILE emit
Needs to support non-blend shader operation (conversion descriptor
sourced from a sysval), as well as MRT. Fixes fbfetch on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig cff5c40fc3 pan/bi: Fix blend shaders using LD_TILE with MRT
Don't hardcode the RT to 0. Affects ES3.0 which already exposes MRT --
despite no dEQP coverage of this particular corner case, apps could hit
this in the wild on 21.0. Fixes

dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_blend_func_buffer_blend_func

Fixes: c7e1ef7c0c ("panfrost: Advertise ES3.0 on Bifrost")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 9151329fd2 pan/bi: Implement shader_clock intrinsic
Trivial.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 8081811f2e pan/bi: Implement image_atomic_comp_swap
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 078a84f474 pan/bi: Implement image_atomic_exchange
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Icecream95 afe4f0e6b1 pan/bi: nir_intrinsic_image_size support
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Icecream95 075d9a1084 pan/bi: Implement image load/store
v2 (Alyssa): Split out functions, support 3D/array

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Icecream95 71f849a292 pan/bi: Remove check for first_ubo_is_default_ubo
It won't be set for OpenCL.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig cd21f0e1c5 pan/bi: Handle computational atomics
All the same formula: calculate an address, emit a pseudoinstruction for
the atomic, emit a postprocess that can be DCE'd if not needed.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 8358321801 pan/bi: Add ATOM_C1 promotion check
Optimizes atomic counters.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig b9d277f644 pan/bi: Extract bi_atom_opc from NIR intrinsic
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 111255512a pan/bi: Don't read alpha out of bounds
RT#0 may not have alpha, do something safe instead of risking issues
with RA later.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:22 +00:00
Alyssa Rosenzweig 9dd9e0200d pan/bi: Implement barriers
Only control barriers are meaningful upon a closer read.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:21 +00:00
Alyssa Rosenzweig 60bee70103 pan/bi: Stub scoreboarding
This is not a real implementation. But I'm working on barriers right
now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9105>
2021-02-18 21:48:21 +00:00
Icecream95 9bb376bbdb pan/bi: Use the correct size for UBO loads
Multiply by the destination bit size to get the number of bits to
load instead of assuming 32 bits.

Fixes: 2e57684d2d ("pan/bi: Implement load_ubo with the builder")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9071>
2021-02-16 13:14:30 +00:00
Boris Brezillon d5b1a33460 panfrost: Move the shader compilation logic out of the gallium driver
While at it, rework the code to avoid copies between intermediate
structures: the pan_shader_info is passed to the compiler context so
the compiler can fill shader information directly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8963>
2021-02-15 11:23:46 +00:00
Boris Brezillon d18fc89066 panfrost: Keep the compiler inputs in the context
So we don't have to copy data around.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8963>
2021-02-15 11:23:46 +00:00
Boris Brezillon 72d14f8b6f panfrost: Move sysval_to_id out of panfrost_sysvals
So we can re-use the panfrost_sysvals definition outside of the
compiler without dragging the sysval_to_id hash table.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8963>
2021-02-15 11:23:46 +00:00
Alyssa Rosenzweig 856f0abd2b pan/{mdg, bi}: Lower load_sample_pos
Conceptually same lowering as the DDK, although we're missing a number
of relevant compiler optimizations so the generated code is awful.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig 00c1d5da34 pan/{mdg, bi}: Lower load_helper_invocation
Passes dEQP-GLES31.functional.shaders.helper_invocation.* on both
architectures

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig 00df274586 pan/bi: Implement coverage mask updates
Impressive how simple this looks after dozens of patches of
sysval-related prepwork :)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig ae8b1fa7db pan/bi: Decouple sysval loading from NIR
Useful for builder-based sysvals.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig 1e7b5f3826 pan/bi: Implement nir_intrinsic_load_sample_positions_pan
Just copy the FAU result.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig ca0f50ec6a pan/bi: Implement load_sample_mask_in
Preloaded.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig 92569f5d6e pan/bi: Fix gl_SampleID read
Fixes dEQP-GLES31.functional.shaders.sample_variables.sample_id.default_framebuffer

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig ad06e0592a pan/bi: Implement ufind_msb
Lowered to #(sz - 1) - clz(x), taking advantage of the machine's
8-bit and 16-bit variants of clz and the widening on the second argument
of ISUB to implement neatly in two instructions.

Note that in NIR, ufind_msb can take any integer type but always output
i32.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Alyssa Rosenzweig 2ef97a079a pan/bi: Implement bitfield_reverse
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:31 -05:00
Boris Brezillon 06d6dd1b40 pan/bi: Support bit_count()
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:30 -05:00
Boris Brezillon 58e887f07e pan/bi: Add uclz() support
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:30 -05:00
Alyssa Rosenzweig b0551cb0c2 pan/bi: Implement texture gathers
Passes all of dEQP-GLES31.functional.texture.gather.*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:30 -05:00
Alyssa Rosenzweig ab9650d5aa pan/bi: Remove redundant TEXC opcode check
Already checked in emit_tex

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:30 -05:00
Alyssa Rosenzweig 9f55657366 panfrost: Overhaul sysval handling
Don't preassign.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
2021-02-12 16:44:29 -05:00
Alyssa Rosenzweig 9bf8bfe3c8 pan/bi: Fix empty shader handling
Fixes INSTR_INVALID_ENC fault on dEQP-GLES31.functional.compute.basic.empty

Fixes: bfcdc8f174 ("pan/bi: Add some zero bytes after shaders on Bifrost")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9011>
2021-02-12 16:28:00 +00:00
Alyssa Rosenzweig a805d999c0 pan/bi: Fix jumps to terminal block again
New scheduler broke this. We need to shuffle some code around so we do
the lower pre-schedule instead of post-schedule (no clauses to work
with).

Fixes: 77933d16d8 ("pan/bi: Switch to new scheduler")
Reported-by: Icecream95 <ixn@disroot.org>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9011>
2021-02-12 16:28:00 +00:00
Alyssa Rosenzweig accffda30d pan/bi: Skip ATEST for colour blit shaders
Small win.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9002>
2021-02-12 12:33:19 +00:00
Alyssa Rosenzweig e279606232 panfrost: Pass is_blit flag around
There are blit shader specific optimizations available.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9002>
2021-02-12 12:33:19 +00:00
Alyssa Rosenzweig a27d76a2d9 pan/bi: Push UBOs on Bifrost
Based on the Midgard pass. Results look better since Midgard already had
a basic UBO pushing pass to begin with. Particularly nice to see the
dramatic reduction in spilling.

total instructions in shared programs: 169141 -> 161215 (-4.69%)
instructions in affected programs: 164102 -> 156176 (-4.83%)
helped: 1269
HURT: 90
helped stats (abs) min: 1 max: 61 x̄: 6.50 x̃: 4
helped stats (rel) min: 0.15% max: 17.58% x̄: 6.31% x̃: 5.88%
HURT stats (abs)   min: 1 max: 170 x̄: 3.58 x̃: 1
HURT stats (rel)   min: 0.08% max: 133.33% x̄: 16.65% x̃: 5.26%
95% mean confidence interval for instructions value: -6.28 -5.38
95% mean confidence interval for instructions %-change: -5.39% -4.18%
Instructions are helped.

total nops in shared programs: 121049 -> 120997 (-0.04%)
nops in affected programs: 110024 -> 109972 (-0.05%)
helped: 501
HURT: 758
helped stats (abs) min: 1 max: 45 x̄: 5.54 x̃: 2
helped stats (rel) min: 0.25% max: 47.06% x̄: 6.81% x̃: 4.55%
HURT stats (abs)   min: 1 max: 102 x̄: 3.59 x̃: 3
HURT stats (rel)   min: 0.32% max: 50.00% x̄: 7.13% x̃: 6.06%
95% mean confidence interval for nops value: -0.45 0.37
95% mean confidence interval for nops %-change: 1.07% 2.09%
Inconclusive result (value mean confidence interval includes 0).

total clauses in shared programs: 40388 -> 31610 (-21.73%)
clauses in affected programs: 38825 -> 30047 (-22.61%)
helped: 1367
HURT: 2
helped stats (abs) min: 1 max: 58 x̄: 6.43 x̃: 5
helped stats (rel) min: 1.34% max: 55.56% x̄: 24.97% x̃: 25.00%
HURT stats (abs)   min: 2 max: 12 x̄: 7.00 x̃: 7
HURT stats (rel)   min: 5.08% max: 6.67% x̄: 5.88% x̃: 5.88%
95% mean confidence interval for clauses value: -6.74 -6.08
95% mean confidence interval for clauses %-change: -25.50% -24.35%
Clauses are helped.

total quadwords in shared programs: 144937 -> 130686 (-9.83%)
quadwords in affected programs: 140419 -> 126168 (-10.15%)
helped: 1369
HURT: 13
helped stats (abs) min: 1 max: 112 x̄: 10.50 x̃: 7
helped stats (rel) min: 0.23% max: 31.82% x̄: 11.36% x̃: 10.78%
HURT stats (abs)   min: 1 max: 106 x̄: 10.00 x̃: 1
HURT stats (rel)   min: 5.88% max: 10.24% x̄: 9.26% x̃: 10.00%
95% mean confidence interval for quadwords value: -10.96 -9.66
95% mean confidence interval for quadwords %-change: -11.52% -10.82%
Quadwords are helped.

total spills in shared programs: 1106 -> 705 (-36.26%)
spills in affected programs: 1058 -> 657 (-37.90%)
helped: 41
HURT: 0

total fills in shared programs: 2241 -> 1645 (-26.60%)
fills in affected programs: 2219 -> 1623 (-26.86%)
helped: 43
HURT: 2

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
2021-02-11 17:24:37 +00:00
Alyssa Rosenzweig 040a350b1e pan/bi: Add SSA-based scalar copy propagation
This is a very simple (and slow...) copyprop pass. It's good enough to
get rid of redundant moves from FAU, but it doesn't help for vector
combines.

total instructions in shared programs: 175219 -> 169141 (-3.47%)
instructions in affected programs: 91439 -> 85361 (-6.65%)
helped: 599
HURT: 0
helped stats (abs) min: 1 max: 112 x̄: 10.15 x̃: 6
helped stats (rel) min: 0.30% max: 33.33% x̄: 8.61% x̃: 8.04%
95% mean confidence interval for instructions value: -11.06 -9.24
95% mean confidence interval for instructions %-change: -9.07% -8.16%
Instructions are helped.

total nops in shared programs: 120011 -> 121049 (0.86%)
nops in affected programs: 47355 -> 48393 (2.19%)
helped: 110
HURT: 309
helped stats (abs) min: 1 max: 6 x̄: 2.07 x̃: 2
helped stats (rel) min: 0.44% max: 16.67% x̄: 3.59% x̃: 3.16%
HURT stats (abs)   min: 1 max: 56 x̄: 4.10 x̃: 2
HURT stats (rel)   min: 0.32% max: 80.85% x̄: 6.85% x̃: 3.12%
95% mean confidence interval for nops value: 1.86 3.09
95% mean confidence interval for nops %-change: 3.08% 5.14%
Nops are HURT.

total clauses in shared programs: 40576 -> 40388 (-0.46%)
clauses in affected programs: 3074 -> 2886 (-6.12%)
helped: 106
HURT: 0
helped stats (abs) min: 1 max: 4 x̄: 1.77 x̃: 2
helped stats (rel) min: 0.42% max: 22.22% x̄: 7.17% x̃: 6.90%
95% mean confidence interval for clauses value: -1.91 -1.63
95% mean confidence interval for clauses %-change: -7.80% -6.53%
Clauses are helped.

total quadwords in shared programs: 146590 -> 144937 (-1.13%)
quadwords in affected programs: 59475 -> 57822 (-2.78%)
helped: 493
HURT: 1
helped stats (abs) min: 1 max: 28 x̄: 3.35 x̃: 2
helped stats (rel) min: 0.28% max: 15.38% x̄: 4.08% x̃: 3.85%
HURT stats (abs)   min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 2.38% max: 2.38% x̄: 2.38% x̃: 2.38%
95% mean confidence interval for quadwords value: -3.61 -3.08
95% mean confidence interval for quadwords %-change: -4.33% -3.81%
Quadwords are helped.

total spills in shared programs: 1106 -> 1106 (0.00%)
spills in affected programs: 0 -> 0
helped: 0
HURT: 0

total fills in shared programs: 2241 -> 2241 (0.00%)
fills in affected programs: 0 -> 0
helped: 0
HURT: 0

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
2021-02-11 17:24:37 +00:00
Alyssa Rosenzweig fa79168b9e pan/bi: Simplify derivative lowering
Now that we lower FAU correctly, we don't need to write the extra move
explicitly, it will be lowered in later.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
2021-02-11 17:24:37 +00:00
Alyssa Rosenzweig 0acc6b564e pan/bi: Rework FAU lowering
Move and reshape bi_lower_fau to bi_schedule.c. This generalizes the
pass for FAU reads, allowing copyprop to work with FAU without problems.

The pass must run immediately before scheduling. Its post-conditions are
directly specified as the scheduler's pre-conditions. It momentarily
will depend on internal scheduler predicates. It is, for all intents and
purposes, part of the scheduler. Keep it all together.

Finally, adjust the 0 handling to avoid a move at the expense of
constrained scheduling of something like `FADD.v2f16.clamp_0_1 u0, #0`

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
2021-02-11 17:24:37 +00:00
Alyssa Rosenzweig 54beea9799 pan/bi: Fix multithreaded shader-db
Clobbered names.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
2021-02-11 17:24:37 +00:00
Alyssa Rosenzweig db7e2dce1c panfrost: Move sysvals to dedicated UBO
This makes UBO 0 less special, allowing us to generalize uniform
optimization. Note this disables RMU on Midgard as we're about to
rewrite the RMU mechanism.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8973>
2021-02-11 17:24:37 +00:00
Alyssa Rosenzweig 4f4bb72745 pan/bi: Add nosched debug option
Forces a trivial schedule to replicate the old behaviour (for debugging
or benchmarking). Actually the new scheduler is still used, just highly
constrained; the net result should still do what's expected.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>
2021-02-08 14:07:30 +00:00
Alyssa Rosenzweig 77933d16d8 pan/bi: Switch to new scheduler
Delete the old.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>
2021-02-08 14:07:29 +00:00
Alyssa Rosenzweig 07a3ccfbed pan/bi: Include ATEST datum in the instruction
Rather than doing this at pack time like before, or adding extra
constraints to the already overcomplicated scheduler, let's just include
it like a regular FAU source.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>
2021-02-08 14:07:29 +00:00
Alyssa Rosenzweig 4a27f8887d pan/bi: Print program size in shader-db
Less critical than other metrics, but still matters for instruction
cache hit rate, and worth being aware of.

And, fine, it makes the scheduler look like a bigger win on another
axis.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>
2021-02-08 14:07:29 +00:00
Icecream95 6ecce71f71 pan/bi: Fix shader prefetch size
The prefetch buffer size is larger than first thought, but includes
the final clause, so subtract the size of the final clause from the
prefetch size.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>
2021-02-08 14:07:29 +00:00
Alyssa Rosenzweig c4f26d12f9 pan/bi: Lower FP32 transcendentals where required
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8894>
2021-02-08 13:55:12 +00:00
Alyssa Rosenzweig 0bdd4cbb57 pan/bi: Lower flog2 to a table and polynomial
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8894>
2021-02-08 13:55:12 +00:00
Alyssa Rosenzweig d4c028f770 pan/bi: Lower FEXP2 with a table
Connor's code, not the blob's, amusingly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8894>
2021-02-08 13:55:12 +00:00
Alyssa Rosenzweig 10b1f26687 pan/bi: Lower frsq to Newton-Raphson
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8894>
2021-02-08 13:55:12 +00:00
Alyssa Rosenzweig c5e5d11599 pan/bi: Lower frcp to Newton-Raphson
For G71 but should work on any Bifrost, probably overlaps some CL stuff.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8894>
2021-02-08 13:55:12 +00:00
Alyssa Rosenzweig 9157cf8124 pan/bi: Add bi_fmul_f32 convenience method
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8894>
2021-02-08 13:55:12 +00:00
Alyssa Rosenzweig eff837c7c2 pan/bi: Implement ACMPXCHG
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8848>
2021-02-05 17:49:44 +00:00
Alyssa Rosenzweig d400d5e150 pan/bi: Implement AXCHG
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8848>
2021-02-05 17:49:44 +00:00
Alyssa Rosenzweig 836c1c6fb1 pan/bi: Fix NULL deref with empty shader
Fixes regression in dEQP-GLES31.functional.compute.basic.empty

Fixes: d0902aa2d4 ("pan/bi: Pass through wait_{6, 7} flags")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8848>
2021-02-05 17:49:44 +00:00
Alyssa Rosenzweig ce2ef3dad6 pan/bi: Use canonical terminology for tuple
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig 7434f31e09 pan/bi: Factor nir_function_impl out of the context
Unnecessary and complicates unit testing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig ab6f05eabd pan/bi: Move init_builder to common code
Needs to take a cursor to be applicable outside NIR->BIR of course.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:44 +00:00
Alyssa Rosenzweig 3ce67cb0d9 pan/bi: Add "soft" mode to DCE
We would like to reuse the DCE logic to eliminate register writes
without eliminating instructions, as a post-sched pass. This type of
operation will eventually generalize to intrinsics that write a register
*and* have side effects (just atomics, I think).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig 623bd2127f pan/bi: Add dead branch elimination pass
Ported from Midgard due to the same quirk of our code generation.
Additional validation, though.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig d0902aa2d4 pan/bi: Pass through wait_{6, 7} flags
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig f1d551ea9f pan/bi: Print disasm/stats with DEBUG=internal
Arguably more important than the IR prints.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:43 +00:00
Alyssa Rosenzweig 61af9cb76b pan/bi: Add internal debug flag
Since 3186401751 ("pan/bi: Suppress disassembly for internal shaders"),
we haven't had a good way to debug blit shaders. I keep rewriting this
patch manually, let's just a debug flag for it.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
2021-01-29 16:55:43 +00:00
Connor Abbott 5c92b3c460 panfrost: Assume that nir_tex_instr::dest_type is sized
Get rid of some now-redundant code, and cleanup the is-float check in
the bifrost compiler.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989>
2021-01-25 11:21:59 +01:00
Alyssa Rosenzweig 92461a1133 pan/bi: Fix 64-bit SSBO addresses
Fixes: 9c7efc4510 ("pan/bi: Add intrinsic emits for builder")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 6f0eff548c pan/bi: Implement packing ops between 32-bit vec1 and 16-bit vec2
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 c9c637a707 pan/bi: Implement ihadd/irhadd operations
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 591ccbcf47 pan/bi: Implement saturated add/sub operations
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 3f7e7495fc pan/bi: Lower umul_high
Also lower uadd_carry, which the mul_high lowering generates.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 24867386ee panfrost: Add a sysval for local_work_dim
Fixes Piglit test get-work-dim.cl.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 f5a35918db panfrost: Add a sysval for local_group_size
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 76fa57d195 pan/bi: Use pan_nir_lower_64bit_intrin
The intrinsics covered by the pass are implemented by reading 32-bit
registers, so there is no reason to keep them 64-bit.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 c82ab9b94a pan/bi: Improve unknown intrinsic error
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 c71d4d931e pan/bi: Implement load_kernel_input
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 f33694552d pan/bi: Implement load/store intrinsics
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 d267183829 pan/bi: Add some compute intrinsic loads
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 2a7c33bd9d pan/bi: Handle 64-bit pack and unpack operations
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Icecream95 f5c9a10f33 pan/bi: Lower 64-bit integers
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Alyssa Rosenzweig f4d2b35ac8 pan/bi: Pipe scratch_size in from NIR
Needs to be added to whatever we spill ourselves.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8358>
2021-01-18 20:49:45 +00:00
Alyssa Rosenzweig 81becaa685 pan/bi: Fix assertion
Fixes: bef3fedc81 ("pan/bi: Lower 8bit fragment outputs to 16bit")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Coverity
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8489>
2021-01-15 21:50:32 +00:00
Boris Brezillon 0ad83e3361 pan/bi: Fix the !immediate case in bi_emit_store_vary()
The base offset was ignored, take it into account.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8469>
2021-01-13 17:07:14 +00:00
Alyssa Rosenzweig 9f1fad94f9 pan/bi: Implement TEXS for cube maps
Saves a few instructions in the common case. Requires refactoring the
TEXS check.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8287>
2021-01-13 13:30:08 +00:00
Icecream95 9c8dfe4a65 panfrost: Fix size assertion in bi_alu_src_index
Shifting by the bitsize was not only wrong, the shift is undefined
behavior when bitsize is 32, causing the assertion to fire on AArch32.

Fixes: 95d62ee7cf ("pan/bi: Add bi_alu_src_index helper")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8460>
2021-01-13 03:53:45 +00:00
Icecream95 bfcdc8f174 pan/bi: Add some zero bytes after shaders on Bifrost
Bifrost will prefetch bytes after the end of shaders, so make sure
these bytes are allocated and zeroed.

Fixes GPU faults in Xonotic.

Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8428>
2021-01-13 00:11:20 +00:00
Icecream95 e74b2edcef pan/bi: Add a define for the Bifrost shader prefetch size
Found by adding NOPs to the start of a shader and checking dmesg to
see at what sizes the GPU faulted trying to read the following
non-executable page.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8428>
2021-01-13 00:11:19 +00:00
Icecream95 041261c6b3 panfrost: Dual-source blending on Bifrost
Tested with the arb_blend_func_extended Piglit tests and Alacritty.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8455>
2021-01-12 21:05:01 +00:00
Boris Brezillon bef3fedc81 pan/bi: Lower 8bit fragment outputs to 16bit
Bifrost does not support passing fragment colors through 8 bit registers.

(Rewrote to use NIR helpers -Alyssa)

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
2021-01-11 22:28:58 +00:00
Alyssa Rosenzweig 77209e0500 pan/bi: Parametrize intrinsic immediate limits
Fixes issues on:

dEQP-GLES3.functional.transform_feedback.array_element.separate.points.lowp_mat2x3

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
2021-01-11 22:28:58 +00:00
Alyssa Rosenzweig b15f3a1107 pan/bi: Use TEXC for indices >= 8
Otherwise it can't fit, fixes

   dEQP-GLES3.functional.texture.units.all_units.only_2d.*
   dEQP-GLES3.functional.texture.units.all_units.only_cube.*
   dEQP-GLES3.functional.texture.units.all_units.mixed.*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
2021-01-11 22:28:57 +00:00
Alyssa Rosenzweig 3705ad96aa pan/bi: Implement scalar i2i8/u2u8
Doesn't work for vectors though that's the vectorization branch's
problem to deal with now. Suffices for fragment output.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
2021-01-11 22:28:57 +00:00
Alyssa Rosenzweig 6b4f2d8529 pan/bi: Allow passing thorugh 8-bit scalars
Needed for fragment output. Not nearly sufficient for actual 8-bit
types in e.g OpenCL.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
2021-01-11 22:28:57 +00:00
Alyssa Rosenzweig d0c35f46af pan/bi: Fix ATEST with pure integers
It doesn't matter what we pass due to a subtlety in the spec but the
assert is still wrong.

Fixes: 49f38aa9e7 ("pan/bi: Implement fragment_out by builder")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
2021-01-11 22:28:57 +00:00
Alyssa Rosenzweig bf7fe30436 pan/bi: Pull out bi_dontcare helper
Where we need a power efficient encoding but don't care about the value
read, corresponding to rNULL in canonical assembly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Maciej Matuszczyk <maccraft123mc@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8427>
2021-01-11 22:28:57 +00:00
Alyssa Rosenzweig a6f1500bed pan/bi: Workaround BLEND precolour with explicit moves
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8417>
2021-01-11 20:43:13 +00:00
Adam Jackson 8ddddfb516 treewide: Disambiguate various variables named "debug_options"
Name them after what they control so 'vi -t' can take you somewhere
useful.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8165>
2021-01-04 20:51:28 +00:00
Alyssa Rosenzweig e5ec0dc183 pan/bi: Remove NIR->old IR
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 4e4146c990 pan/bi: Remove old IR prints
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 39aa8c4a5a pan/bi: Switch to new IR
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 73169aa0b4 pan/bi: Stub FAU lowering pass
A given tuple can only load a single entry from FAU-RAM, so we need a
lowering pass before scheduling to assign FAU and lower the other
sources to moves.

Right now this only handles constants. Uniforms and general FAU are
todo.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 239ef52216 pan/bi: Add bi_branch, bi_jump helpers
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 26ce13f657 pan/bi: Add instruction emit for builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig f7c2fc7eba pan/bi: Add emit tex for builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 26cbf559d6 pan/bi: Fix TEXS/TEXC check prototype
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 70d6c5675d pan/bi: Emit TEXC with builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig e477de829f pan/bi: Add builder-using helpers for TEXC structs
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 6f048b5f95 pan/bi: Add TEXS emit with builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:02 +00:00
Alyssa Rosenzweig 311d3d6015 pan/bi: Implement jumps with the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig f05174e5a5 pan/bi: Implement ALU with the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 8e82641cf5 pan/bi: Add bi_cmpf_nir helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 8c99fed470 pan/bi: Add bi_nir_round helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 95d62ee7cf pan/bi: Add bi_alu_src_index helper
Generates bi_index from nir_alu_src, taking into account the applied
swizzle, and using (swizzle / 32-bit) portion as an offset, to be
applied later during RA. The sub 32-bit portion only applies for 8-bit
and 16-bit instructions, which need to either handle them explicitly as
a swizzle specifier, or lower to a swizzle explicitly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 9c7efc4510 pan/bi: Add intrinsic emits for builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 482cc273af pan/bi: Implement load attribute with the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 0ae835499d pan/bi: Implement frag coord with the builder
Much slicker :-)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 2e57684d2d pan/bi: Implement load_ubo with the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 341e312cf4 pan/bi: Implement store_vary with the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 49f38aa9e7 pan/bi: Implement fragment_out by builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 3c5097bbfd pan/bi: Implement BLEND by builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 20bfe9ee05 pan/bi: Implement load_vary via the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig baec458105 pan/bi: Implement bi_reg_fmt_for_nir helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 279772b5ec pan/bi: Implement load_blend_input via the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 63863de923 pan/bi: Implement bi_emit_load_const via the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 9841afad57 pan/bi: Implement bi_load_sysval via the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig feecf0a3d8 pan/bi: Implement bi_emit_ld_tile via the builder
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 4de806a803 pan/bi: Add bi_make_vec_to helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 8a6ec4a5d8 pan/bi: Add bi_is_intr_immediate helper
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 693271c0a8 pan/bi: Add builder initialization helper
When going out of NIR, it's useful to start inserting instructions at
the end of the current block.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 3483b4e24c pan/bi: Rename bi_load
Need to free up the symbol so it doesn't clash with the builder.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 7af46aa695 pan/bi: Ensure fneg of a constant isn't reached
Fix the optimization loop like ir3 does.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8135>
2020-12-31 14:39:01 +00:00
Alyssa Rosenzweig 98fabee213 pan/bi: Merge BIR_INDEX_FAU and BIR_INDEX_BLEND
There's no reason to separate these, and it's more convenient not to.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8215>
2020-12-23 13:15:10 -05:00
Alyssa Rosenzweig 876f37ed59 pan/bi: Use canonical name for segments
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
2020-12-23 17:06:57 +00:00
Alyssa Rosenzweig c7e494268e pan/bi: Use canonical update modes
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
2020-12-23 17:06:57 +00:00
Alyssa Rosenzweig 3797fc9af9 pan/bi: Use canonical sample names
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
2020-12-23 17:06:57 +00:00
Alyssa Rosenzweig 2e84a1b4d8 pan/bi: Use canonical varying names
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
2020-12-23 17:06:57 +00:00
Alyssa Rosenzweig 030854a3b8 pan/bi: Use canonical names for rounding modes
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
2020-12-23 17:06:56 +00:00
Alyssa Rosenzweig 6e481500d0 pan/bi: Use canonical names for clamps
Prepare to generate this enum by correctly naming the open-coded
variant.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
2020-12-23 17:06:56 +00:00
Alyssa Rosenzweig 6a46b38d12 pan/bi: Label shader-db shaders
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8213>
2020-12-23 17:06:56 +00:00
Alyssa Rosenzweig 3071f36cfb pan/bi: Allow toggling disassembly verbosity
Verbose mode is especially useful for debugging packing, but otherwise
just gets in the way I find.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8139>
2020-12-21 21:54:50 +00:00
Boris Brezillon 0f643bbcc8 pan/bi: LOD is a 8.8 fixed point
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7653>
2020-11-25 16:22:19 +01:00
Boris Brezillon 3949e8ba19 pan/bi: Always emit a LOD/CUBE word for FETCH instructions
There's no flag/mode to reflect when a LOD is zero on FETCH instructions,
we have to emit the LOD/CUBE word unconditionally.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7653>
2020-11-25 16:22:16 +01:00
Boris Brezillon 8040b797a8 pan/bi: Only update LOD mode on TEX operations
If we don't add this check we clobber fetch mode when a 0 LOD is
specified on a txf instruction.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7653>
2020-11-25 16:21:10 +01:00
Alyssa Rosenzweig d299c2eb0b pan/bi: Implement shader-db stats
v2: Drop register tracking since it was wrong, and meaningful accounting
is tricky for Bifrost (which wants round robin RA for at least some
registers)... we'll cross that bridge when we get there, possibly
preferring a "max liveness" estimate to the raw RA output.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>
2020-11-25 13:15:05 +00:00
Alyssa Rosenzweig 45de02bdac pan/bi: Ensure TEXC src0 is not marked SSA
Prevents attempts to spill tied TEXC src/dest, resulting in a crash,
seen in shaders/tesseract/229.shader_test

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>
2020-11-25 13:15:05 +00:00
Boris Brezillon bbd3a8eadd pan/bi: Emit a combine even if we only pass one staging reg to TEXC
We need that to account for potential swizzling on the source reg.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>
2020-11-25 13:15:05 +00:00
Alyssa Rosenzweig 087e3f8da8 pan/bi: Fix varying writemask handling
Allows shaders/supertuxkart/1.shader_test and
shaders/unity/24-Tree.shader_test to compile.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>
2020-11-25 13:15:05 +00:00
Alyssa Rosenzweig eee2a43461 pan/bi: Implement sampler1D
Enough to get shaders/humus-celshading/1.shader_test compiling, no idea
if it actually works but it looks reasonable.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7615>
2020-11-25 13:15:05 +00:00
Jesse Natalie b94b827add panfrost/util: Move nir_undef_to_zero into core nir and add 'lower'
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565>
2020-11-18 04:05:37 +00:00
Boris Brezillon fee4e991fe pan/bi: Stop extracting the immediate attribute index from src0
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon fb01328d30 pan/bi: Fix LD_VAR with non-constant index
src0 and src1 were mixed leading to invalid varying indices. In order to
fix that properly, we first extend load_vary to pass the immediate index
through a dedicated field and add a special boolean. This way, we don't
have to make sure src0 always contains the index, and can instead match
the src numbering defined in ISA.xml.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon d86973d92a pan/bi: Stop passing special varying names through src0
It's just clearer to have dedicated fields encoding the fact that the
LD_VAR should be SPECIAL, and another field storing the special var id.

With this change, the source index know matches the ISA.xml definition.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon 1176cc1297 pan/bi: Pass LD_VAR update mode explicitly
Let the compiler pass the update mode instead of inferring from the
constant value.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon 058bcf4406 pan/bi: Set roundmode to RTZ for f2u operations
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon 00a6a9bdf8 pan/bi: Let the GPU pick the right format based on the varying descriptor
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon d0cd8bf2a5 pan/bi: Support txs operations
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon 045ae54343 pan/bi: Don't use TEXS for tex operations with a src that's not lod or coord
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7636>
2020-11-17 08:41:05 +01:00
Boris Brezillon 54a965b153 pan/bi: Add support for tex offsets
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>
2020-11-13 14:35:17 +01:00
Boris Brezillon 55cb921f92 pan/bi: Add support for derivative instructions
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>
2020-11-13 14:35:17 +01:00
Boris Brezillon 9f640c0f3d pan/bi: Store the architecture in the compiler context
Some instructions differ between v6 and v7 and we'll need to know which
architecture we're compiling for if we want to generate the right
instructions.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>
2020-11-13 14:35:17 +01:00
Boris Brezillon 8be5447461 pan/bi: Extract shadowmap comparator
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7530>
2020-11-13 14:35:17 +01:00
Boris Brezillon d47969eb5e pan/bi: Add support for load_instance_id
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon 5cd1d8c1ed pan/bi: Add support for load_vertex_id
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon 4995a4c03a pan/bi: Add support for ushr
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon af70987b36 pan/bi: Add support for ishr
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon cc0950722c pan/bi: Get rid of bi_emit_ld_uniform()
Now that we lower uniforms to UBO we can get rid of bi_emit_ld_uniform().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon 09da82cbdc pan/bi: Add support for load_ubo
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon 87e2169cb9 pan/bi: Fix swizzle handling in bi_copy_src()
The number of src swizzle to initialize depends on the number of source
properties (size and number of components) not the destination ones.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon 2522f509a3 pan/bi: Support centroid and sample interpolations
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Boris Brezillon ca5a00a70c pan/bi: Extract LD_VAR sample field from ins->load_vary.interp_mode
So we can extend bi_emit_ld_vary() to support centroid and sample modes.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7472>
2020-11-09 20:36:50 +01:00
Alyssa Rosenzweig f8c1d79f69 pan/bi: Correctly calculate render target index
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
2020-11-04 11:21:29 -05:00
Alyssa Rosenzweig 9a6dad18d8 pan/bi: Lower depth/stencil stores
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
2020-11-04 11:21:29 -05:00
Alyssa Rosenzweig 6433fedcf1 pan/bi: Emit +ZS_EMIT as needed
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
2020-11-04 11:21:28 -05:00
Alyssa Rosenzweig 0c889e7611 pan/bi: Stub handling for nir_intrinsic_store_combined_output_pan
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
2020-11-04 11:21:28 -05:00
Alyssa Rosenzweig f67b49d512 pan/bi: Factor out bi_emit_blend
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
2020-11-04 11:21:28 -05:00
Alyssa Rosenzweig 928f2bc0d5 pan/bi: Factor out bi_emit_atest
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7446>
2020-11-04 11:21:28 -05:00
Alyssa Rosenzweig eaf0be88f6 pan/bi: Don't emit TEXS for array textures
No place for the extra coordinate.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
2020-11-03 14:42:43 +00:00
Alyssa Rosenzweig 3a86e1e92d pan/bi: Handle 3D/array coordinates
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
2020-11-03 14:42:43 +00:00
Alyssa Rosenzweig 56bda0fb49 pan/bi: Track tex data register swizzles
So we can pass through a .z component.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
2020-11-03 14:42:43 +00:00
Alyssa Rosenzweig 1463824319 panfrost: Add bi_emit_array_index helper
Need to handle type conversion.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
2020-11-03 14:42:43 +00:00
Alyssa Rosenzweig 3186401751 pan/bi: Suppress disassembly for internal shaders
Backport of 756441b297 for bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
2020-11-03 14:42:42 +00:00
Boris Brezillon 2f00f82469 pan/bi: Lower cube map coordinates
We need to do the transform specified in the OpenGL spec ourselves, with
some assistance from the hardware.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
2020-11-03 14:42:42 +00:00
Boris Brezillon 0ed8eee706 pan/bi: Split special class in two
Some special instructions are scheduled on the FMA unit, let's add a
new class for this case and rename the old one accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
2020-11-03 14:42:42 +00:00
Boris Brezillon 6c6693e043 pan/bi: Fix ms_idx type to catch missing ms_index source
nir_tex_instr_src_index() returns a negative result when the requested
source does not exist, but we cast that to an unsigned type thus losing
this information.

Fixes: b83c293674 ("pan/bi: Add basic support for txf_ms")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7314>
2020-10-26 19:11:33 +01:00
Boris Brezillon eaed477652 pan/bi: Add ult support
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7314>
2020-10-26 19:11:29 +01:00
Boris Brezillon 1c8b8e3c82 pan/bi: Add support for load_point_coord
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7314>
2020-10-26 19:11:20 +01:00
Boris Brezillon 55c0dd943e pan/bi: Add support for load_front_face
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7314>
2020-10-26 19:11:16 +01:00
Alyssa Rosenzweig 81b28ebcb5 pan/bi: Use nir_undef_to_zero
We don't handle undefs explicitly in NIR->BIR which means if they aren't
optimized out they won't be RA'd to anything and then backend RA will
crash (as occurs in a glamor shader seen in MATE).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
2020-10-23 14:48:23 +00:00
Alyssa Rosenzweig f0421099ef pan/bi: Pipe through tls_size
So we have stack memory allocated.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
2020-10-23 14:48:23 +00:00
Boris Brezillon 69c864b0b9 panfrost: Make {midgard,bifrost}_compile_shader_nir() return a program object
Letting the caller zero-initialize the program object is error prone,
not to mention that resources attached to the program might not be freed
by the caller. Let's simplify that by letting the compiler allocate the
panfrost_program object. Those objects should be freed with ralloc_free().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
2020-10-23 14:48:22 +00:00
Boris Brezillon b83c293674 pan/bi: Add basic support for txf_ms
We currently don't support txf_ms instructions specifying a texel offset
src.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
2020-10-23 14:48:22 +00:00
Boris Brezillon d33c8afe9b pan/bi: Support the case where TEXC needs 0 or 1 staging reg
No need to add a COMBINE instruction if TEXC only needs zero or one
staging reg.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
2020-10-23 14:48:22 +00:00
Boris Brezillon 4aff27a68a pan/bi: Add support for load_sample_id
Sample ID is preloaded in r61.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
2020-10-23 14:48:22 +00:00
Boris Brezillon 685d45ff93 pan/bi: Special-case load_input for blend shaders
Blend shaders are passed blend inputs through r0-r3. Let's emit a MOV
from those register when we see a load_input intrinsic.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Boris Brezillon 3432d0a3e5 pan/bi: Special-case BLEND instruction emission for blend shaders
Blend shaders shouldn't use the blend descriptors stored in the FAU RAM
since this is what triggered the blend shader call in the first place.
The descriptor is instead extracted from the compiler inputs and passed
as a constant to the blend instruction.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Boris Brezillon 2f3f5da91d pan/bi: Collect return addresses of blend calls
We will need that for blend shaders so they can be passed a return
address and jump back to the fragment shader when they're done.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Boris Brezillon 8da0a1d5fd pan/bi: Add load_output support
This is mapped to the LD_TILE instruction. Note that multi-sample RTs
are not supported yet.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Boris Brezillon 1a1d9cce46 pan/bi: Add support for load_blend_const_color_{r,g,b,a}_float
Needed for blend shaders.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Boris Brezillon 16179c89d1 pan/bi: Rework blend descriptor access handling
The current logic assumes blend descriptors are always retrieved from
the blend descriptor slots present in the FAU RAM, but this assumption
no longer stands when we add blend shaders to the mix. In that case we
need to use an 'opaque blend' whose descriptor is passed through
embedded constants.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Boris Brezillon f25850bf5f pan/bi: Use canonical name for FAU RAM sources
The uniform_constant field and BIFROST_SRC_CONST_{LO,HI} definitions
seem to imply that those only deal with embedded constants. Let's
rename them to reflect the fact that they actually encode accesses to
the Fast-Access-Uniform RAM.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Boris Brezillon 111cf7f0e8 pan/bi: Copy blend shader info from compile_inputs
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>
2020-10-15 08:05:23 +02:00
Alyssa Rosenzweig c9b2dfd5aa pan/bi: Disable mediump output lowering
Without fp16, this is useless for now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 17:15:03 -04:00
Alyssa Rosenzweig 8cf798d253 pan/bi: Implement FETCH
For texelFetch. A few earlier header fields were wrong.

Fixes dEQP-GLES2.functional.texture.mipmap.2d.generate.rgba8888_fastest

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 17:15:03 -04:00
Alyssa Rosenzweig 7f5428410f pan/bi: Add bi_emit_lod_cube helper
There's a different LOD format used for TXF that will be able to
accomodate cube maps as well.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 17:15:03 -04:00
Alyssa Rosenzweig 125d18d915 pan/bi: Map NIR tex ops to Bifrost ops
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 17:15:02 -04:00
Alyssa Rosenzweig 7fdb090709 pan/bi: Implement txb
Also uses the 8.8 signed fixed-point format.

dEQP-GLES2.functional.shaders.texture_functions.fragment.texture2d_bias

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 17:15:02 -04:00
Alyssa Rosenzweig 4836366ede pan/bi: Handle nir_tex_src_lod
We need to emit some lowering code to convert it to the 8:8 format
expected by the hardware.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 17:15:01 -04:00
Alyssa Rosenzweig f8151312af pan/bi: Add data register passing infrastructure
Lower to a COMBINE, which in turn will lower to moves so RA does the
right thing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 16:53:15 -04:00
Alyssa Rosenzweig 3bf4e60def pan/bi: Stub out TEXC handling
We still need to handle actual complex texturing instructions, as well
as packing, but this is the start.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 16:53:15 -04:00
Alyssa Rosenzweig 5cf53d121c pan/bi: Streamline TEXC/TEXS naming/selection
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 16:53:14 -04:00
Alyssa Rosenzweig 6ed1bdfee4 pan/bi: Use canonical texture op names in IR
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 16:53:13 -04:00
Alyssa Rosenzweig 93f9052935 pan/bi: Fix simple txl test
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 731dfc6066 ("pan/bi: Allow vertex txl with lod=0 as compact")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 16:53:13 -04:00
Alyssa Rosenzweig a204eac759 pan/bi: Handle vector moves
And fix the bad assertion that let this slip.

Like combines, nir_op_vec can be vector, and we need to lower this
ourselves. Thankfully, the lowering is simple.

Fixes
dEQP-GLES2.functional.shaders.loops.for_uniform_iterations.nested_tricky_dataflow_1_*

Fixes: b2c6cf2b6d ("pan/bi: Eliminate writemasks in the IR")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 16:53:13 -04:00
Alyssa Rosenzweig c8b9a05f9e pan/bi: Cull unnecessary edges on the CF graph
If a block ends in an unconditional jump, we don't need to record a
fallthrough successor as well, since it's unreachable.

Likely harmless but makes the IR harder to parse with messy CF graphs.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
2020-10-10 16:53:09 -04:00
Boris Brezillon 0a74a04ba5 panfrost: Pass compile arguments through a struct
So we can extend it more easily without having to patch all callers.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7066>
2020-10-09 14:16:41 +00:00
Alyssa Rosenzweig 7cc55df938 pan/bi: Fix assert when writing vertex outputs
Varying stores require us to generate a LEA_ATTR_IMM instruction, which
is a load.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 0aa08ae2f6 ("nir: Split NIR_INTRINSIC_TYPE into separate src/dest indices")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6985>
2020-10-02 12:03:53 -04:00
Jason Ekstrand 0aa08ae2f6 nir: Split NIR_INTRINSIC_TYPE into separate src/dest indices
We're about to introduce conversion ops which are going to want two
different types.  We may as well just split the one we have rather than
end up with three.  There are a couple places where this is mildly
inconvenient but most of the time I find it to actually be nicer.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6945>
2020-10-01 18:36:53 +00:00
Jason Ekstrand 9750164c09 nir: Rename get_buffer_size to get_ssbo_size
This makes it explicit that this intrinsic is only for SSBOs.  For the
v3dv driver, we'll be adding a get_ubo_size intrinsic and we want to be
able to distinguish between the two.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6812>
2020-09-22 13:34:12 +00:00
Alyssa Rosenzweig 2ff53879f2 pan/bi: Use new packing
...and remove the old manual code.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Alyssa Rosenzweig d2158a5b30 pan/bi: Use src1/dest_invert instead of src_invert[]
This maps more closely to the hardware, which makes for easier packing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Alyssa Rosenzweig 08b105d782 pan/bi: Use 8-bit shifts
Logically, it doesn't matter, but we want the IR to accurately reflect
the hardware behaviour.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Alyssa Rosenzweig 3d63a476f7 pan/bi: Pass blend descriptor explicitly in IR
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Alyssa Rosenzweig 67d89568af pan/bi: Track compute_lod in IR
We'll need to differentiate tex and txl.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Alyssa Rosenzweig 8dd3a81c1d pan/bi: Add format field to IR
To make register_format packing explicit, and possibly in the future
support the auto mode.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Alyssa Rosenzweig 6f5b78874a pan/bi: Introduce segments into the IR
Needed to select between global, UBO, TLS, and WLS addressing modes,
required to implement loads/stores correctly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Alyssa Rosenzweig 33710ff895 pan/bi: Add dummy carry/borrow argument for iadd/isub
On FMA, a carry/borrow is required for iaddc/isubb (whereas the ADD
counterparts don't support carrying/borrowing). The trick is to model
this with an extra dummy (ZERO) argument which is free to encode on FMA,
and in the scheduler, "demote" to the non-carried versions if we want to
schedule to ADD.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6749>
2020-09-16 20:05:34 +00:00
Marek Olšák ac55b1a9a6 nir: get ffma support from NIR options for nir_lower_flrp
This also fixes the inverted last parameter of nir_lower_flrp in most drivers.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6599>
2020-09-04 17:06:22 +00:00
Karol Herbst e5899c1e88 nir: rename nir_op_fne to nir_op_fneu
It was always fneu but naming it fne causes confusion from time to time. So
lets rename it. Later we also want to add other unordered and fne, this is
a smaller preparation for that.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6377>
2020-08-21 17:26:21 +00:00
Rhys Perry 85b7403909 bifrost: use nir_intrinsic_has_type
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6402>
2020-08-21 16:47:00 +00:00