Commit Graph

2471 Commits

Author SHA1 Message Date
Connor Abbott b1b4ce7be2 ir3: Actually allow shared reg moves to be folded
I realized that shared registers were never actually getting folded,
even after adding them to valid_flags, because the move wasn't even
being considered.

I looked at the other uses of is_same_type_mov(), and they should be ok
with this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
2021-07-08 16:02:41 +00:00
Connor Abbott b32188cdba ir3: Better valid flags for shared regs
Shared registers seem to use the same port as consts, so the same
restrictions for cat2/cat3 apply to them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
2021-07-08 16:02:41 +00:00
Connor Abbott 590efd180b ir3: Prevent propagating shared regs out of loops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
2021-07-08 16:02:41 +00:00
Connor Abbott 394c597b1b ir3: Handle unreachable blocks
This fixes a pre-existing bug in ir3, but it showed up even more due to
other changes in this series and it interacts with the logical/physical
CFG split. When both sides of an if end with a jump, a block may become
unreachable via the logical CFG, which can cause problems because it has
no predecessors to figure out the location of live-in non-shared
values. In this case we assume that nir_opt_if has removed any code in
these blocks and just skip processing live-ins for these blocks,
pretending that they aren't live.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
2021-07-08 16:02:41 +00:00
Connor Abbott 22ae91b284 ir3: Handle shared register liveness correctly
As explained in the comments added, we need to add extra edges to the
CFG which are ignored except for shared registers. This plumbs through
support for this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
2021-07-08 16:02:41 +00:00
Connor Abbott 8176657ead ir3/nir: Call nir_lower_subgroups
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
2021-07-08 16:02:41 +00:00
Connor Abbott 68b8b9e9e1 tu, ir3: Plumb through support for CS subgroup size/id
The way that the blob obtains the subgroup id on compute shaders is by
just and'ing gl_LocalInvocationIndex with 63, since it advertizes a
subgroupSize of 64. In order to support VK_EXT_subgroup_size_control and
expose a subgroupSize of 128, we'll have to do something a little more
flexible. Sometimes we have to fall back to a subgroup size of 64 due to
various constraints, and in that case we have to fake a subgroup size of
128 while actually using 64 under the hood, by just pretending that the
upper 64 invocations are all disabled. However when computing the
subgroup id we need to use the "real" subgroup size. For this purpose we
plumb through a driver param which exposes the real subgroup size. If
the user forces a particular subgroup size then we lower
load_subgroup_size in nir_lower_subgroups, otherwise we let it through,
and we assume when translating to ir3 that load_subgroup_size means
"give me the *actual* subgroup size that you decided in RA" and give you
the driver param.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6752>
2021-07-08 16:02:41 +00:00
Hyunjun Ko 9507705693 turnip/kgsl: new flag TU_USE_KGSL
There are some cases using kgsl backend on linux that is still not usual
setup though, we need to consider too.

Regarding the timeline semaphore feature, we could implement it for
the kgsl backend in the future, and probalby it should be using the
existing code in tu_drm.

See #4738, #4907

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11488>
2021-07-01 04:22:55 +00:00
Rob Clark 140ce4f8ed freedreno+ir3: Enable INT16
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11545>
2021-06-29 23:27:28 +00:00
Connor Abbott 42b3d83dd4 ir3/lower_parallelcopy: Use SWZ
shader-db results on a650:

total instructions in shared programs: 1575484 -> 1574866 (-0.04%)
instructions in affected programs: 32579 -> 31961 (-1.90%)
helped: 75
HURT: 0
helped stats (abs) min: 1 max: 98 x̄: 8.24 x̃: 7
helped stats (rel) min: 0.41% max: 30.12% x̄: 2.47% x̃: 1.13%
95% mean confidence interval for instructions value: -10.97 -5.51
95% mean confidence interval for instructions %-change: -3.44% -1.51%
Instructions are helped.

total nops in shared programs: 355742 -> 355628 (-0.03%)
nops in affected programs: 18635 -> 18521 (-0.61%)
helped: 55
HURT: 147
helped stats (abs) min: 1 max: 14 x̄: 4.76 x̃: 6
helped stats (rel) min: 1.41% max: 100.00% x̄: 8.13% x̃: 4.76%
HURT stats (abs)   min: 1 max: 2 x̄: 1.01 x̃: 1
HURT stats (rel)   min: 0.56% max: 25.00% x̄: 2.09% x̃: 1.20%
95% mean confidence interval for nops value: -0.98 -0.15
95% mean confidence interval for nops %-change: -1.93% 0.55%
Inconclusive result (%-change mean confidence interval includes 0).

