Re: [Mesa-dev] [PATCH v2 1/2] nir: Add nir_lower_viewport_transform

2019-04-08 Thread Thomas Helland
nir_foreach_instr_safe(instr, block) { > +if (instr->type != nir_instr_type_intrinsic) continue; > + > +nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr); > +if (intr->intrinsic != nir_intrinsic_store_deref) continue; > + &g

Re: [Mesa-dev] [PATCH] nir: clone instruction set rather than removing individual entries

2019-02-21 Thread Thomas Helland
This patch is: Reviewed-by: Thomas Helland Den ons. 20. feb. 2019 kl. 04:04 skrev Timothy Arceri : > > This reduces the time spent in nir_opt_cse() by almost a half. > --- > src/compiler/nir/nir_opt_cse.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >

Re: [Mesa-dev] [PATCH 06/11] nir: rework force_unroll_array_access()

2018-12-04 Thread Thomas Helland
nt = nir_deref_instr_parent(d); > + assert(glsl_type_is_array(parent->type) || > + glsl_type_is_matrix(parent->type)); Maybe use glsl_type_is_array_or_matrix() ? With (or without) that this patchs looks good and is: Reviewed-by: Thomas Helland > + > + return

Re: [Mesa-dev] [PATCH 05/11] nir: factor out some of the complex loop unroll code to a helper

2018-12-04 Thread Thomas Helland
to the loop as we will insert the unrolled loop before > it > -*/ > - nir_cf_node *unroll_loc = &loop->cf_node; > - > - /* Temp lists to store the cloned loop as we unroll */ > - nir_cf_list unrolled_lp_body; > - nir_cf_list cloned_header; ^ This was actually un

Re: [Mesa-dev] [PATCH 04/11] nir: make use of new nir_cf_list_clone_and_reinsert() helper

2018-12-03 Thread Thomas Helland
d insert before the loop */ > + nir_cf_list_clone_and_reinsert(&lp_header, loop->cf_node.parent, > + nir_before_cf_node(&loop->cf_node), > + remap_table); > > /* Clone loop header and append to the loop body */ ^ Leftover comment? A

Re: [Mesa-dev] [PATCH 4/4] nir: detect more induction variables

2018-11-30 Thread Thomas Helland
I've done a couple passes over the patches now. Neatly implemented and look correct to me. With the two small nitpicks below correct this whole series is: Reviewed-by: Thomas Helland Den ons. 28. nov. 2018 kl. 04:26 skrev Timothy Arceri : > > This adds allows loop analysis to detect

Re: [Mesa-dev] [PATCH 4/4] nir: detect more induction variables

2018-11-29 Thread Thomas Helland
Den ons. 28. nov. 2018 kl. 10:23 skrev Timothy Arceri : > > On 28/11/18 6:52 pm, Thomas Helland wrote: > > Den ons. 28. nov. 2018 kl. 04:26 skrev Timothy Arceri > > : > >> > >> This adds allows loop analysis to detect inductions varibales that > >> are

Re: [Mesa-dev] [PATCH 4/4] nir: detect more induction variables

2018-11-27 Thread Thomas Helland
Den ons. 28. nov. 2018 kl. 04:26 skrev Timothy Arceri : > > This adds allows loop analysis to detect inductions varibales that > are incremented in both branches of an if rather than in a main > loop block. For example: > >loop { > block block_1: > /* preds: block_0 block_7 */ >

Re: [Mesa-dev] [PATCH 1/2] nir: add rewrite_phi_predecessor_blocks() helper

2018-11-26 Thread Thomas Helland
This patch is: Reviewed-by: Thomas Helland Den tir. 27. nov. 2018 kl. 06:32 skrev Timothy Arceri : > > This will also be used by the if merge pass in the following commit. > --- > src/compiler/nir/nir_opt_if.c | 45 ++- > 1 file changed, 28 in

Re: [Mesa-dev] [PATCH] nir/derefs: Add a nir_derefs_do_not_alias enum value

2018-11-20 Thread Thomas Helland
It seems this patch is not based on current master? However, it is trivial enough and I like the change, so with a rebase on current master this patch is: Reviewed-by: Thomas Helland Den man. 19. nov. 2018 kl. 19:33 skrev Jason Ekstrand : > > This makes some of the code more clear. > -

Re: [Mesa-dev] [PATCH 6/9] nir: Add nir_const_value_negative_equal

2018-10-08 Thread Thomas Helland
I really like this one; its very readable =) Reviewed-by: Thomas Helland Den tor. 30. aug. 2018 kl. 07:37 skrev Ian Romanick : > > From: Ian Romanick > > Signed-off-by: Ian Romanick > --- > src/compiler/nir/meson.build| 12 + > s

Re: [Mesa-dev] [PATCH 3/9] nir/opt_peephole_select: Don't peephole_select expensive math instructions

2018-10-08 Thread Thomas Helland
limit != 0, indirect_load_ok, > expensive_alu_ok)) > +#endif Leftover testing stuff? I like the idea of hiding expensive instructions in a branch. However, I'm wondering if it might be an idea to let drivers provide a callback with what instruction

Re: [Mesa-dev] [PATCH 00/11] intel/compiler: Optimize sign(x)*y

