[Mesa-dev] [PATCH 01/30] pan/midgard: Add missing parans in SWIZZLE definition

2019-09-28 Thread Alyssa Rosenzweig
TODO: Move me to front of series. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h index ac58fd50327..343fad0fea8 100644 --- a/src/panfrost/midga

[Mesa-dev] [PATCH 10/30] pan/midgard: Add mir_schedule_texture/ldst/alu helpers

2019-09-28 Thread Alyssa Rosenzweig
We don't actually do any scheduling here yet, but add per-tag helpers to consume an instruction, print it, pop it off the worklist. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 190 1 file changed, 190 insertions(+) diff --git a/src/pan

[Mesa-dev] [PATCH 06/30] pan/midgard: Initialize worklist

2019-09-28 Thread Alyssa Rosenzweig
This flows naturally from the dependency graph Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 17 + 1 file changed, 17 insertions(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 70fa030390c.

[Mesa-dev] [PATCH 09/30] pan/midgard: Add mir_choose_bundle helper

2019-09-28 Thread Alyssa Rosenzweig
It's not always obvious what the optimal bundle type should be. Let's break out the logic to decide. Currently set for purely in-order operation. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 25 + 1 file changed, 25 insertions(+) diff -

[Mesa-dev] [PATCH 07/30] pan/midgard: Add mir_choose_instruction stub

2019-09-28 Thread Alyssa Rosenzweig
In the future, this routine will implement the core scheduling logic to decide which instruction out of the worklist will be scheduled next, in a way that minimizes cycle count and register pressure. In the present, we are more interested in replicating in-order scheduling with the much-more-power

[Mesa-dev] [PATCH 03/30] pan/midgard: Squeeze indices before scheduling

2019-09-28 Thread Alyssa Rosenzweig
This allows node_count to be correct while scheduling. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index b8d9b5ec9be..2ed25da2e0

[Mesa-dev] [PATCH 08/30] pan/midgard: Add mir_update_worklist helper

2019-09-28 Thread Alyssa Rosenzweig
After we've chosen an instruction, popped it off, and processed it, it's time to update the worklist, removing that instruction from the dependency graph to allow its dependents to be put onto the worklist. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 39 +++

[Mesa-dev] [PATCH 13/30] pan/midgard: Add predicate->exclude

2019-09-28 Thread Alyssa Rosenzweig
A bit of a kludge but allows setting an implicit dependency of synthetic conditional moves on the actual condition, fixing code generated like: vmul.feq r0, .. sadd.imov r31, .., r0 vadd.fcsel [...] The imov runs simultaneous with feq so it gets garbage results, but it's too late to add

[Mesa-dev] [PATCH 14/30] pan/midgard: Implement predicate->unit

2019-09-28 Thread Alyssa Rosenzweig
This allows ALUs to select for each unit of the bundle separately. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 4c

[Mesa-dev] [PATCH 11/30] pan/midgard: Remove csel constant unit force

2019-09-28 Thread Alyssa Rosenzweig
Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_compile.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 585591d9356..95ec48e9563 100644 --- a/src/panfrost/midgard/midgard_compile.c +++

[Mesa-dev] [PATCH 12/30] pan/midgard: Add constant intersection filters

2019-09-28 Thread Alyssa Rosenzweig
In the future, we will want to keep track of which components of constants of various sizes correspond to which parts of the bundle constants, like in the old scheduler. For now, let's just stub it out for a simple rule of one instruction with embedded constants per bundle. We can eventually do bet

[Mesa-dev] [PATCH 19/30] pan/midgard: Add distance metric to choose_instruction

2019-09-28 Thread Alyssa Rosenzweig
We require chosen instructions to be "close", to avoid ballooning register pressure. This is a kludge that will go away once we have proper liveness tracking in the scheduler, but for now it prevents a lot of needless spilling. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_sc

[Mesa-dev] [PATCH 18/30] pan/midgard: Add mir_choose_alu helper

2019-09-28 Thread Alyssa Rosenzweig
Based on a given unit. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 24 1 file changed, 24 insertions(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index e2641ea0180..dea8b023e9d 1006

[Mesa-dev] [PATCH 15/30] pan/midgard: Add helpers for scheduling conditionals

2019-09-28 Thread Alyssa Rosenzweig
Conditional instructions (csel and conditional branches) require their condition to be written to a special condition pipeline register (r31.w for scalar, r31.xyzw for vector). However, pipeline registers are live only for the duration of a single bundle. As such, the logic to schedule conditionals

[Mesa-dev] [PATCH 05/30] pan/midgard: Calculate dependency graph

2019-09-28 Thread Alyssa Rosenzweig
Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 10 ++ src/panfrost/midgard/midgard_schedule.c | 121 2 files changed, 131 insertions(+) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 8612bab7686..780e

[Mesa-dev] [PATCH 22/30] pan/midgard: Extend choose_instruction for scalar units

2019-09-28 Thread Alyssa Rosenzweig
Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 4 1 file changed, 4 insertions(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index e71f65f6004..094451ceb9d 100644 --- a/src/panfrost/midgard/midgard_schedule

[Mesa-dev] [PATCH 16/30] pan/midgard: Extend csel_swizzle to branches

2019-09-28 Thread Alyssa Rosenzweig
Conditions for branches don't have a swizzle explicitly in the emitted binary, but they do implicitly get swizzled in whatever instruction wrote r31, so we need to handle that. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h| 4 ++-- src/panfrost/midgard/midgard_comp

[Mesa-dev] [PATCH 20/30] pan/midgard: Use new scheduler

2019-09-28 Thread Alyssa Rosenzweig
We still emit in-order but we switch to using the bundles created from the new scheduler, which will allow greater flexibility and room for out-of-order optimization. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 6 - src/panfrost/midgard/midgard_compile.c | 1

[Mesa-dev] [PATCH 26/30] pan/midgard: Allow writeout to see into the future

2019-09-28 Thread Alyssa Rosenzweig
If an instruction could be scheduled to vmul to satisfy the writeout conditions, let's do that and save an instruction+cycle per fragment shader. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 41 - 1 file changed, 40 insertions(+), 1 delet

[Mesa-dev] [PATCH 17/30] pan/midgard: Implement load/store pairing

2019-09-28 Thread Alyssa Rosenzweig
We can bundle two load/store together. This eliminates the need for explicit load/store pairing in a prepass, as well. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 67 + 1 file changed, 12 insertions(+), 55 deletions(-) diff --git a/src/

[Mesa-dev] [PATCH 02/30] pan/midgard: Fix component count handling for ldst

2019-09-28 Thread Alyssa Rosenzweig
It's not based on the writemask and it can't be inferred; it's just intrinsic to the op itself. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/helpers.h | 15 +++-- src/panfrost/midgard/mir.c | 59 ++ 2 files changed, 37 insertions(+), 37 deleti

[Mesa-dev] [PATCH 21/30] pan/midgard: Don't double check SCALAR units

2019-09-28 Thread Alyssa Rosenzweig
Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 4 1 file changed, 4 deletions(-) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index f883830cf86..e71f65f6004 100644 --- a/src/panfrost/midgard/midgard_schedule.

[Mesa-dev] [PATCH 04/30] pan/midgard: Add flatten_mir helper

2019-09-28 Thread Alyssa Rosenzweig
We would like to flatten a linked list of midgard_instructions into an array of midgard_instruction pointers on the heap. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/src/panfrost/midgard/

[Mesa-dev] [PATCH 00/30] pan/midgard: Implement out-of-order scheduler

2019-09-28 Thread Alyssa Rosenzweig
For each block, we compute an instruction dependency graph, which allows us to maintain a worklist of instructions able to be scheduled (no dependencies). We traverse this graph backwards, emitting instructions backwards and reversing the block at the end, to allow conditionals and writeout to be e

[Mesa-dev] [PATCH 24/30] pan/midgard: Only one conditional per bundle allowed

2019-09-28 Thread Alyssa Rosenzweig
There's no r32 to save ya after you use up r31 :) Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 16 1 file changed, 16 insertions(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 5f271608a3

[Mesa-dev] [PATCH 23/30] pan/midgard: Schedule to smul/sadd

2019-09-28 Thread Alyssa Rosenzweig
Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index 094451ceb9d..5f271608a30 100644 --- a/src/panfrost/midgard/midgard_schedul

[Mesa-dev] [PATCH 28/30] pan/midgard: Add mir_flip helper

2019-09-28 Thread Alyssa Rosenzweig
Useful for various operations on both commutative and anticommutative ops. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 1 + src/panfrost/midgard/midgard_opt_invert.c | 13 +++-- src/panfrost/midgard/mir.c| 17 + 3 file

[Mesa-dev] [PATCH 25/30] pan/midgard: Allow 6 instructions per bundle

2019-09-28 Thread Alyssa Rosenzweig
We never had a scheduler good enough to hit this case before! :) Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index cf943ea6995..cb7d

[Mesa-dev] [PATCH 29/30] pan/midgard: Add csel invert optimization

2019-09-28 Thread Alyssa Rosenzweig
Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 1 + src/panfrost/midgard/midgard_compile.c| 1 + src/panfrost/midgard/midgard_opt_invert.c | 25 +++ 3 files changed, 27 insertions(+) diff --git a/src/panfrost/midgard/compiler.h b/src/pa

[Mesa-dev] [PATCH 27/30] pan/midgard: Tightly pack 32-bit constants

2019-09-28 Thread Alyssa Rosenzweig
If we can reuse constant slots from other instructions, we would like to do so to include more instructions per bundle. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 129 +--- 1 file changed, 113 insertions(+), 16 deletions(-) diff --git a/sr

[Mesa-dev] [PATCH 30/30] pan/midgard: Allow scheduling conditions with constants

2019-09-28 Thread Alyssa Rosenzweig
Now that we have constant adjustment logic abstracted, we can do this safely. Along with the csel inversion patch, this allows many more common csel ops to inline their condition in the bundle. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/midgard_schedule.c | 14 ++ 1 fi