total non-nops in shared programs: 1219742 -> 1219238 (-0.04%)
non-nops in affected programs: 61125 -> 60621 (-0.82%)
helped: 220
HURT: 0
helped stats (abs) min: 1 max: 99 x̄: 2.29 x̃: 1
helped stats (rel) min: 0.19% max: 29.17% x̄: 0.90% x̃: 0.40%
95% mean confidence interval for non-nops value: -3.26 -1.32
95% mean confidence interval for non-nops %-change: -1.24% -0.56%
Non-nops are helped.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 92bb37cb59 ir3: Add min gen for multi-mov instructions
swz works on a5xx/a6xx but not a3xx according to CI. I don't have any
access to a4xx HW so I can't tell whether it works there.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 78ab6250b5 ir3: Print multi-mov instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott b7f114ea13 ir3/validate: Support multi-mov instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 81812acccc ir3: Use correct flags for movmsk & multi-mov
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 7036e4fd31 ir3/legalize: Support multi-mov instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 3896de621e ir3/postsched: Support multi-mov instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 95e9a15f03 ir3/delay: Support multi-mov instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott ab440d5141 ir3: Support multi-mov instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott ea325226d6 ir3: Add foreach_dst/foreach_dst_n
And cleanup a few places I know of that are open-coding it

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 6b00db0183 ir3: Prepare dest helpers for multi-dst instructions
Assert in dest_regs() that dst_count == 1, since most users of it will
blow up if they encounter multiple destinations, and split out the core
of writes_gpr() so that we can easily make code using it multi-dst
aware.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Connor Abbott 48f5f3be5f ir3: Stop creating dummy dest registers
These were a holdover from before the src/dst split and are no longer
necessary. Just don't create any dest registers for instructions that
never have a destination.

This has the side-effect that it becomes easier to replace uses of
dest_regs() with a per-register thing, once we start adding support for
multiple destinations.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11565>
2021-06-29 08:08:12 +00:00
Emma Anholt fd5293cc43 turnip: Short-circuit if ladder generation for constant index SSBO/UBOs.
The compiler *can* eventually chew through all the copy prop, constant
folding, and dead_cf necessary to use just our constant index, but we can
save a whole lot of hassle by chasing the MOVs up front and finding the
constant.

dEQP-VK.ubo.3_level_array.scalar.row_major_mat4.both goes from 2.0s to
1.6s on a release build (3.1s to 2.1s for a debug build like we use in CI).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11613>
2021-06-28 16:26:24 +00:00
Connor Abbott 9133999430 ir3/sched: Speed up live_effect
If we've identified another use that isn't scheduled yet, we can break
right away rather than iterating through all the other uses. While this
could be optimized further, this simple change makes
dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_ivec4 go
from 40 seconds to 1.9 seconds on a release build according to my
unscientific testing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11613>
2021-06-28 16:26:24 +00:00
Connor Abbott 56dc84b95c freedreno/computerator: Fix local_size typo
Fixes: cbc68c79a5 ("freedreno: Add local_size to ir3_shader_variant")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11622>
2021-06-28 16:06:23 +00:00
Rob Clark e74366b18a turnip: Add CrOS Gralloc support
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11612>
2021-06-26 18:44:12 +00:00
Rob Clark f875b61060 turnip: Fix AcquireImageANDROID() handle type
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11612>
2021-06-26 18:44:12 +00:00
Rob Clark 7ca79b7639 turnip: Use drmIoctl()
Replace open-coded ioctl with drmIoctl() to get restart on interrupted
system calls.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11612>
2021-06-26 18:44:12 +00:00
Matt Turner ed77bf3c4e ci: Unify on MESA_VK_IGNORE_CONFORMANCE_WARNING
Move and rename warn_non_conformant_implementation() to common location
of src/vulkan/util/vk_util.c as vk_warn_non_conformant_implementation().

In freedreno/ci,  move MESA_VK_IGNORE_CONFORMANCE_WARNING to common
location of .baremetal-deqp-test-freedreno-vk.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11563>
2021-06-25 19:45:38 +00:00
Connor Abbott d01e7b50b8 freedreno, tu: Set SP_XS_PVT_MEM_HW_STACK_OFFSET
Theoretically this register should only be used when function calls in
the shader are used, which we don't support. But with the default value
of 0 it seems like pvtmem doesn't work on a650. Just set it to the total
per-SP size, effectively leaving no space for the return-address stack,
like the blob does.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4949
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11581>
2021-06-25 15:57:54 +00:00
Connor Abbott 02b8f8704c freedreno/a6xx: Make SP_XS_PVT_MEM_HW_STACK_OFFSET non-inline
Otherwise we can't use the helper to pack it as it collides with the
function in a6xx-pack.xml.h.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11581>
2021-06-25 15:57:54 +00:00
Danylo Piliaiev fdc0f489e0 ir3: add ldg.a,stg.a which allow complex in-place offset calculation
The full form for ldg.a/stg.a offset is:
 g[reg_address + reg_offset << (imm_shift + 2) + imm_offset << 2]

where imm_shift is in [0, 3] and imm_offset is in [0, 3]

a6xx blob was found to produce a bit simplier offset calculations
for TES/TCS shaders in GTA V:

 [c002000a_03c14215] ldg.a.f32 r2.z, g[r1.y+((r2.z+1)<<2)], 3;
 [c0020004_01c14609] ldg.a.f32 r1.x, g[r1.y+((r1.x+3)<<2)], 1;

Our new syntax:
 stg.a.u32 g[r2.x+(r1.x+1)<<2], r5.x, 1
 stg.a.u32 g[r2.x+r1.x<<4+3<<2], r5.x, 1
 ldg.a.f32 r1.w, g[r1.y+(r1.w+1)<<2], 3
 ldg.a.f32 r1.w, g[r1.y+r1.w<<5+2<<2], 3

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11431>
2021-06-25 15:39:51 +00:00
Danylo Piliaiev 4b06db0548 freedreno/isa: add uoffset type to print positive-only offsets
Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11431>
2021-06-25 15:39:51 +00:00
Danylo Piliaiev ba1c989348 freedreno/computerator: pass iova of buffer to const register
The syntax is:
  @buf 32 (c2.x)