2018-10-08 Thread Thomas Helland
Den tir. 11. sep. 2018 kl. 01:30 skrev Ian Romanick : > > This series implements a code-generation optimization for sign(x)*y. In > GLSL, sign(x) is defined as: > > Returns 1.0 if x > 0, 0.0 if x = 0, or -1.0 if x < 0. > > It is silent on the NaN behavior, so I have taken it as "undefined." I

Re: [Mesa-dev] [PATCH 01/11] nir: Add helper functions to get the instruction that generated a nir_src

2018-10-08 Thread Thomas Helland
Den tir. 11. sep. 2018 kl. 01:30 skrev Ian Romanick : > > From: Ian Romanick > Reviewed-by: Thomas Helland > Signed-off-by: Ian Romanick > --- > src/compiler/nir/nir.h | 23 +++ > 1 file changed, 23 insertions(+) > > diff --git a/src/compiler/n

Re: [Mesa-dev] [PATCH 04/11] intel/compiler: Don't handle fsign.sat

2018-10-08 Thread Thomas Helland
Den tir. 11. sep. 2018 kl. 01:30 skrev Ian Romanick : > > From: Ian Romanick > > No shader-db or CI changes on any Intel platform. > I'm no expert on the intel backend, but this seems trivial enough. Reviewed-by: Thomas Helland > Signed-off-by: Ian Romanick >

Re: [Mesa-dev] [PATCH 03/11] nir/algebraic: Simplify fsat of fsign

2018-10-08 Thread Thomas Helland
to how this would impact other platforms than intel, but I've settled on it being a wash. Reviewed-by: Thomas Helland > Signed-off-by: Ian Romanick > --- > src/compiler/nir/nir_opt_algebraic.py | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/src/compiler

Re: [Mesa-dev] [PATCH 02/11] nir/algebraic: sign(x)*x*x is abs(x)*x

2018-10-08 Thread Thomas Helland
Den tir. 11. sep. 2018 kl. 01:30 skrev Ian Romanick : > > From: Ian Romanick > Reviewed-by: Thomas Helland > shader-db results: > > All Gen7+ platforms had similar results. (Skylake shown) > total instructions in shared programs: 15106023 -> 15105981 (<.01%) > ins

Re: [Mesa-dev] [RESEND PATCH 0/5] i965: More cmod propagation

2018-09-25 Thread Thomas Helland
Hi Ian, Do you have these in a branch somewhere? Do you also have a branch somewhere of the PRE for compares? I'll try to have a look at these, and the sign(x)*y series this evening. I will probably only be able to review the simplest patches, but something is probably better than nothing, I guess

Re: [Mesa-dev] [PATCH 1/9] util/dynarray: add a clone function

