[Mesa-dev] [PATCH 00/13] panfrost/midgard: RA improvements (esp. RA)

2019-05-25 Thread Alyssa Rosenzweig
This fairly-lengthy series is focused on improving the register allocator and by extension the performance of the generated code. Meanwhile, we cleanup the compiler, refactoring as we go, driven by the overall arc of the RA improvements. I was particularly motivated by the concerns raised by compil

[Mesa-dev] [PATCH 01/13] panfrost/midgard: Remove pinning

2019-05-25 Thread Alyssa Rosenzweig
This mechanism is only used by blend shaders, so just use a move here. Ideally, it'll be copy-propped and DCE'd away; this removes a source of considerable indirection and will simplify RA logic. Signed-off-by: Alyssa Rosenzweig --- .../panfrost/midgard/midgard_compile.c| 19 ++--

[Mesa-dev] [PATCH 09/13] panfrost/midgard: Add MIR helpers

2019-05-25 Thread Alyssa Rosenzweig
In addition to commonizing some related utilities, this adds new MIR helper functions relevant to passes including pipeline register creation. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/meson.build | 1 + .../drivers/panfrost/midgard/compiler.h | 19 ++- ..

[Mesa-dev] [PATCH 13/13] panfrost/midgard: .pos propagation

2019-05-25 Thread Alyssa Rosenzweig
A previous optimization converts fmax(x, 0.0) instructions to fmov.pos. This pass then propagates the .pos from the move up to the source instruction (when possible). From there, copy propagation will eliminate the move. Signed-off-by: Alyssa Rosenzweig --- .../panfrost/midgard/midgard_compile.c

[Mesa-dev] [PATCH 04/13] panfrost/midgard: Fix liveness analysis bugs

2019-05-25 Thread Alyssa Rosenzweig
This fixes liveness analysis with respect to inline constants and branching. Signed-off-by: Alyssa Rosenzweig --- .../drivers/panfrost/midgard/midgard_liveness.c| 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/panfrost/midgard/midgard_liv

[Mesa-dev] [PATCH 12/13] panfrost/midgard: Remove r0 scheduling code

2019-05-25 Thread Alyssa Rosenzweig
This code needs to be rewritten to be RA-agnostic, but until register pinning is setup the right way for fragment output it's broken dead code; remove it. Signed-off-by: Alyssa Rosenzweig --- .../panfrost/midgard/midgard_schedule.c | 82 +++ 1 file changed, 12 insertions(+)

[Mesa-dev] [PATCH 10/13] panfrost/midgard: Implement "pipeline register" prepass

2019-05-25 Thread Alyssa Rosenzweig
This prepass, run after scheduling but before RA, specializes to pipeline registers where possible. It walks the IR, checking whether sources are ever used outside of the immediate bundle in which they are written. If they are not, they are rewritten to a pipeline register (r24 or r25), valid only

[Mesa-dev] [PATCH 06/13] panfrost/midgard: Extend RA to non-vec4 sources

2019-05-25 Thread Alyssa Rosenzweig
This represents a major upgrade to the RA. We now use conflicting register classes to represent the subdivision of Midgard's 128-bit registers into varying sizes and arrangement. We determine class based on the number of components in the instructions' masks. To support this, we include a number of

[Mesa-dev] [PATCH 07/13] panfrost/midgard: Misc. cleanup for readibility

2019-05-25 Thread Alyssa Rosenzweig
Mostly, this fixes a number of instances of lines >> 80 chars, refactoring them into something legible. Signed-off-by: Alyssa Rosenzweig --- .../drivers/panfrost/midgard/compiler.h | 38 +++ .../panfrost/midgard/midgard_compile.c| 12 ++--- .../drivers/panfrost/midgard/

[Mesa-dev] [PATCH 02/13] panfrost/midgard: Share some utility functions

2019-05-25 Thread Alyssa Rosenzweig
These were static to midgard_compile.c but are more generally useful across the compiler; move them to common Midgard code. Signed-off-by: Alyssa Rosenzweig --- .../drivers/panfrost/midgard/compiler.h | 46 .../drivers/panfrost/midgard/helpers.h| 50 + .../panfro

[Mesa-dev] [PATCH 11/13] panfrost/midgard: Cleanup copy propagation

2019-05-25 Thread Alyssa Rosenzweig
Use the new MIR helpers to cleanup this pass. Signed-off-by: Alyssa Rosenzweig --- .../drivers/panfrost/midgard/midgard_compile.c| 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/

[Mesa-dev] [PATCH 08/13] panfrost/midgard: Refactor schedule/emit pipeline

2019-05-25 Thread Alyssa Rosenzweig
First, this moves the scheduler and emitter out of midgard_compile.c into their own dedicated files. More interestingly, this slims down midgard_bundle to be essentially an array of _pointers_ to midgard_instructions (plus some bundling metadata), rather than the instructions and packing themselve