The "(c2.x)" is optional.

This makes possible to test stg, ldg, and global atomics.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11431>
2021-06-25 15:39:51 +00:00
Danylo Piliaiev a9fd4fa26c turnip: early exit in tu6_draw_common to save cpu cycles
Improves Zink + drawoverhead perf up to 4%

Before:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 3981
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 3977

After:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 4136
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 4163

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11556>
2021-06-25 13:37:32 +00:00
Danylo Piliaiev 815a85dd7c turnip: do not re-emit same vs params
Improves drawoverhead perf through Zink up to 260%

Before:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 1518
After:
  1, DrawElements ( 1 VBO| 0 UBO|  0    ) w/ no state change, 3981

This brings it close to Freedreno, which has around 4300.

In vkQuake vs params re-emission now occurs in 0.23% of draw calls.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11556>
2021-06-25 13:37:32 +00:00
Alexey Nurmukhametov 8d0d2e82e7 tu/kgsl: Fix file descriptor double close
tu_kgsl.c: tu_enumerate_devices closed fd previously closed by
tu_physical_device_init function.

Move out the fd closing from tu_physical_device_init function because
they do not belong to it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11561>
2021-06-24 18:16:15 +00:00
Emma Anholt ea5707c52f turnip: Disable buffer texturing on 422 formats.
Fixes:
dEQP-VK.api.info.format_properties.g8b8g8r8_422_unorm
dEQP-VK.api.info.format_properties.b8g8r8g8_422_unorm

and part of:
dEQP-VK.api.info.format_properties.g8_b8_r8_3plane_420_unorm
dEQP-VK.api.info.format_properties.g8_b8r8_2plane_420_unorm

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>
2021-06-24 17:34:06 +00:00
Emma Anholt 6bc88c26b6 ci/turnip: Document create_instance_device_intentional_alloc_fail's fail.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>
2021-06-24 17:34:06 +00:00
Emma Anholt 55000408f9 turnip: Use vk_startup_errorf() in more startup paths.
This does the logging for you.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>
2021-06-24 17:34:06 +00:00
Emma Anholt 31f8b70481 turnip: Link more MRs and issues related to our xfails.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>
2021-06-24 17:34:06 +00:00
Emma Anholt 4b44e28526 freedreno/ir3: Report RA failure with mesa_loge().
This is a major failure that should never happen (if we had spilling
support), don't hide the log behind DEBUG builds.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11562>
2021-06-24 17:34:06 +00:00
Connor Abbott 078030973b ir3/ra: Fix corner case in collect handling
I ran into this when accidentally changing the scheduling order in the
hl2 trace.