2018-08-15 Thread Thomas Helland
m_ctx a void *. Apart from that this patch is: Reviewed-by: Thomas Helland > +struct util_dynarray *from_buf) > +{ > + util_dynarray_init(buf, mem_ctx); > + util_dynarray_resize(buf, from_buf->size); > + memcpy(buf->data, from_buf->data, from_buf-

Re: [Mesa-dev] [PATCH 07/13] nir: Transform expressions of b2f(a) and b2f(b) to a || b

2018-08-02 Thread Thomas Helland
With the correction of the fmin/fmax pattern in this one and patch 10, and the inot version of the pattern in patch 9 and 11, patch 7, and 9-11 are: Reviewed-by: Thomas Helland I think that should be the whole series. 2018-08-03 1:38 GMT+02:00 Ian Romanick : > On 08/02/2018 02:10 PM, Tho

Re: [Mesa-dev] [PATCH 06/13] nir: Transform -fabs(a) < 0 to a != 0

2018-08-02 Thread Thomas Helland
2018-08-02 23:05 GMT+02:00 Thomas Helland : > 2018-08-02 20:19 GMT+02:00 Ian Romanick : >> From: Ian Romanick >> >> Unlike the much older -abs(a) >= 0.0 transformation, this is not >> precise. The behavior changes if a is NaN. >> >> All Gen platforms

Re: [Mesa-dev] [PATCH 13/13] nir: Transform expressions of b2f(a) and b2f(b) to a == b

2018-08-02 Thread Thomas Helland
Patches 12 and 13 are: Reviewed-by: Thomas Helland 2018-08-02 20:19 GMT+02:00 Ian Romanick : > From: Ian Romanick > > All Gen7+ platforms had similar results. (Skylake shown) > total instructions in shared programs: 14276886 -> 14276838 (<.01%) > instructions in affected

Re: [Mesa-dev] [PATCH 08/13] nir: Transform -fabs(a) >= 0 to a == 0

2018-08-02 Thread Thomas Helland
This patch is: Reviewed-by: Thomas Helland 2018-08-02 20:19 GMT+02:00 Ian Romanick : > From: Ian Romanick > > All Gen platforms had pretty similar results. (Skylake shown) > total instructions in shared programs: 14276964 -> 14276961 (<.01%) > instructions in affected

Re: [Mesa-dev] [PATCH 07/13] nir: Transform expressions of b2f(a) and b2f(b) to a || b

2018-08-02 Thread Thomas Helland
2018-08-02 20:19 GMT+02:00 Ian Romanick : > From: Ian Romanick > > All Gen6+ platforms had pretty similar results. (Skylake shown) > total instructions in shared programs: 14277184 -> 14276964 (<.01%) > instructions in affected programs: 10082 -> 9862 (-2.18%) > helped: 37 > HURT: 1 > helped stats

Re: [Mesa-dev] [PATCH 06/13] nir: Transform -fabs(a) < 0 to a != 0

2018-08-02 Thread Thomas Helland
@@ optimizations = [ > # a != 0.0 > (('~flt', 0.0, ('fabs', a)), ('fne', a, 0.0)), > > + # -fabs(a) < 0.0 > + # fabs(a) > 0.0 > + (('~flt', ('fneg', ('fabs', a)), 0.0), ('fne', a, 0.0)), &g

Re: [Mesa-dev] [PATCH v3 3/3] glsl: propagate full variables eagerly

2018-07-26 Thread Thomas Helland
Since we're always going top-down through the program there should be no need to "walk backwards", so this approach should be enough to get the whole chain of assignments in one pass. Neat. Reviewed-by: Thomas Helland 2018-07-25 3:03 GMT+02:00 Caio Marcelo de Oliveira Filho : &g

Re: [Mesa-dev] [PATCH v3 2/3] glsl: use only copy_propagation_elements

2018-07-26 Thread Thomas Helland
This is: Reviewed-by: Thomas Helland 2018-07-25 3:03 GMT+02:00 Caio Marcelo de Oliveira Filho : > Now that the elements version handles both cases, remove the > non-elements version. > > Reviewed-by: Eric Anholt > --- > src/compiler/Makefile.sources | 1 - &g

Re: [Mesa-dev] [PATCH v3 1/3] glsl: teach copy_propagation_elements to deal with whole variables

2018-07-26 Thread Thomas Helland
gt;is_vector()) { > + for (int i = 0; i < 4; i++) { > +lhs_entry->rhs_element[i] = rhs; > +lhs_entry->rhs_channel[i] = i; > + } > + } > + } > + > void remove_unused_var_from_dsts(acp_entry *lhs_entry, ir_variable *l

Re: [Mesa-dev] [PATCH 06/12] nir: Add a structure splitting pass

2018-07-26 Thread Thomas Helland
2018-07-26 18:00 GMT+02:00 Jason Ekstrand : > --- > src/compiler/Makefile.sources | 1 + > src/compiler/nir/meson.build | 1 + > src/compiler/nir/nir.h| 1 + > src/compiler/nir/nir_split_vars.c | 271 ++ > 4 files changed, 274 insertions(+) >

Re: [Mesa-dev] [PATCH 05/12] nir/types: Add array_or_matrix helpers

2018-07-26 Thread Thomas Helland
This patch is: Reviewed-by: Thomas Helland 2018-07-26 18:00 GMT+02:00 Jason Ekstrand : > --- > src/compiler/nir_types.cpp | 15 +++ > src/compiler/nir_types.h | 2 ++ > 2 files changed, 17 insertions(+) > > diff --git a/src/compiler/nir_types.cpp b/src/comp

Re: [Mesa-dev] [PATCH 03/12] nir/print: Remove a bogus assert

2018-07-26 Thread Thomas Helland
This is already fixed in master it seems 2018-07-26 17:59 GMT+02:00 Jason Ekstrand : > In 1beef89ad85c47fb6, we made a bunch of changes to NIR to allow for > more than four components. This assert was added to trigger if we ever > saw a vec16 input variable. However, it didn't take into account

Re: [Mesa-dev] [PATCH 04/12] nir/instr_set: Fix nir_instrs_equal for derefs

2018-07-26 Thread Thomas Helland
This is: Reviewed-by: Thomas Helland 2018-07-26 18:00 GMT+02:00 Jason Ekstrand : > We weren't returning at the end of the nir_isntr_type_deref case in > nir_instrs_equal and it was falling through to the default of false. > While we're at it, make the default unreachable bec

Re: [Mesa-dev] [PATCH 01/12] util/list: Make some helpers take const lists

2018-07-26 Thread Thomas Helland
This is: Reviewed-by: Thomas Helland 26. jul. 2018 18.04 skrev "Jason Ekstrand" : They're all just querying things about the list and not mutating anything. --- src/util/list.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/list.h b/src/ut

Re: [Mesa-dev] [PATCH 10/11] util/string_buffer: fix warning in tests

2018-07-16 Thread Thomas Helland
This patch is Reviewed-by: Thomas Helland Den tir. 17. jul. 2018, 01:40 skrev Caio Marcelo de Oliveira Filho < caio.olive...@intel.com>: > And also specify the maximum size when writing to static buffers. The > warning below refers to the case where "str5" could be larg

Re: [Mesa-dev] [PATCH 1/2] glsl: slim the kill_entry struct used in const propagation

2018-07-10 Thread Thomas Helland
ince it is not used in an > exec_list anymore. > > Remove the 'var' from kill_entry since it is now redundant with the > key of the hash table. > > Suggested by Eric Anholt. These are both: Reviewed-by: Thomas Helland > --- > src/compiler/glsl/opt_constant_propaga

Re: [Mesa-dev] [PATCH] mesa/math: Allocate memory for GLmatrix elements and its inverse contiguously

2018-04-19 Thread Thomas Helland
2018-04-19 20:08 GMT+02:00 Vlad Golovkin : > -- Forwarded message -- > From: Vlad Golovkin > Date: 2018-04-19 21:06 GMT+03:00 > Subject: Re: [Mesa-dev] [PATCH] mesa/math: Allocate memory for > GLmatrix elements and its inverse contiguously > To: Thomas Helland

Re: [Mesa-dev] [PATCH] mesa/math: Allocate memory for GLmatrix elements and its inverse contiguously

2018-04-16 Thread Thomas Helland
Hi, and thanks for the patch =) Have you done any performance testing on this to verify it gives us a speedup of any kind? I'm asking because it seems like this might be something that a decent compiler should be able to do. Performance related patches, at least in core mesa, usually have some jus

Re: [Mesa-dev] [PATCH 00/18] [RFC] Pointer specific data structures

2018-04-13 Thread Thomas Helland
2018-04-12 20:07 GMT+02:00 Eric Anholt : > Erik Faye-Lund writes: > >> On Wed, Apr 11, 2018 at 8:48 PM, Thomas Helland >> wrote: >>> This series came about when I saw a talk online, while simultaneously >>> being annoyd about the needless waste of memory in

[Mesa-dev] [PATCH 18/18] util: Just cut the hash in the pointer table

2018-04-11 Thread Thomas Helland
Meant for testing. Defeats some of the benefits of the implementation, however it still seems to be better than the current hash table, and the complexity is undeniably very low. --- src/util/pointer_map.c | 99 +- src/util/pointer_map.h | 1 - 2 fi

[Mesa-dev] [PATCH 14/18] nir: Migrate lower_vars_to_ssa to use pointer set

2018-04-11 Thread Thomas Helland
--- src/compiler/nir/nir_lower_vars_to_ssa.c | 35 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 3dfe48d6d3..988936ece8 100644 --- a/src/compiler/nir/nir_lo

[Mesa-dev] [PATCH 11/18] glsl: Use the pointer map in the glsl linker

2018-04-11 Thread Thomas Helland
--- src/compiler/glsl/linker.cpp | 40 +++- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index af09b7d03e..c549cac4b5 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl

[Mesa-dev] [PATCH 12/18] nir: Use pointer map in nir_from_ssa

2018-04-11 Thread Thomas Helland
--- src/compiler/nir/nir_from_ssa.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/nir/nir_from_ssa.c b/src/compiler/nir/nir_from_ssa.c index 1aa35509b1..e38c4fafd6 100644 --- a/src/compiler/nir/nir_from_ssa.c +++ b/src/compiler/nir/nir_from_ssa

[Mesa-dev] [PATCH 15/18] glsl: Use pointer set in opt_copy_propagation

2018-04-11 Thread Thomas Helland
--- src/compiler/glsl/opt_copy_propagation.cpp | 47 +- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp index 7bcd8a090b..0195dc4e40 100644 --- a/src/compiler/glsl/o

[Mesa-dev] [PATCH 17/18] nir: Use pointer_set in nir_propagate_invariant

2018-04-11 Thread Thomas Helland
Should cut memory consumption approximately in half, while giving us better cache locality and a simpler implementation. --- src/compiler/nir/nir_propagate_invariant.c | 33 +++--- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/compiler/nir/nir_propagat

[Mesa-dev] [PATCH 13/18] util: Add a pointer set implementation

2018-04-11 Thread Thomas Helland
x27;ralloc.c', diff --git a/src/util/pointer_set.c b/src/util/pointer_set.c new file mode 100644 index 00..8d8eff4541 --- /dev/null +++ b/src/util/pointer_set.c @@ -0,0 +1,266 @@ +/* + * Copyright © 2017 Thomas Helland + * + * Permission is hereby granted, free of charge, to any pers

[Mesa-dev] [PATCH 06/18] nir: Change lower_vars_to_ssa to use pointer map

2018-04-11 Thread Thomas Helland
--- src/compiler/nir/nir_lower_vars_to_ssa.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index e8cfe308d2..3dfe48d6d3 100644 --- a/src/compiler/nir/nir_lower_vars_to_ssa.c +++

[Mesa-dev] [PATCH 09/18] glsl: Change glsl_to_nir to user pointer map

2018-04-11 Thread Thomas Helland
--- src/compiler/glsl/glsl_to_nir.cpp | 31 +++ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 80eb15f1ab..310b678680 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/c

[Mesa-dev] [PATCH 16/18] nir: Use pointer set in remove_dead_variable

2018-04-11 Thread Thomas Helland
This should simplify things, and cut the memory consumption of the set effectively in half. Cache locality should also be better. --- src/compiler/nir/nir_remove_dead_variables.c | 37 ++-- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/compiler/nir/nir

[Mesa-dev] [PATCH 10/18] util: Add a call_foreach function to the pointer map

2018-04-11 Thread Thomas Helland
--- src/util/pointer_map.h | 13 + 1 file changed, 13 insertions(+) diff --git a/src/util/pointer_map.h b/src/util/pointer_map.h index 4bfc306a5f..f92e67d40d 100644 --- a/src/util/pointer_map.h +++ b/src/util/pointer_map.h @@ -91,6 +91,19 @@ _mesa_pointer_map_next_entry(struct pointer

[Mesa-dev] [PATCH 08/18] glsl: Use pointer map in opt_constant_variable

2018-04-11 Thread Thomas Helland
--- src/compiler/glsl/opt_constant_variable.cpp | 34 ++--- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/compiler/glsl/opt_constant_variable.cpp b/src/compiler/glsl/opt_constant_variable.cpp index 914b46004c..d1d315af7a 100644 --- a/src/compiler/glsl

[Mesa-dev] [PATCH 07/18] glsl: Use pointer map in copy propagation

2018-04-11 Thread Thomas Helland
--- src/compiler/glsl/opt_copy_propagation.cpp | 48 ++ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/compiler/glsl/opt_copy_propagation.cpp b/src/compiler/glsl/opt_copy_propagation.cpp index 6220aa86da..7bcd8a090b 100644 --- a/src/compiler/glsl/o

[Mesa-dev] [PATCH 03/18] util: Add a pointer map clone function

2018-04-11 Thread Thomas Helland
--- src/util/pointer_map.c | 23 +++ src/util/pointer_map.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/src/util/pointer_map.c b/src/util/pointer_map.c index 8076bd827f..463fa19282 100644 --- a/src/util/pointer_map.c +++ b/src/util/pointer_map.c @@ -102,6 +102,29

[Mesa-dev] [PATCH 01/18] util: Add initial pointer map implementation

2018-04-11 Thread Thomas Helland
7;sha1/sha1.c', 'sha1/sha1.h', 'ralloc.c', diff --git a/src/util/pointer_map.c b/src/util/pointer_map.c new file mode 100644 index 00..8076bd827f --- /dev/null +++ b/src/util/pointer_map.c @@ -0,0 +1,323 @@ +/* + * Copyright © 2017 Thomas Helland + * + * Permis

[Mesa-dev] [PATCH 05/18] glsl: Move ir_variable_refcount to using the pointer map

2018-04-11 Thread Thomas Helland
--- src/compiler/glsl/ir_variable_refcount.cpp | 13 ++--- src/compiler/glsl/ir_variable_refcount.h | 4 ++-- src/compiler/glsl/opt_dead_code.cpp| 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/compiler/glsl/ir_variable_refcount.cpp b/src/compil

[Mesa-dev] [PATCH 02/18] glsl: Use pointer map in constant propagation

2018-04-11 Thread Thomas Helland
--- src/compiler/glsl/opt_constant_propagation.cpp | 47 -- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/src/compiler/glsl/opt_constant_propagation.cpp b/src/compiler/glsl/opt_constant_propagation.cpp index 05dc71efb7..8072bf4811 100644 --- a/src/compile

[Mesa-dev] [PATCH 00/18] [RFC] Pointer specific data structures

2018-04-11 Thread Thomas Helland
and map amongst our utils, but the patch series is simple enough, and complete enough, that I thought I could share it for some inital comments. CC: Timothy Arceri Thomas Helland (18): util: Add initial pointer map implementation glsl: Use pointer map in constant propagation util: Add

[Mesa-dev] [PATCH 04/18] glsl: Port copy propagation elements to pointer map

2018-04-11 Thread Thomas Helland
--- .../glsl/opt_copy_propagation_elements.cpp | 96 +++--- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/src/compiler/glsl/opt_copy_propagation_elements.cpp b/src/compiler/glsl/opt_copy_propagation_elements.cpp index 8bae424a1d..8737fe27a5 100644 --- a/s

Re: [Mesa-dev] [PATCH] nir: Check if u_vector_init() succeeds

2018-04-05 Thread Thomas Helland
Sorry about that. It doesn't hurt to check. Reviewed-by: Thomas Helland 2018-04-05 9:35 GMT+02:00 Topi Pohjolainen : > However, it only fails when running out of memory. Now, if we > are about to check that, we should be consistent and check > the allocation of the worklist as we

[Mesa-dev] [PATCH 1/2] nir: Initial implementation of a nir_instr_worklist

2018-03-17 Thread Thomas Helland
Make a simple worklist by basically just wrapping u_vector. This is intended used in nir_opt_dce to reduce the number of calls to ralloc, as we are currenlty spamming ralloc quite bad. It should also give better cache locality and much lower memory usage. --- src/compiler/nir/nir_worklist.h | 69 +

[Mesa-dev] [PATCH 2/2] nir: Migrate nir_dce to instr worklist

2018-03-17 Thread Thomas Helland
Shader-db runtime change avarage of five runs: Before 125,77 seconds (+/- 0,09%) After 124,48 seconds (+/- 0,07%) --- src/compiler/nir/nir_opt_dce.c | 53 ++--- src/compiler/nir/nir_worklist.h | 1 + 2 files changed, 19 insertions(+), 35 deletions(-) d

[Mesa-dev] [PATCH 0/2] nir_instr_worklist for nir_opt_dce V2

2018-03-17 Thread Thomas Helland
This is take two on reducing ralloc overhead in nir_opt_dce. I've ditched the previous solution with a freelist, and instead gone for a wrapper on u_vector. That should remove the need for a freelist alltogether, and at the same time lower our memory usage. CC: Eric Anholt Thomas Hella

Re: [Mesa-dev] [PATCH 1/1] nir: Use a freelist in nir_opt_dce to avoid spamming ralloc

2018-03-14 Thread Thomas Helland
running both together with Dave's '[Mesa-dev] [PATCH] radv/winsys: > replace bo list searchs with a hash table.' patch. > > Dieter > > > Am 24.01.2018 08:33, schrieb Thomas Helland: >> >> 2018-01-21 23:58 GMT+01:00 Eric Anholt : >>> >>> T

Re: [Mesa-dev] [PATCH 0/2] V2: Use hash table cloning in copy propagation

2018-03-14 Thread Thomas Helland
2018-03-14 8:13 GMT+01:00 Dave Airlie : > On 14 March 2018 at 09:22, Thomas Helland wrote: >> Sending out a v2 just in case someone has any more comments. >> If not I'll probably push these tomorrow, or thursday. >> >> This is a revival of some old patches I had

[Mesa-dev] [PATCH 1/2] util: Implement a hash table cloning function

2018-03-13 Thread Thomas Helland
V2: Don't rzalloc; we are about to rewrite the whole thing (Vladislav) Reviewed-by: Eric Anholt --- src/util/hash_table.c | 22 ++ src/util/hash_table.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/util/hash_table.c b/src/util/hash_table.c index b7421a0144..f8

[Mesa-dev] [PATCH 0/2] V2: Use hash table cloning in copy propagation

2018-03-13 Thread Thomas Helland
mplementation incurs. Thomas Helland (2): util: Implement a hash table cloning function glsl: Use hash table cloning in copy propagation src/compiler/glsl/opt_copy_propagation.cpp | 17 - .../glsl/opt_copy_propagation_elements.cpp | 29 -- s

[Mesa-dev] [PATCH 2/2] glsl: Use hash table cloning in copy propagation

2018-03-13 Thread Thomas Helland
Walking the whole hash table, inserting entries by hashing them first is just a really bad idea. We can simply memcpy the whole thing. While this does not have a major performance impact on average, as it only helps shaders with a lot of branches, it might help individual shaders quite a lot. For

Re: [Mesa-dev] [PATCH 1/2] util: Implement a hash table cloning function

2018-03-13 Thread Thomas Helland
2018-03-12 19:48 GMT+01:00 Emil Velikov : > Hi Thomas, > > On 12 March 2018 at 17:55, Thomas Helland wrote: >> V2: Don't rzalloc; we are about to rewrite the whole thing (Vladislav) >> --- >> src/util/hash_table.c | 22 ++ >> src/util/ha

Re: [Mesa-dev] [PATCH 0/2] Hash table cloning for copy propagation

2018-03-12 Thread Thomas Helland
he mailing list. [1]: https://github.com/thohel/mesa/commits/hash-table-clone [2]: https://github.com/thohel/mesa/commits/pointer_map 2018-03-12 18:55 GMT+01:00 Thomas Helland : > This is a revival of some old patches I had around to improve > the compile times in the glsl compiler by

[Mesa-dev] [PATCH 2/2] glsl: Use hash table cloning in copy propagation

2018-03-12 Thread Thomas Helland
Walking the whole hash table, inserting entries by hashing them first is just a really bad idea. We can simply memcpy the whole thing. --- src/compiler/glsl/opt_copy_propagation.cpp | 13 -- .../glsl/opt_copy_propagation_elements.cpp | 29 -- 2 files cha

[Mesa-dev] [PATCH 1/2] util: Implement a hash table cloning function

2018-03-12 Thread Thomas Helland
V2: Don't rzalloc; we are about to rewrite the whole thing (Vladislav) --- src/util/hash_table.c | 22 ++ src/util/hash_table.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/util/hash_table.c b/src/util/hash_table.c index b7421a0144..f8d5d0f88a 100644 --- a/src/u

[Mesa-dev] [PATCH 0/2] Hash table cloning for copy propagation

2018-03-12 Thread Thomas Helland
remember if it was thoroughly tested, so that will have to be done. Sending it out as Dave might be interested in this to mitigate some of the overhead his soft-dobule implementation incurs. CC: Dave Airlie Thomas Helland (2): util: Implement a hash table cloning function glsl: Use hash t

Re: [Mesa-dev] [PATCH 4/4] glsl: Use hash table cloning in copy propagation

2018-03-12 Thread Thomas Helland
2018-03-12 5:23 GMT+01:00 Dave Airlie : > Did anything ever comes of this series, trying some soft fp64 shaders, > and glsl copy opt is taking 2-3 seconds on the big ones. > > Nearly all spent in hash table insertions. > > Dave. I still have the patches around. I also have a new "pointer_map" in t

Re: [Mesa-dev] [PATCH] radv/winsys: replace bo list searchs with a hash table.

2018-01-30 Thread Thomas Helland
2018-01-31 3:38 GMT+01:00 Dave Airlie : > On 31 January 2018 at 12:27, Dieter Nützel wrote: >> Ping! > > I'm not sure this was much of a win, and if it makes things worse in some > cases, > then it needs a lot more investigation, so probably consider it dead for now. > > Dave. > I have a new has

Re: [Mesa-dev] [PATCH 1/1] nir: Use a freelist in nir_opt_dce to avoid spamming ralloc

2018-01-23 Thread Thomas Helland
2018-01-21 23:58 GMT+01:00 Eric Anholt : > Thomas Helland writes: > >> Also, allocate worklist_elem in groups of 20, to reduce the burden of >> allocation. Do not use rzalloc, as there is no need. This lets us drop >> the number of calls to ralloc from aproximately 10% o

Re: [Mesa-dev] [PATCH 0/1] Use a freelist in nir_opt_dce

2017-12-02 Thread Thomas Helland
2017-12-02 15:49 GMT+01:00 Thomas Helland : > This patch tries to reduce the number of calls to ralloc in nir_opt_dce. > Especially with scalarized shaders we have a bunch of calls to ralloc > in this pass, hurting us quite bad. See the commit message for details. > > The other

[Mesa-dev] [PATCH 0/1] Use a freelist in nir_opt_dce

2017-12-02 Thread Thomas Helland
we could allocate groups at a time also here. I'm not sure how we can deal with that though, as it does not allocate the same number of items each time. I'm also working on a similar approach for the symbol table, but that is not quite ready yet. Thomas Helland (1): nir: Use a f

[Mesa-dev] [PATCH 1/1] nir: Use a freelist in nir_opt_dce to avoid spamming ralloc

2017-12-02 Thread Thomas Helland
Also, allocate worklist_elem in groups of 20, to reduce the burden of allocation. Do not use rzalloc, as there is no need. This lets us drop the number of calls to ralloc from aproximately 10% of all calls to ralloc(130 000 calls), down to a mere 2000 calls to ralloc_array_size. This cuts the r

Re: [Mesa-dev] [PATCH 10/12] glsl: Minor cleanups after previous commit

2017-11-04 Thread Thomas Helland
Patches 6-10 are: Reviewed-by: Thomas Helland 2017-11-02 21:25 GMT+01:00 Ian Romanick : > From: Ian Romanick > > I think it's more clear to only call emit_access once. The only > difference between the two calls is the value of size_mul used for the > offset parameter...

Re: [Mesa-dev] [PATCH 05/12] glsl: Combine nop-swizzle optimization with swizzle-swizzle optimization

2017-11-02 Thread Thomas Helland
Changes all look really good, and some performance numbers I have for a similar patch I've written shows a marginal benefit in compiler runtime performance (perf-stat -> cycles executed) For patches 4 and 5. Reviewed-by: 2. nov. 2017 21.26 skrev "Ian Romanick" : From: Ian Romanick Signed-off-

Re: [Mesa-dev] [PATCH 0/6] Prehash all the things

2017-10-10 Thread Thomas Helland
#x27;m running this all day without a hitch. >> >> Cheers, >> Dieter >> >> Am 23.05.2017 05:40, schrieb Dieter Nützel: >>> >>> For the series: >>> >>> Tested-by: Dieter Nützel >>> >>> on radeonsi/RX580 >>>

[Mesa-dev] [PATCH] util: fix in-class initialization of static member

2017-09-27 Thread Thomas Helland
string_buffer_test.cpp:43: error: ISO C++ forbids initialization of member ‘str1’ string_buffer_test.cpp:43: error: making ‘str1’ static string_buffer_test.cpp:43: error: invalid in-class initialization of static data member of non-integral type ‘const char*’ Bugzilla: https://bugs.freedesktop.org

Re: [Mesa-dev] [PATCH] glcpp: Avoid unnecessary call to strlen

2017-09-26 Thread Thomas Helland
. :) > > On 09/14/2017 03:39 PM, Thomas Helland wrote: >> Length of the token was already calculated by flex and stored in yyleng, >> no need to implicitly call strlen() via linear_strdup(). >> >> Reviewed-by: Nicolai Hähnle >> Reviewed-by: Timothy Arceri >&

Re: [Mesa-dev] [PATCH 07/22] glsl: Fix coding standards issues in lower_variable_index_to_cond_assign

2017-09-22 Thread Thomas Helland
2017-09-21 16:34 GMT+02:00 Ian Romanick : > From: "\"Ian Romanick\"" > ^ Something weird going on here? Apart from that, patches 1 - 7 are: Reviewed-by: Thomas Helland The regression from patch six I have no comments on. Someone else than me should probably she

Re: [Mesa-dev] [PATCH 2/5] util: Add tests for the string buffer

2017-09-21 Thread Thomas Helland
Fixed the missing newline at the end of this cpp file locally. This is the only patch left in the series without an RB. If there's no objections I plan on pushing this once I get an RB on this. Someone mind having a look at it? 2017-09-11 22:21 GMT+02:00 Thomas Helland : > More tes

Re: [Mesa-dev] [PATCH 2/2] glsl: merge loop_controls.cpp with loop_unroll.cpp

2017-09-20 Thread Thomas Helland
I've only skimmed this, but it looks trivial and correct. This patch series is: Reviewed-by: Thomas Helland I like the idea of getting rid of some of the walks over the IR, and have a set of patches sitting locally doing just that. I think I got most of them reviewed, but then it stalled.

Re: [Mesa-dev] [PATCH mesa] docs/submittingpatches: add 'test each commit' instructions

2017-09-15 Thread Thomas Helland
This patch is: Reviewed-by: Thomas Helland 2017-09-15 19:09 GMT+02:00 Eric Engestrom : > Signed-off-by: Eric Engestrom > --- > docs/submittingpatches.html | 12 > 1 file changed, 12 insertions(+) > > diff --git a/docs/submittingpatches.html b/docs/submittingpa

[Mesa-dev] [PATCH] util: Add a string buffer implementation

2017-09-14 Thread Thomas Helland
0,0 +1,148 @@ +/* + * Copyright © 2017 Thomas Helland + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation +

[Mesa-dev] [PATCH] glcpp: Avoid unnecessary call to strlen

2017-09-14 Thread Thomas Helland
Length of the token was already calculated by flex and stored in yyleng, no need to implicitly call strlen() via linear_strdup(). Reviewed-by: Nicolai Hähnle Reviewed-by: Timothy Arceri V2: Also convert this pattern in glsl_lexer.ll V3: Remove a misplaced comment V4: Use a temporary char to a

Re: [Mesa-dev] [PATCH 5/5] glcpp: Avoid unnecessary call to strlen

2017-09-14 Thread Thomas Helland
2017-09-14 3:29 GMT+02:00 Ian Romanick : > On 09/11/2017 01:21 PM, Thomas Helland wrote: >> Length of the token was already calculated by flex and stored in yyleng, >> no need to implicitly call strlen() via linear_strdup(). >> >> Reviewed-by: Nicolai Hähnle >

Re: [Mesa-dev] [PATCH 5/5] glcpp: Avoid unnecessary call to strlen

2017-09-14 Thread Thomas Helland
2017-09-14 3:32 GMT+02:00 Ian Romanick : > On 09/11/2017 01:21 PM, Thomas Helland wrote: >> @@ -621,12 +636,17 @@ u64vec4 KEYWORD_WITH_ALT(0, 0, 0, 0, >> yyextra->ARB_gpu_shader_int64_enable, U64V >> [_a-zA-Z][_a-zA-Z0-9]* { >>

Re: [Mesa-dev] [PATCH 0/5] Resend of string buffer series

2017-09-14 Thread Thomas Helland
review comments, get me an fd-o account and git access, and get these merged sooner rather than later. > Dieter > > > Am 11.09.2017 22:21, schrieb Thomas Helland: >> >> I think I should have addressed all review feedback pointed out >> to me by Nicolai, fixed the bui

[Mesa-dev] [PATCH 2/5] util: Add tests for the string buffer

2017-09-11 Thread Thomas Helland
e8b135 --- /dev/null +++ b/src/util/tests/string_buffer/string_buffer_test.cpp @@ -0,0 +1,119 @@ +/* + * Copyright © 2017 Thomas Helland + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"

[Mesa-dev] [PATCH 1/5] util: Add a string buffer implementation

2017-09-11 Thread Thomas Helland
til/string_buffer.c new file mode 100644 index 00..e43824948f --- /dev/null +++ b/src/util/string_buffer.c @@ -0,0 +1,147 @@ +/* + * Copyright © 2017 Thomas Helland + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associa

[Mesa-dev] [PATCH 4/5] glcpp: Use string_buffer for line continuation removal

2017-09-11 Thread Thomas Helland
Reviewed-by: Nicolai Hähnle V2: Adapt to different API of string buffer (Thomas Helland) --- src/compiler/glsl/glcpp/pp.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/compiler/glsl/glcpp/pp.c b/src/compiler/glsl/glcpp/pp.c index 861f6e8669

[Mesa-dev] [PATCH 0/5] Resend of string buffer series

2017-09-11 Thread Thomas Helland
cations to make comments clearer and more precise, and variable names better explaining their intet in a couple of places. Details of changes in each patch. A big thanks to those who have helped review this series =) Thomas Helland (5): util: Add a string buffer implementation util: Add tests for

[Mesa-dev] [PATCH 5/5] glcpp: Avoid unnecessary call to strlen

2017-09-11 Thread Thomas Helland
Length of the token was already calculated by flex and stored in yyleng, no need to implicitly call strlen() via linear_strdup(). Reviewed-by: Nicolai Hähnle Reviewed-by: Timothy Arceri V2: Also convert this pattern in glsl_lexer.ll V3: Remove a misplaced comment Fix compile warning from V

[Mesa-dev] [PATCH 3/5] glsl: Change the parser to use the string buffer

2017-09-11 Thread Thomas Helland
Reviewed-by: Nicolai Hähnle V2: Pointed out by Timothy - Fix pp.c reralloc size issue and comment V3 - Use vprintf instead of printf where we should - Fixes failing make-check tests V4 - Use buffer_append_char in a couple more places --- src/compiler/glsl/glcpp/glcpp-parse.y | 195 ++

Re: [Mesa-dev] [PATCH 0/8] Resend of preprocessor series

2017-09-06 Thread Thomas Helland
comments, etc. 6. sep. 2017 23.00 skrev "Dieter Nützel" : For the series: Tested-by: Dieter Nützel But do NOT apply on current git any longer. With Nicolai's comments addressed new version underway? ;-) Dieter Am 29.08.2017 21:56, schrieb Thomas Helland: > This is a resend o

Re: [Mesa-dev] [PATCH] mesa/mtypes: repack gl_texture_object.

2017-09-03 Thread Thomas Helland
2017-09-03 13:39 GMT+02:00 Dave Airlie : > On 3 September 2017 at 21:22, Thomas Helland > wrote: >> 2017-09-03 13:18 GMT+02:00 Dave Airlie : >>> From: Dave Airlie >>> >>> reduces size from 1144 to 1128. >>> >>> Signed-off-

Re: [Mesa-dev] [PATCH] mesa/mtypes: repack gl_sampler_object.

2017-09-03 Thread Thomas Helland
Reviewed-by: Thomas Helland 2017-09-03 13:21 GMT+02:00 Dave Airlie : > From: Dave Airlie > > 160->152. > > Signed-off-by: Dave Airlie > --- > src/mesa/main/mtypes.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/mesa/main/mtypes.h

  1   2   3   4   5   6   >