Re: [Mesa-dev] [PATCH 01/12] nir: Get rid of function overloads

2015-12-26 Thread Kenneth Graunke
On Saturday, December 26, 2015 11:09:24 AM PST Jason Ekstrand wrote: > When Connor originally drafted NIR, he copied the same function+overload > system that GLSL IR had with a few names changed. However, this > double-indirection is not really needed and has only served to confuse > people. Inst

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Jason Ekstrand
On Dec 26, 2015 8:15 PM, "Connor Abbott" wrote: > > On Sat, Dec 26, 2015 at 9:55 PM, Jason Ekstrand wrote: > > > > > > On Sat, Dec 26, 2015 at 5:15 PM, Jason Ekstrand > > wrote: > >> > >> > >> > >> On Sat, Dec 26, 2015 at 4:59 PM, Connor Abbott > >> wrote: > >>> > >>> On Sat, Dec 26, 2015 at 7:

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Connor Abbott
On Sat, Dec 26, 2015 at 9:55 PM, Jason Ekstrand wrote: > > > On Sat, Dec 26, 2015 at 5:15 PM, Jason Ekstrand > wrote: >> >> >> >> On Sat, Dec 26, 2015 at 4:59 PM, Connor Abbott >> wrote: >>> >>> On Sat, Dec 26, 2015 at 7:08 PM, Jason Ekstrand >>> wrote: >>> > >>> > On Dec 26, 2015 3:04 PM, "Con

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Jason Ekstrand
On Sat, Dec 26, 2015 at 5:15 PM, Jason Ekstrand wrote: > > > On Sat, Dec 26, 2015 at 4:59 PM, Connor Abbott > wrote: > >> On Sat, Dec 26, 2015 at 7:08 PM, Jason Ekstrand >> wrote: >> > >> > On Dec 26, 2015 3:04 PM, "Connor Abbott" wrote: >> >> >> >> On Sat, Dec 26, 2015 at 5:57 PM, Jason Ekstr

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Jason Ekstrand
On Sat, Dec 26, 2015 at 4:59 PM, Connor Abbott wrote: > On Sat, Dec 26, 2015 at 7:08 PM, Jason Ekstrand > wrote: > > > > On Dec 26, 2015 3:04 PM, "Connor Abbott" wrote: > >> > >> On Sat, Dec 26, 2015 at 5:57 PM, Jason Ekstrand > >> wrote: > >> > > >> > On Dec 26, 2015 2:22 PM, "Connor Abbott"

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Connor Abbott
On Sat, Dec 26, 2015 at 7:08 PM, Jason Ekstrand wrote: > > On Dec 26, 2015 3:04 PM, "Connor Abbott" wrote: >> >> On Sat, Dec 26, 2015 at 5:57 PM, Jason Ekstrand >> wrote: >> > >> > On Dec 26, 2015 2:22 PM, "Connor Abbott" wrote: >> >> >> >> On Sat, Dec 26, 2015 at 2:09 PM, Jason Ekstrand >> >>

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Jason Ekstrand
On Dec 26, 2015 3:04 PM, "Connor Abbott" wrote: > > On Sat, Dec 26, 2015 at 5:57 PM, Jason Ekstrand wrote: > > > > On Dec 26, 2015 2:22 PM, "Connor Abbott" wrote: > >> > >> On Sat, Dec 26, 2015 at 2:09 PM, Jason Ekstrand > >> wrote: > >> > This commit adds a NIR pass for lowering away returns i

Re: [Mesa-dev] [PATCH 01/12] nir: Get rid of function overloads

2015-12-26 Thread Connor Abbott
Reviewed-by: Connor Abbott On Sat, Dec 26, 2015 at 2:09 PM, Jason Ekstrand wrote: > When Connor originally drafted NIR, he copied the same function+overload > system that GLSL IR had with a few names changed. However, this > double-indirection is not really needed and has only served to confuse

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Connor Abbott
On Sat, Dec 26, 2015 at 5:57 PM, Jason Ekstrand wrote: > > On Dec 26, 2015 2:22 PM, "Connor Abbott" wrote: >> >> On Sat, Dec 26, 2015 at 2:09 PM, Jason Ekstrand >> wrote: >> > This commit adds a NIR pass for lowering away returns in functions. If >> > the >> > return is in a loop, it is lowered

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Jason Ekstrand
On Dec 26, 2015 2:22 PM, "Connor Abbott" wrote: > > On Sat, Dec 26, 2015 at 2:09 PM, Jason Ekstrand wrote: > > This commit adds a NIR pass for lowering away returns in functions. If the > > return is in a loop, it is lowered to a break. If it is not in a loop, > > it's lowered away by moving/de