[Mesa-dev] [PATCH 03/13] panfrost/midgard: Set int outmod for "pasted" code

2019-05-25 Thread Alyssa Rosenzweig
These snippets of integer assembly are injected for various purposes (where we cannot express it yet in pure NIR), but we need to make sure they are int modded too. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/midgard/midgard_compile.c | 4 1 file changed, 4 insertions(

[Mesa-dev] [PATCH 05/13] panfrost/midgard: Set masks on ld_vary

2019-05-25 Thread Alyssa Rosenzweig
These masks distinguish scalar/vec2/vec3 loads from the default vec4, which helps with assembly readability and will enable smarter RA. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/midgard/midgard_compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

[Mesa-dev] [PATCH v2 1/2] nir/algebraic: Simplify max(abs(a), 0.0) -> abs(a)

2019-05-25 Thread Alyssa Rosenzweig
I noticed this pattern in glmark's jellyfish scene. v2: Add inexact qualifier to avoid changing NaN behaviour I would appreciate if someone did a shader-db run. Signed-off-by: Alyssa Rosenzweig Cc: Ilia Mirkin Cc: Ian Romanick Cc: Elie Tournier --- src/compiler/nir/nir_opt_algebraic.py | 1

[Mesa-dev] [PATCH] panfrost: Don't flip scanout

2019-05-25 Thread Alyssa Rosenzweig
The mesa/st flips the viewport, so we respect that rather than trying to flip the framebuffer itself and ignoring the viewport and using a messy heuristic. However, this brings an underlying disagreement about the interpretation of winding order to light. The blob uses a different strategy than Me

Re: [Mesa-dev] [PATCH] list: add some iterator debug

2019-05-25 Thread Rob Clark
This ends up embedded in a for loop expression, ie. the C part in an for (A;B;C) iirc, that means it needs to be a C expr rather than statement.. or something roughly like that, I'm too lazy to dig out my C grammar BR, -R On Sat, May 25, 2019 at 3:39 PM Ilia Mirkin wrote: > > Why not just do i

Re: [Mesa-dev] [PATCH] list: add some iterator debug

2019-05-25 Thread Ilia Mirkin
Why not just do it in a way that works for everyone? Both the do/while method and the ifdef-based method that I suggested work everywhere. Or is there another reason you prefer to use those statement expressions? On Sat, May 25, 2019 at 6:21 PM Rob Clark wrote: > > Is there a convenient #ifdef I

Re: [Mesa-dev] [PATCH] list: add some iterator debug

2019-05-25 Thread Rob Clark
Is there a convenient #ifdef I can use to guard the list_assert() macro.. I don't really mind if MSVC can't have this, but would rather not let it prevent the rest of us from having nice things BR, -R On Sat, May 25, 2019 at 1:23 PM Jason Ekstrand wrote: > > Yeah, that's a GNU extension. It als

Re: [Mesa-dev] [PATCH] list: add some iterator debug

2019-05-25 Thread Jason Ekstrand
Yeah, that's a GNU extension. It also works in clang but not MSVC which is used to build NIR. On May 25, 2019 13:30:29 Rob Clark wrote: On Sat, May 25, 2019 at 11:13 AM Ilia Mirkin wrote: On Sat, May 25, 2019 at 2:03 PM Rob Clark wrote: > > From: Rob Clark > > Debugging use of unsafe ite

Re: [Mesa-dev] [PATCH] list: add some iterator debug

2019-05-25 Thread Rob Clark
On Sat, May 25, 2019 at 11:13 AM Ilia Mirkin wrote: > > On Sat, May 25, 2019 at 2:03 PM Rob Clark wrote: > > > > From: Rob Clark > > > > Debugging use of unsafe iterators when you should have used the _safe > > version sucks. Add some DEBUG build support to catch and assert if > > someone does

Re: [Mesa-dev] [PATCH] list: add some iterator debug

2019-05-25 Thread Ilia Mirkin
On Sat, May 25, 2019 at 2:03 PM Rob Clark wrote: > > From: Rob Clark > > Debugging use of unsafe iterators when you should have used the _safe > version sucks. Add some DEBUG build support to catch and assert if > someone does that. > > I didn't update the UPPERCASE verions of the iterators. Th

[Mesa-dev] [PATCH] list: add some iterator debug

2019-05-25 Thread Rob Clark
From: Rob Clark Debugging use of unsafe iterators when you should have used the _safe version sucks. Add some DEBUG build support to catch and assert if someone does that. I didn't update the UPPERCASE verions of the iterators. They should probably be deprecated/removed. Signed-off-by: Rob Cl