Fixes: 0ffcb19 ("ir3: Rewrite register allocation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 3dc8c59858 ir3: Remove IR3_REG_DEST
This was needed because code iterating the regs array needed to know
what was a destination and what wasn't, but now we have separate srcs
and dsts arrays so it's not needed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott def96adaee ir3: Remove regs array
Now that everything is converted over, switch to separate src/dst
arrays.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 57aeef5c13 ir3/frontend: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 5785abb9ed ir3/opts: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 58fb0a01e1 ir3/validate: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 050ec77d1b ir3/print: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 1b4990eea6 ir3/legalize: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott abebc1f53f ir3/array_to_ssa: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott dd13081e03 ir3/parser: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott af48cfc06b ir3/ra: Switch to srcs/dsts arrays
RA was manually fiddling with regs to copy over the parallel copy code,
which has to be done in a different way, but if we switch this all over
at once it shouldn't be a problem.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott d3e08327cf ir3/core: Switch to srcs/dsts arrays
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 50994eeabf ir3/sched: Convert to srcs/dsts arrays
Also change the indexing in ir3_delayslots, so it's finally sane! To do
this we also have to change foreach_ssa_src_n to index srcs instead of
regs, so that the indexing stays in sync.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 132dfacdcb freedreno/tests: Convert to srcs/dsts
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott bff83fc42b freedreno/isa: Convert to srcs/dsts
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott db7814ad56 ir3: Add srcs/dsts arrays to ir3_instruction
Initially these will shadow regs, so that we can transition things
before getting rid of regs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 59b9935877 ir3/legalize: Construct branch properly
Don't just yeet stuff into regs without updating regs_count, etc. This
will break horribly during the transition otherwise.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott e93f15d4bc ir3: Add separate src/dst count in ir3_instr
srcs and dsts will be in separate arrays, so we need everything creating
it to give a separate source and dest max count.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 3071e2e933 ir3: Split ir3_reg_create() into ir3_{src,dst}_create()
Right now they are basically the same, but in the future they will
append to different arrays.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 9af795d9b9 ir3: Make ir3_instruction::address a normal register
This fixes an annoying mismatch in the indices between foreach_ssa_src_n
and ir3_delayslots(), and lets us remove a bunch of other special cases.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 2522f387a3 ir3: Add is_reg_special()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott dce680737d ir3: Validate that ir3_register::instr is correct
Catch the mistake fixed in the previous commit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott ef7bc4a2aa ir3: Update ir3_register::instr when cloning instructions
We happened to not clone any SSA instructions, but we will once address
instructions start counting as SSA. Fix this oversight.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott 0f329ba10a ir3: Split read-modify-write array dests in two
Instructions that operate on an array read the previous state of the
array, modify it, and write a new array, at least conceptually before
RA. Previously the same register specified the previous state and acted
as the new state, but this meant that it was both a source and
destination which meant that it was getting in the way of splitting up
sources and destinations. Break out the source into a separate register,
and use the new tied-src infrastructure to share code with a6xx atomics.
With this, there are basically no more special cases for arrays in RA.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Connor Abbott cc64945336 ir3: Make tied sources/destinations part of the IR
Previously this was hard-coded for a6xx atomic instructions. However
we'll need a way for array destinations to point to the source with the
previous value of the array when we split them up. This is conceptually
the same as tied source/destinations for a6xx atomics, except that array
writes sometimes won't have a previous value to point to. So move this
into the IR so that it can be more dynamic. As a bonus we can move the
knowledge of a6xx atomics out of RA, where it's out-of-place, and into
the a6xx-specific code that creates them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11469>
2021-06-23 17:20:29 +00:00
Matt Turner 85315f5fb1 freedreno/ci: Use TU_IGNORE_CONFORMANCE_WARNING to reduce warnings
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11543>
2021-06-23 07:07:42 +00:00
Matt Turner 205d6e582c tu: Provide a toggle to avoid warnings about unsupported devices
In the CI, we have such devices, and this message is printed many
hundreds of times. This results in a useless spam which makes it
difficult to see real issues.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11543>
2021-06-23 07:07:42 +00:00
Emma Anholt 58f5605124 freedreno: Handle full blit discards by invalidating the resource.
The previous implementation had several issues:

- It wasn't checking all the conditions necessary for "this blit updates
  the whole surface", like PIPE_MASK_Z but not S on a depth/stencil
  buffer.
- It would reset the previous batchbuffer, even if that batch had side
  effects on other buffers.
- The layering was painful to follow and made any recursion extra
  dangerous.

Now, we use a more conservative test (enough for the resource shadowing
case) and just invalidate the buffer up front, which should have the right
logic for discarding drawing to that resource.

I found I had to add fd_bc_flush_writer() to the end of fd_blitter_blit()
-- a flush was happening at fb state restore time when the discard flag
was set, and losing that flush breaks
dEQP-GLES31.functional.stencil_texturing.format.stencil_index8_cube.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11455>
2021-06-21 20:48:21 +00:00
Rob Clark 06ff0ae4bb freedreno: Flush if at risk of overflowing bos table
Fixes overflow crash in tex-miplevel-selection

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4007
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11487>
2021-06-21 18:45:23 +00:00
Rob Clark 5b4f670c1c freedreno/a6xx: Handle fb_read in sysmem path
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11487>
2021-06-21 18:45:23 +00:00
Rob Clark 1a1eabd7d8 freedreno/ci: Garbage collect some a630 flakes
Haven't seen these, at least since flake reporting switched to OFTC
channel (~1 month ago)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11487>
2021-06-21 18:45:23 +00:00
Rhys Perry ea68d4a676 nir/propagate_invariant: add invariant_prim option
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11035>
2021-06-21 15:13:05 +00:00
Rob Clark 1727adfbc5 freedreno/ci: Increase # of jobs for CI runners
The idea is that the tests will spend *some* time stalling waiting to
read back results from the GPU.  So use a # of jobs that is slightly
more than the # of CPUs to keep the CPUs more busy.

Locally this is dropping a bit more than a minute off a parallel
deqp-gles31 run, so turn it on across the board for a6xx.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11477>
2021-06-18 21:59:06 +00:00
Rob Clark fc00abe46c freedreno/ci: Start longest traces first
Shave off a bit of runtime on the CI job by starting the longer traces
first.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11477>
2021-06-18 21:59:06 +00:00
Emma Anholt caa5c5b12e freedreno/ir3: Move NIR printing to mesa_log.
Now we can get some NIR debug on Android.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9262>
2021-06-18 18:18:35 +00:00
Emma Anholt 88fe7ab4fa freedreno/ir3: Move the native code output to mesa_log as well.
I didn't feel like rewriting ir3_shader_disasm() off of FILE *s, so use
the same trick as the disasm_info path above to write to memory and then
hand the multi-line blob off to mesa_log.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9262>
2021-06-18 18:18:35 +00:00
Emma Anholt 9d458336c6 freedreno/ir3: Use mesa_log_stream() for ir3 disassembly.
This means you can get dumps on android, and output on Linux goes to
stderr.  However, this does mean that on Linux the output goes from
looking like:

AFTER: ir3_legalize:
block3276208368 {
	0000:0001:002: 	cov.u32s16 hr2.x, c2.x
	0000:0002:002: 	mov.u32u32 r0.x, c0.x
[...]

to:

MESA: info: AFTER: ir3_legalize:
MESA: info: block3405271904 {
MESA: info: 	0000:0001:002: 	cov.u32s16 hr2.x, c2.x
MESA: info: 	0000:0002:002: 	mov.u32u32 r0.x, c0.x
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9262>
2021-06-18 18:18:35 +00:00
Emma Anholt 3863008c22 freedreno/ir3: Move the assert output to mesa_loge().
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9262>
2021-06-18 18:18:35 +00:00
Emma Anholt 6bce24e214 freedreno: Add some cheza flakes from the last week.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11453>
2021-06-17 23:06:18 +00:00
Emma Anholt 8effbeeea6 freedreno/fdl: Give the tiling mode a nice name in debug dumps.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11452>
2021-06-17 22:47:51 +00:00
Connor Abbott e19f112435 ir3/ra: Fix array parallelcopy confusion
With array registers, there are two num's we care about:

1. The base num that the whole array starts at (->array.base)
2. The num that the instruction uses, plus possibly an indirect offset
   (->num or ->array.offset)

For parallel copies we always copy the whole array, so (2) is irrelevant
here. For phis and parallel copies inserted for phis, we used
assign_reg() which assigned ->array.base, but we forgot about this when
constructing our own parallel copies for live range splitting, just
setting ->num instead. The parallel copy lowering was also inconsistent
here, using ra_reg_get_num() (which looks at ->array.base for arrays)
for sources but looking at ->num directly for destinations. This makes
everything use ->array.base consistently.

While we're here, make sure to remove IR3_REG_SSA from liveout copies to
make sure printing works correctly.

Fixes: 0ffcb19 ("ir3: Rewrite register allocation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11422>
2021-06-16 22:45:13 +00:00
Connor Abbott 2c21dab36e ir3: Improve printing of array parallelcopies/phis
Normally something with IR3_REG_ARRAY doesn't have a register assigned,
but we keep IR3_REG_ARRAY for parallel copies after RA because we need
to know the appropriate size. We want to see the register assigned for
these when printing the RA result before parallel copies are lowered.
The register is in ->array.base in this case, so initialize it to
INVALID_REG and print ->array.base if it's been assigned to something,
similar to ->num in the normal case.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11422>
2021-06-16 22:45:13 +00:00
Mike Blumenkrantz a3a6611e96 util/queue: add a global data pointer for the queue object
this better enables object-specific (e.g., context) queues where the owner
of the queue will always be needed and various pointers will be passed in
for tasks

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11312>
2021-06-16 15:10:09 -04:00
Emma Anholt 591a3c738d freedreno: Be more strict about QUERY_AVAILABLE to simplify the code.
ARB_oq doesn't just say "polling in a loop will make it complete
eventually", it says "querying will make it complete in finite time."

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
2021-06-15 20:42:26 +00:00
Jonathan Marek cb1ddff350 freedreno/registers: define REG_DSI_CPHY_MODE_CTRL
For use by the kernel driver.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11381>
2021-06-15 12:42:57 -04:00
Daniel Stone a1e734a874 ci: Unify {BARE_METAL,LAVA}_TEST_SCRIPT environment
Should also probably never have been different.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Martin Peres <martin.peres@mupuf.org>
Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11337>
2021-06-15 14:02:44 +02:00
Daniel Stone 0d6dd44818 ci: Unify {BM,LAVA}_START_XORG environment
Why were they ever different ... ?

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Martin Peres <martin.peres@mupuf.org>
Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11337>
2021-06-15 14:02:44 +02:00
Hyunjun Ko 639579d116 turnip: Copy command buffers to deferred submit request
To make sure the index of global bo table in drm_msm_gem_submit_cmd is
valid at actual submit time.

v1. Move the entry_count calculation into the submit request creation
function.

Fixes: #4877
Fixes: 3f229e34 ("turnip: Implement VK_KHR_timeline_semaphore.")

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11260>
2021-06-15 02:16:21 +00:00
Emma Anholt e9f9de0d2a ci/deqp: Skip dEQP-VK.wsi.display.get_display_plane_capabilities
The flakiness of this test is due to CI running deqp in parallel, rather
than exposing any underlying driver issue.  Just skip it in CI until we
come up with a reasonable way to handle tests to be run in isolation
during a deqp-runner run (likely as part of
https://gitlab.freedesktop.org/anholt/deqp-runner/-/issues/7).

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11333>
2021-06-14 12:09:19 -07:00
Emma Anholt 9cc1f08919 ci/deqp: Skip flush_finish on all CI jobs.
They're too slow to run in CI even on non-tiled renderers, they don't
block conformance (unless you crash), and provide unreliable warning
results unless you isolate them from other activity on the system.

This means that the following jobs now skip these tests:

- deqp-iris-*
- deqp-llvmpipe (you know, the one mentioned in the comment!)
- deqp-virgl-gl
- deqp-zink-lvp

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11333>
2021-06-14 12:09:19 -07:00
Emma Anholt e8ca9b99cb ci/deqp: Drop stress/perf skips lists.
The mustpass doesn't have any tests matching these, so no need to
skip. These tests only show up if you run without using a mustpass list.

Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11333>
2021-06-14 12:09:19 -07:00
Alexander Monakov 11da35d86d freedreno/drm-shim: keep GEM buffers page-aligned
Trying to run turnip under drm-shim reveals that pretended device
offsets are not sufficiently aligned, failing this assert in tu_pipeline.c:

   /* emit program binary & private memory layout
    * binary_iova should be aligned to 1 instrlen unit (128 bytes)
    */

   assert((binary_iova & 0x7f) == 0);

Round up BO size to 4096 in msm_ioctl_gem_new to avoid this (the kernel
aligns to page size).

Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11331>
2021-06-14 17:30:01 +00:00
Alexander Monakov a5e4fc3ff5 freedreno/drm-shim: pretend to offer DRM 1.6.0
turnip's DRM device interface requires version 1.6 (for SYNCOBJ).
To unblock use of turnip over drm-shim, raise shim's version to 1.6.
This allows to see shader disassembly, while submission fails with

DRM_SHIM: unhandled core DRM ioctl 0xC4 (0xc01064c4)
TU: error: DRM_IOCTL_SYNCOBJ_RESET failure: Invalid argument

Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11331>
2021-06-14 17:30:01 +00:00
Hyunjun Ko 1a773c0009 turnip: add missing VKAPI_ATTR/CALL
Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11099>
2021-06-14 02:01:57 +00:00
Rob Clark 2964f32cc9 freedreno/a6xx: Fix r16_snorm blits
The .NORM bit doesn't seem to do what we think or want.. tu also doesn't
set it, and things seem to work out better when we don't.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11343>
2021-06-13 19:10:08 +00:00
Rob Clark 476f86fcb2 freedreno/registers: add A5XX_RBBM_STATUS3 bit
Same bit as a6xx.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11311>
2021-06-11 01:47:22 +00:00
Emma Anholt ea25090aab ci/freedreno: Enable running all of piglit_gl for a530's manual test.
Otherwise the xfails will end up stale after piglit uprevs that change the
test set.

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11283>
2021-06-10 23:45:36 +00:00
Connor Abbott c88eb66814 ir3: Copy propagate immed/const to meta instructions
This is allowed with the new RA, and makes a huge difference in
preventing extra moves when preferential coloring doesn't work.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott a61a9cd65d ir3: Insert output collects in the main shader
We were inserting them in what was NIR's end block with the "end"
instruction, which meant that the moves they generated couldn't be
scheduled with the rest of the last block as part of post-RA scheduling.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott fa17295ebd ir3: Add simple CSE pass
RA currently can't handle a live value that's part of a vector and
introduces extra copies. This was espeically a problem for bary.f, where
the bary coords were being split and repeatedly re-collected. But this
could be a problem in other situations as well.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott b1a1de76e8 ir3/sched: Consider unused destinations when computing live effect
If an instruction's destination is unused, then we shouldn't penalize
it. For example, this helps us schedule atomic operations whose results
aren't read. This works around RA failures when CSE is enabled in some
robustness2 tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott ba8efeb7fa ir3/sched: Make collects count against tex/sfu limits
In a scenario where there are a lot of texture fetches with constant
coordinates, this prevents the scheduler from scheduling all the setup
instructions after the first group of textures has been scheduled
because they are the only non-syncing thing and scheduling them didn't
decrease tex_delay. Collects with immed/const sources will turn into
moves of those sources, so we should treat them the same.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott 8b15c2f30c ir3/sched: Don't schedule collect early
I don't think there was ever a good reason to do this, but when we start
folding constants/immediates into collect, this can become actively
harmful.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott 27593cb241 ir3: Remove right and left copy prop restrictions
This is leftover from the old RA, and inhibits copy propagation
unnecessarily with the new RA.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott 2f51379d03 ir3/ra: Add a validation pass
This helps catch tricky-to-debug bugs in RA, or helps rule them out.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott 0ffcb19b9d ir3: Rewrite register allocation
Switch to the new SSA-based register allocator.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott df9f41cc02 ir3: Expose occupancy calculation functions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:06 -07:00
Connor Abbott 3ac743c333 ir3: Add pass to lower arrays to SSA
This will be run right after nir->ir3. Even though we have SSA coming
out of NIR, we still need it for NIR registers, even though we keep the
original array around to insert false dependencies.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:24:04 -07:00
Connor Abbott d4b5a550ed ir3: Add dominance infrastructure
Mostly lifted from nir.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott 1f3546c9e2 ir3: Remove unused check_src_cond()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott c0789395e0 ir3/postsched: Don't use SSA source information
This was only used for calculating if a source is a tex or SFU
instruction, which is easily replacable. It's going away with the new
RA.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott c947475533 ir3/delay: Delete pre-RA repeat handling
It looks likely that any implementation of (rptN) in ir3 will have to
actually create (rptN) instructions after RA, which means that this can
be dropped.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott 58d82add87 ir3: Rewrite delay calculation
The old delay calculation relied on the SSA information staying around,
and wouldn't work once we start introducing phi nodes and making
"normal" values defined in multiple blocks not array regs anymore.
What's worse is that properly inserting phi nodes when splitting live
ranges would make that code even more complicated, and this was the last
place post-RA that actually needed that information.

The new version only compares the physical registers of sources and
destinations. It works by going backwards up to a maximum number of
cycles, so it might be slightly slower when the definition is closer but
should be faster when it is farther away.

To avoid complicating the new method, the old method is kept around, but
only for pre-RA scheduling and it can therefore be drastically
simplified as the array case can be dropped.

ir3_delay_calc() is split into a few variants to avoid an explosion of
boolean arguments in users, especially now that merged_regs now has to
be passed to it.

The new method is a little more complicated when it comes to handling
(rptN), because both the assigner and consumer may be (rptN). This adds
some unit tests for those cases, in addition to dropping the to-SSA code
in the test harness since it's no longer needed.

Finally, ir3_legalize has to be switched to using physical registers for
the branch condition. This was the one place where IR3_REG_SSA remained
after RA.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott c0823a2d31 ir3: Make branch conditions non-SSA
In particular, make sure they have a physreg assigned. This was the last
place after RA where SSA registers were created, which won't work with
the new post-RA delay calculation that relies on the physreg.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott fc7402b4cf ir3: Add reg_elems(), reg_elem_size(), and reg_size()
For working with registers in units of half-regs in the new RA.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott 890de1a436 ir3/delay: Fix full->half and half->full delay
The current compiler never does this, but the new compiler will start to
in mergeregs mode. There is an extra penalty for this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott 9ad83f51eb ir3: Add ir3_register::array.base
There were two different approaches I saw in the post-RA code for
figuring out what regiser range a relative access touched:

1. Use reg->array.offset and reg->array.size. This is wrong in case
   reg->array.offset was non-zero before RA, because array.size is
   the size of the whole array and array.offset has the const offset
   within the array baked in.
2. Lookup the array from the array ID and use the base + range there.
   This is correct, but won't work with the new RA, where an array might
   not always be assigned to the same register.

This replaces both methods with a new ir3_register::array.base field,
and switches all the users I could find to it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott 939ee6966f ir3: Improve register printing for SSA
Print the ssa name for array destinations, and handle printing undef SSA
sources.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott edf23e15eb ir3: Prepare for instructions with multiple destinations
To simplify the pre-RA merge set code and express the result live-range
splitting in RA, we need to add support for parallel copy instructions,
and for the merge set code these parallel copies need to be in SSA form.
Parallel copies have multiple destinations by necessity, but there was
no way to express this in the existing IR. In particular there was no
support for marking a register as being a destination, and no support
for indicating which destination register out of several an SSA source
refers to. This replaces ir3_register::instr with ir3_register::def and
re-purposes ir3_register::instr. I haven't propagated this into common
helpers, like ssa(), because that would vastly increase the amount of
churn and the number of places that produce such instructions should be
limited -- only RA will create parallel copies and they will be
destroyed right after RA. In the future swz will have multiple
destinations too, but it will only be created after RA via parallel copy
lowering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott e1d7240576 ir3: Readd support for translating NIR phi nodes
This is roughly based on the support removed a while ago, but it handles
sources better by associating each source with a predecessor block.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott 0ef021be4a ir3: Add ir3_start_block()
Name based on nir_start_block(). A number of places were already
open-coding this, convert them.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Connor Abbott ef4e07a1a2 ir3: Introduce phi and parallelcopy instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>
2021-06-10 12:20:38 -07:00
Rob Clark 3f758afe6a freedreno: Fix fdperf flush
We created and initialized the fence, but forgot to pass it to
fd_submit_flush().

Fixes: aafcd8aacb ("freedreno: Re-work fd_submit fence interface")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11200>
2021-06-09 19:08:53 -07:00
Rob Clark 09f64f74db freedreno/ir3: Fix use after free
If the tex/sfu ssa src is from a different block than the one currently
being scheduled, we do not have a valid sched-node.  So fallback to
previous behavior rather than dereference an invalid ptr.

Fixes: 7821e5a3f8 ("ir3/sched: Don't penalize uses of already-waited tex/SFU")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10306>
2021-06-09 00:37:15 +00:00
Caio Marcelo de Oliveira Filho 8af6766062 nir: Move workgroup_size and workgroup_variable_size into common shader_info
Move it out the "cs" sub-struct, since these will be used for other
shader stages in the future.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11225>
2021-06-08 09:23:55 -07:00
Rhys Perry 1cbcfb8b38 nir, nir/algebraic: add byte/word insertion instructions
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3151>
2021-06-08 08:57:42 +00:00
Caio Marcelo de Oliveira Filho c8a7bd0dc8 nir: Rename WORK_GROUP (and similar) to WORKGROUP
Be consistent with other usages in Vulkan and SPIR-V, and the recently
added workgroup_size field.

Acked-by: Emma Anholt <emma@anholt.net>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190>
2021-06-07 22:34:42 +00:00
Caio Marcelo de Oliveira Filho a71a780598 nir: Rename nir_intrinsic_load_local_group_size to nir_intrinsic_load_workgroup_size
Acked-by: Emma Anholt <emma@anholt.net>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190>
2021-06-07 22:34:42 +00:00
Caio Marcelo de Oliveira Filho 430d2206da compiler: Rename local_size to workgroup_size
Acked-by: Emma Anholt <emma@anholt.net>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190>
2021-06-07 22:34:42 +00:00
Dmitry Baryshkov cac88b5f06 freedreno/regs: split old/not used phy registers to separate DB
In order to simplify main DSI host database, split away phy register
definitions used on DSI v2 hosts to the separate database file.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11075>
2021-06-05 19:20:50 +00:00
Eric Anholt 95d41a3525 ra: Use struct ra_class in the public API.
All these unsigned ints are awful to keep track of.  Use pointers so we
get some type checking.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9437>
2021-06-04 19:08:57 +00:00
Danylo Piliaiev 20d8324a1b turnip: implement VK_EXT_provoking_vertex
Passes: dEQP-VK.rasterization.provoking_vertex.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11112>
2021-06-04 14:37:01 +00:00
Hyunjun Ko 41eaa07823 turnip/kgsl: Fix to build on android.
Fixes: 3f229e34 ("turnip: Implement VK_KHR_timeline_semaphore.")

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11153>
2021-06-03 08:55:06 +00:00
Chia-I Wu 3ba3681b58 tu: use vk_default_allocator
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>
2021-06-03 08:13:26 +00:00
Emma Anholt d3e419f9d8 ci/freedreno: Add some more known flakes from recent marge runs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11144>
2021-06-03 03:07:35 +00:00
Danylo Piliaiev b71e27ea84 turnip: fix register_index calculations of xfb outputs
nir_assign_io_var_locations() does not use outputs_written when
assigning driver locations. Use driver_location to avoid incorrectly
guessing what locations it assigned.

Copied from lavapipe 8731a1beb7

Will fix provoking vertex tf tests when VK_EXT_provoking_vertex
would be enabled:
 dEQP-VK.rasterization.provoking_vertex.transform_feedback.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11111>
2021-06-02 23:55:00 +00:00
Danylo Piliaiev 551d7fddfb turnip: emit vb stride dynamic state when it is dirty
Due to incorrect condition we never emitted vb stride
if state was dynamically set.

Fixes vertex explosion with Zink.

See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4738

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11133>
2021-06-02 21:38:19 +00:00
Danylo Piliaiev 74aa09b22c turnip: reset push descriptor set on command buffer reset
Otherwise it will store a pointer to already unmapped memory which
could lead to a crash in tu_CmdPushDescriptorSetWithTemplateKHR since
it tries to copy data from the old memory.

Fixes a crash with Zink's new lazy descriptor manager instroduced
in bfdd1d8d

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11137>
2021-06-02 16:01:40 +00:00
Matt Turner 09935c0dde freedreno/afuc: Print uintptr_t with PRIxPTR
Fixes a compilation error on 32-bit.

Fixes: bba61cef38 ("freedreno/afuc: Add emulator mode to afuc-disasm")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11118>
2021-06-02 03:57:20 +00:00
Tomeu Vizoso bc50a16103 Revert "ci/freedreno: Skip Portal 2 trace on a630, due to flakiness"
This reverts commit e381bc0e67.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11058>
2021-06-01 08:50:45 +02:00
Rob Clark 3dff0c30cf freedreno/headergen2: Fix compile warnings with CP_DRAW_INDIRECT_MULTI
Using stripes to deal with the different packet layout variants resulted
in redefining "register" offsets with different values, so use "prefix"
to add a suffix to disambiguate.

  drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h:1066: warning: "REG_A6XX_CP_DRAW_INDIRECT_MULTI_INDIRECT" redefined
   1066 | #define REG_A6XX_CP_DRAW_INDIRECT_MULTI_INDIRECT  0x00000006
        |
  drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h:1057: note: this is the location of the previous definition
   1057 | #define REG_A6XX_CP_DRAW_INDIRECT_MULTI_INDIRECT  0x00000003
        |

(Admittedly it isn't really a "prefix" but that was the field in the
schema available to use, and REG_INDEXED_CP_DRAW_INDIRECT_MULTI_STRIDE
sounds somewhat more funny.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark ff5e17f1f8 freedreno/afuc: Use emulator to extract jmptbl
This runs through the SQE bootstrap code to extract the packet-table,
rather than relying on heuristics.  As a bonus, it can detect the start
of the LPAC fw in a660+ fw so that we can properly decode the LPAC fw
and packet-table.

Note that this decodes the jmptable as normal instructions, which is a
change in behavior from the previous heuristic based jmptbl extraction.
Not sure if that is a good or bad thing.

For a5xx, for now the legacy heuristic based jmptable decoding is
preserved, at least until enough control regs are figured out.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 2beb5b015a freedreno/ci: Add real packet-table loading for afuc test
When we start running the bootstrap code thru the emulator we will need
the packet-table loading to actually happen.  So add this.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark df14af6480 freedreno/afuc: Add emulator support to run bootstrap
Run until the packet-table is populated, so the disassembler can use
this to know the offsets of various pm4 packet handlers without having
to rely on heuristics.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark ea2e244198 freedreno/afuc: Split out helpers to parse labels and packet-table
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 9a4ca194e8 freedreno/afuc: Extract full gpu-id
Some of the a6xx gens will require some control reg initialization, and
go into an infinite loop if they don't see the values they expect, so
we'll need to extract the compute gpu-id.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark c2f8c98d56 freedreno/registers: Add a few a6xx regs and notes
A few things I noticed while playing with the emulator.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark bba61cef38 freedreno/afuc: Add emulator mode to afuc-disasm
This is an (at least somewhat complete) logical emulator of the a6xx SQE
that lets us step through firmware execution (bootstrap, cmdstream pkt
handling, etc).  It lets us poke at various fw visible state and run
through pm4 packet(s) to better understand what the fw is doing when it
handles various packets.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00
Rob Clark 745dad0446 freedreno/afuc: Add pipe reg name decoding
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10944>
2021-05-31 23:34:43 +00:00