Re: [Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Connor Abbott
On Sat, Dec 26, 2015 at 2:09 PM, Jason Ekstrand wrote: > This commit adds a NIR pass for lowering away returns in functions. If the > return is in a loop, it is lowered to a break. If it is not in a loop, > it's lowered away by moving/deleting code as needed. > --- > > Unfortunately, the loop-ha

[Mesa-dev] [PATCH 08/12] nir/cf: Make extracting or re-inserting nothing a no-op

2015-12-26 Thread Jason Ekstrand
--- src/glsl/nir/nir_control_flow.c | 9 + 1 file changed, 9 insertions(+) diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c index ecd9cbd..33b06d0 100644 --- a/src/glsl/nir/nir_control_flow.c +++ b/src/glsl/nir/nir_control_flow.c @@ -749,6 +749,12 @@ nir_cf_e

[Mesa-dev] [PATCH 07/12] nir: Add a function for comparing cursors

2015-12-26 Thread Jason Ekstrand
--- src/glsl/nir/nir.c | 63 ++ src/glsl/nir/nir.h | 2 ++ 2 files changed, 65 insertions(+) diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c index 12bd30f..4793673 100644 --- a/src/glsl/nir/nir.c +++ b/src/glsl/nir/nir.c @@ -695,6 +695,69

[Mesa-dev] [PATCH 02/12] nir: Create the params array in function_impl_create

2015-12-26 Thread Jason Ekstrand
--- src/glsl/nir/glsl_to_nir.cpp | 3 --- src/glsl/nir/nir.c | 6 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp index 0d1d0f4..2210e5a 100644 --- a/src/glsl/nir/glsl_to_nir.cpp +++ b/src/glsl/nir/glsl_to_

[Mesa-dev] [PATCH 03/12] nir: Add a helper for creating a "bare" nir_function_impl

2015-12-26 Thread Jason Ekstrand
This is useful if you want to clone a single function_impl if, for instance, you wanted to do function inlining. --- src/glsl/nir/nir.c | 37 - src/glsl/nir/nir.h | 2 ++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/glsl/nir/nir.c b/src/

[Mesa-dev] [PATCH 01/12] nir: Get rid of function overloads

2015-12-26 Thread Jason Ekstrand
When Connor originally drafted NIR, he copied the same function+overload system that GLSL IR had with a few names changed. However, this double-indirection is not really needed and has only served to confuse people. Instead, let's just have functions which may not have unique names and may or may

[Mesa-dev] [PATCH 06/12] nir/cf: Handle relinking top-level blocks

2015-12-26 Thread Jason Ekstrand
This can happen if a function ends in a return instruction and you remove the return. --- src/glsl/nir/nir_control_flow.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c index 96395a4..ecd9cbd 100644 --- a

[Mesa-dev] [PATCH 09/12] nir/types: Expose the bool type

2015-12-26 Thread Jason Ekstrand
--- src/glsl/nir/nir_types.cpp | 6 ++ src/glsl/nir/nir_types.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/glsl/nir/nir_types.cpp b/src/glsl/nir/nir_types.cpp index 41ac546..4452ee6 100644 --- a/src/glsl/nir/nir_types.cpp +++ b/src/glsl/nir/nir_types.cpp @@ -186,6 +186,12 @@ g

[Mesa-dev] [PATCH 04/12] nir/clone: Add support for cloning a single function_impl

2015-12-26 Thread Jason Ekstrand
This will be useful for things such as function inlining. --- src/glsl/nir/nir.h | 3 +- src/glsl/nir/nir_clone.c | 111 +-- 2 files changed, 81 insertions(+), 33 deletions(-) diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index d862bcc..7

[Mesa-dev] [PATCH 10/12] nir/builder: Add helpers for easily inserting copy_var intrinsics

2015-12-26 Thread Jason Ekstrand
--- src/glsl/nir/nir_builder.h | 23 +++ 1 file changed, 23 insertions(+) diff --git a/src/glsl/nir/nir_builder.h b/src/glsl/nir/nir_builder.h index ee6131a..9a5825c 100644 --- a/src/glsl/nir/nir_builder.h +++ b/src/glsl/nir/nir_builder.h @@ -324,6 +324,29 @@ nir_store_var(nir

[Mesa-dev] [RFC 11/12] nir: Add return lowering pass

2015-12-26 Thread Jason Ekstrand
This commit adds a NIR pass for lowering away returns in functions. If the return is in a loop, it is lowered to a break. If it is not in a loop, it's lowered away by moving/deleting code as needed. --- Unfortunately, the loop-handling portion hasn't had proper testing. I'm pretty sure the appr

[Mesa-dev] [RFC 12/12] nir: Add a pass to inline functions

2015-12-26 Thread Jason Ekstrand
This commit adds a new NIR pass that lowers all function calls away by inlining the functions. --- There are still two things missing here: 1) We really shouldn't do the inline recursively. We should keep a hash-table of inlined versions or something. 2) It doesn't properly handle things

[Mesa-dev] [PATCH 00/12] nir: Functions!

2015-12-26 Thread Jason Ekstrand
This little series adds the basics of what we need to actually do functions in NIR. We've had NIR function support in theory for some time, but it's never been used beyond the single-function "void main()" casae. This series gives us what we need to do it for real. The first patch, I would like

[Mesa-dev] [PATCH 05/12] nir/print: Factor variable name lookup into a helper

2015-12-26 Thread Jason Ekstrand
Otherwise, we have a problem when we go to print functions with arguments because their names get added to the hash table during declaration which happens after we print the prototype. --- src/glsl/nir/nir_print.c | 61 1 file changed, 31 insertions