Re: [Mesa-dev] [PATCH] ac/nir_to_llvm: fix interpolateAt* for arrays

2019-01-18 Thread Timothy Arceri
On 19/1/19 10:29 am, Bas Nieuwenhuizen wrote: On Sat, Jan 19, 2019 at 12:27 AM Bas Nieuwenhuizen wrote: On Sat, Jan 19, 2019 at 12:17 AM Timothy Arceri wrote: On 19/1/19 9:36 am, Bas Nieuwenhuizen wrote: On Thu, Jan 10, 2019 at 6:59 AM Timothy Arceri wrote: This builds on the recent

Re: [Mesa-dev] [PATCH] ac/nir_to_llvm: fix interpolateAt* for arrays

2019-01-18 Thread Timothy Arceri
On 19/1/19 9:36 am, Bas Nieuwenhuizen wrote: On Thu, Jan 10, 2019 at 6:59 AM Timothy Arceri wrote: This builds on the recent interpolate fix by Rhys ee8488ea3b99. This doesn't handle arrays of structs but I've got a feeling those might be broken even for radeonsi tgsi (we currently have

Re: [Mesa-dev] [PATCH] ac/nir_to_llvm: fix interpolateAt* for arrays

2019-01-18 Thread Timothy Arceri
Ping! On 10/1/19 4:59 pm, Timothy Arceri wrote: This builds on the recent interpolate fix by Rhys ee8488ea3b99. This doesn't handle arrays of structs but I've got a feeling those might be broken even for radeonsi tgsi (we currently have no tests). This fixes the arb_gpu_shader5 interpolateAt

[Mesa-dev] [PATCH 1/2] glsl: don't skip GLSL IR opts on first-time compiles

2019-01-16 Thread Timothy Arceri
This basically reverts c2bc0aa7b188. By running the opts we reduce memory using in Team Fortress 2 from 1.5GB -> 1.3GB from start-up to game menu. This will likely increase Deus Ex start up times as per commit c2bc0aa7b188. However currently 32bit games like Team Fortress 2 can run out of

[Mesa-dev] [PATCH 2/2] glsl: be much more aggressive when skipping shader compilation

2019-01-16 Thread Timothy Arceri
Currently only add a cache key for a shader once it is linked. However games like Team Fortress 2 compile a whole bunch of shaders which are never actually linked. These compiled shaders can take up a bunch of memory. This patch changes things so that we add the key for the shader to the cache as

Re: [Mesa-dev] [PATCH 5/5] radeonsi/nir: add missing pieces for bindless image/sampler support

2019-01-16 Thread Timothy Arceri
type of handle we are dealing with. I'll rework this. Patches 1-4: Reviewed-by: Marek Olšák mailto:marek.ol...@amd.com>> Thanks! Marek On Wed, Jan 9, 2019 at 3:54 AM Timothy Arceri <mailto:tarc...@itsqueeze.com>> wrote: ---  src/gallium/drivers/radeonsi/si_sh

Re: [Mesa-dev] Thoughts after hitting 100 merge requests?

2019-01-13 Thread Timothy Arceri
To be honest I have mixed feelings about using Gitlab merge requests. As Jason mentions bellow the discussions feature is a nice way to avoid the mess that can happen with mailings list replys. However I seem to find myself fighting with the interface more that should be necessary. Most of

[Mesa-dev] [PATCH] ac/nir_to_llvm: fix interpolateAt* for arrays

2019-01-09 Thread Timothy Arceri
This builds on the recent interpolate fix by Rhys ee8488ea3b99. This doesn't handle arrays of structs but I've got a feeling those might be broken even for radeonsi tgsi (we currently have no tests). This fixes the arb_gpu_shader5 interpolateAt* tests that contain arrays. Fixes: ee8488ea3b99

[Mesa-dev] [PATCH 1/5] ac/nir_to_llvm: fix type handling in image code

2019-01-09 Thread Timothy Arceri
The current code only strips off arrays and cannot find the type for images that are struct members. Instead of trying to get the image type from the variable, we just get it directly from the deref instruction. --- src/amd/common/ac_nir_to_llvm.c | 27 --- 1 file

[Mesa-dev] [PATCH 3/5] ac/nir_to_llvm: fix regression in bindless support

2019-01-09 Thread Timothy Arceri
This wasn't ported over when deref support was implemented. --- src/amd/common/ac_nir_to_llvm.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 633cc0aa06..4f7b2e4dc2 100644 ---

[Mesa-dev] [PATCH 5/5] radeonsi/nir: add missing pieces for bindless image/sampler support

2019-01-09 Thread Timothy Arceri
--- src/gallium/drivers/radeonsi/si_shader_nir.c | 33 +++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 2c95c62d99..256ef28bb1 100644 ---

[Mesa-dev] Partial bindless support for radeonsi NIR

2019-01-09 Thread Timothy Arceri
We still need core NIR support for various features such as image/sampler in/outs etc. But this gets us a step closer. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 2/5] radeonsi/nir: get correct type for images inside structs

2019-01-09 Thread Timothy Arceri
--- src/gallium/drivers/radeonsi/si_shader_nir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 64acf41679..2c95c62d99 100644 ---

[Mesa-dev] [PATCH 4/5] ac/nir_to_llvm: add support for structs to get_sampler_desc()

2019-01-09 Thread Timothy Arceri
--- src/amd/common/ac_nir_to_llvm.c | 45 +++-- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 4f7b2e4dc2..99eb6fb573 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++

Re: [Mesa-dev] [PATCH] ac/nir_to_llvm: add missing parentheses in get_inst_tessfactor_writemask()

2019-01-07 Thread Timothy Arceri
On 8/1/19 10:50 am, Bas Nieuwenhuizen wrote: I think this got fixed by https://gitlab.freedesktop.org/mesa/mesa/commit/be6cee51c06dc72ac159bd75b4201c61952515bd already? ok thanks. Hadn't pulled that one in yet. On Tue, Jan 8, 2019 at 12:28 AM Timothy Arceri wrote: Cc: Marek Olšák

Re: [Mesa-dev] [PATCH] glsl/linker: specify proper direction in location aliasing error

2019-01-07 Thread Timothy Arceri
Reviewed-by: Timothy Arceri On 8/1/19 1:11 am, Andres Gomez wrote: The check for location aliasing was always asuming output variables but this validation is also called for input variables. Fixes: e2abb75b0e4 ("glsl/linker: validate explicit locations for SSO programs") Cc:

[Mesa-dev] [PATCH] ac/nir_to_llvm: add missing parentheses in get_inst_tessfactor_writemask()

2019-01-07 Thread Timothy Arceri
Cc: Marek Olšák --- src/amd/common/ac_nir_to_llvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 84dbe17457..c9e11142eb 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++

Re: [Mesa-dev] [PATCH 2/3] ac/nir_to_llvm: add ac_are_tessfactors_def_in_all_invocs()

2019-01-07 Thread Timothy Arceri
On 8/1/19 6:43 am, Marek Olšák wrote: On Mon, Dec 17, 2018 at 8:18 PM Timothy Arceri <mailto:tarc...@itsqueeze.com>> wrote: The following patch will use this with the radeonsi NIR backend but I've added it to ac so we can use it with RADV in future. This is a NIR imple

Re: [Mesa-dev] [PATCH] glsl: correct typo in GLSL compilation error message

2019-01-07 Thread Timothy Arceri
On 8/1/19 2:51 am, Andres Gomez wrote: On Mon, 2019-01-07 at 16:48 +0100, Erik Faye-Lund wrote: On Mon, 2019-01-07 at 15:50 +0200, Andres Gomez wrote: Correct a typo introduced by 037f68d81e1 ("glsl: apply align layout qualifier rules to block offsets") Cc: Timothy Arceri

[Mesa-dev] [PATCH] nir: avoid uninitialized variable warning

2019-01-06 Thread Timothy Arceri
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109231 --- src/compiler/nir/nir_loop_analyze.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 259f02a854..6deb6cb962 100644 ---

Re: [Mesa-dev] [PATCH 23/25] radeonsi: factor si_query_buffer logic out of si_query_hw

2019-01-02 Thread Timothy Arceri
This commit seems to cause bad stuttering in the Batman Arkham City benchmark. On 7/12/18 1:00 am, Nicolai Hähnle wrote: From: Nicolai Hähnle This is a move towards using composition instead of inheritance for different query types. This change weakens out-of-memory error reporting

[Mesa-dev] [PATCH] st/glsl: refactor st_link_nir()

2019-01-02 Thread Timothy Arceri
The functional change here is moving the nir_lower_io_to_scalar_early() calls inside st_nir_link_shaders() and moving the st_nir_opts() call after the call to nir_lower_io_arrays_to_elements(). This fixes a bug with the following piglit test due to the current code not cleaning up dead code after

[Mesa-dev] [PATCH 3/3] nir: simplify does_varying_match()

2019-01-01 Thread Timothy Arceri
--- src/compiler/nir/nir_linking_helpers.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 97816ccc58..be6b9dd85c 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++

[Mesa-dev] [PATCH 2/3] nir: make use of does_varying_match() helper

2019-01-01 Thread Timothy Arceri
--- src/compiler/nir/nir_linking_helpers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index abbd7e1f5c..97816ccc58 100644 --- a/src/compiler/nir/nir_linking_helpers.c +++

[Mesa-dev] [PATCH 1/3] nir: make nir_opt_remove_phis_impl() static

2019-01-01 Thread Timothy Arceri
--- src/compiler/nir/nir.h | 1 - src/compiler/nir/nir_opt_remove_phis.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 4b8de4bb01..94d6578620 100644 --- a/src/compiler/nir/nir.h +++

[Mesa-dev] [PATCH v2 5/5] nir: link time opt duplicate varyings

2018-12-19 Thread Timothy Arceri
If we are outputting the same value to more than one output component rewrite the inputs to read from a single component. This will allow the duplicate varying components to be optimised away by the existing opts. shader-db results i965 (SKL): total instructions in shared programs: 12869230 ->

[Mesa-dev] [PATCH v2 3/5] nir: add can_replace_varying() helper

2018-12-19 Thread Timothy Arceri
This will be reused by the following patch. Reviewed-by: Marek Olšák --- src/compiler/nir/nir_linking_helpers.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index

[Mesa-dev] [PATCH v2 1/5] st/glsl_to_nir: call nir_lower_load_const_to_scalar() in the st

2018-12-19 Thread Timothy Arceri
This will help the new opt introduced in the following patches allowing us to remove extra duplicate varyings. Reviewed-by: Marek Olšák --- src/gallium/drivers/radeonsi/si_shader_nir.c | 2 -- src/mesa/state_tracker/st_glsl_to_nir.cpp| 4 +++- 2 files changed, 3 insertions(+), 3

[Mesa-dev] [PATCH v2 2/5] nir: rename nir_link_constant_varyings() nir_link_opt_varyings()

2018-12-19 Thread Timothy Arceri
The following patches will add support for an addition optimisation so this function will no longer just optimise varying constants. Reviewed-by: Marek Olšák --- src/amd/vulkan/radv_pipeline.c| 4 ++-- src/compiler/nir/nir.h| 2 +-

[Mesa-dev] [PATCH v2 4/5] nir: rework nir_link_opt_varyings()

2018-12-19 Thread Timothy Arceri
This just cleans things up a little and make things more safe for derefs. --- src/compiler/nir/nir_linking_helpers.c | 28 +++--- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c

Re: [Mesa-dev] [PATCH] nir: create 32-bit bcsel for 32-bit conditions

2018-12-18 Thread Timothy Arceri
Reviewed-by: Timothy Arceri On 18/12/18 3:16 am, Rhys Perry wrote: Signed-off-by: Rhys Perry --- src/compiler/nir/nir_opt_peephole_select.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir

Re: [Mesa-dev] [PATCH v2 29/29] nir/algebraic: Add some optimizations for D3D-style Booleans

2018-12-17 Thread Timothy Arceri
On 7/12/18 6:45 am, Jason Ekstrand wrote: D3D Booleans use a 32-bit 0/-1 representation. Because this previously matched NIR exactly, we didn't have to really optimize for it. Now that we have 1-bit Booleans, we need some specific optimizations to chew through the D3D12-style Booleans.

Re: [Mesa-dev] [PATCH 7/7] nir/dead_write_vars: Get modes directly from derefs

2018-12-17 Thread Timothy Arceri
Series: Reviewed-by: Timothy Arceri On 18/12/18 3:44 pm, Jason Ekstrand wrote: Instead of going all the way back to the variable, just look at the deref. The modes are guaranteed to be the same by nir_validate whenever the variable can be found. This fixes clear_unused_for_modes for derefs

[Mesa-dev] [PATCH 2/3] ac/nir_to_llvm: add ac_are_tessfactors_def_in_all_invocs()

2018-12-17 Thread Timothy Arceri
The following patch will use this with the radeonsi NIR backend but I've added it to ac so we can use it with RADV in future. This is a NIR implementation of the tgsi function tgsi_scan_tess_ctrl(). --- src/amd/common/ac_nir_to_llvm.c | 161

[Mesa-dev] [PATCH 3/3] radeonsi: make use of ac_are_tessfactors_def_in_all_invocs()

2018-12-17 Thread Timothy Arceri
--- src/gallium/drivers/radeonsi/si_shader_nir.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index b81bea00b8..931d41245d 100644 ---

[Mesa-dev] [PATCH 1/3] radeonsi: remove unrequired param in si_nir_scan_tess_ctrl()

2018-12-17 Thread Timothy Arceri
--- src/gallium/drivers/radeonsi/si_shader.h| 1 - src/gallium/drivers/radeonsi/si_shader_nir.c| 1 - src/gallium/drivers/radeonsi/si_state_shaders.c | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader.h

Re: [Mesa-dev] [PATCH 4/4] nir: link time opt duplicate varyings

2018-12-14 Thread Timothy Arceri
On 15/12/18 1:16 pm, Timothy Arceri wrote: On 15/12/18 7:32 am, Marek Olšák wrote: For patches 1-3: Reviewed-by: Marek Olšák <mailto:marek.ol...@amd.com>> Thanks! I'm not so knowledgeable to be able to comment on patch 4. Does it also merge varyings such as (x,y,undef,undef

Re: [Mesa-dev] [PATCH 4/4] nir: link time opt duplicate varyings

2018-12-14 Thread Timothy Arceri
ce our main focus these days is on Vulkan and there we always link the entire pipeline so its not an issue. Marek On Mon, Dec 10, 2018 at 11:28 PM Timothy Arceri <mailto:tarc...@itsqueeze.com>> wrote: If we are outputting the same value to more than one output component rew

[Mesa-dev] [PATCH 1/2] tgsi/scan: fix loop exit point in tgsi_scan_tess_ctrl()

2018-12-13 Thread Timothy Arceri
This just happened not to crash/assert because all loops have at least 1 if-statement and due to a second bug we end up matching the same ENDIF to exit both the iteration over the if-statment and the loop. The second bug is fixed in the following patch. Fixes: 386d165d8d09 ("tgsi/scan: add a new

[Mesa-dev] [PATCH 2/2] tgsi/scan: correctly walk instructions in tgsi_scan_tess_ctrl()

2018-12-13 Thread Timothy Arceri
The previous code used a do while loop and continues after walking a nested loop/if-statement. This means we end up evaluating the last instruction from the nested block against the while condition and potentially exit early if it matches the exit condition of the outer block. Fixes: 386d165d8d09

Re: [Mesa-dev] [PATCH] spirv/nir: adjust location assignment for the case of arrays of blocks

2018-12-13 Thread Timothy Arceri
On 13/12/18 11:11 pm, Alejandro Piñeiro wrote: This is needed due how the types get rearranged after the struct splitting. So for example, this array of blocks: layout(location = 0) out block { vec4 v; vec3 v2; } x[2]; Would be splitted on two nir variables with the

Re: [Mesa-dev] [PATCH] nir: remove unused variable

2018-12-13 Thread Timothy Arceri
I don't think I've seen the warning so its likely I use this (or removing it) in a future patch. But feel free to push this for now. On 14/12/18 1:25 am, Alejandro Piñeiro wrote: To avoid the following warning: ./src/compiler/nir/nir_loop_analyze.c:807:16: warning: unused variable ‘ns’

Re: [Mesa-dev] [PATCH 1/4] nir: add if opt opt_if_loop_last_continue()

2018-12-13 Thread Timothy Arceri
On 13/12/18 8:10 pm, Samuel Pitoiset wrote: This introduces crashes for dEQP-VK.spirv_assembly.instruction.graphics.selection_block_order.out_of_order_frag dEQP-VK.spirv_assembly.instruction.graphics.selection_block_order.out_of_order_geom

[Mesa-dev] [PATCH] nir: fix opt_if_loop_last_continue()

2018-12-13 Thread Timothy Arceri
The pass did not correctly handle loops ending in: if ssa_7 { block block_8: /* preds: block_7 */ continue /* succs: block_1 */ } else { block block_9: /* preds: block_7 */

[Mesa-dev] [PATCH v2 06/10] nir: simplify the loop analysis trip count code a little

2018-12-12 Thread Timothy Arceri
Here we create a helper is_supported_terminator_condition() and use that rather than embedding all the trip count code inside a switch. The new helper will also be used in a following patch. --- src/compiler/nir/nir_loop_analyze.c | 176 +++- 1 file changed, 95

[Mesa-dev] [PATCH v2 09/10] nir: pass nir_op to calculate_iterations()

2018-12-12 Thread Timothy Arceri
Rather than getting this from the alu instruction this allows us some flexibility. In the following pass we instead pass the inverse op. --- src/compiler/nir/nir_loop_analyze.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git

[Mesa-dev] [PATCH v2 01/10] nir: add guess trip count support to loop analysis

2018-12-12 Thread Timothy Arceri
This detects an induction variable used as an array index to guess the trip count of the loop. This enables us to do a partial unroll of the loop, with can eventually result in the loop being eliminated. v2: check if the induction var is used to index more than a single array and if so get

[Mesa-dev] [PATCH v2 05/10] nir: unroll some loops with a variable limit

2018-12-12 Thread Timothy Arceri
For some loops can have a single terminator but the exact trip count is still unknown. For example: for (int i = 0; i < imin(x, 4); i++) ... Shader-db results radeonsi (all affected are from Tropico 5): Totals from affected shaders: SGPRS: 200 -> 208 (4.00 %) VGPRS: 164 -> 148 (-9.76

[Mesa-dev] [PATCH v2 02/10] nir: add new partially_unrolled bool to nir_loop

2018-12-12 Thread Timothy Arceri
In order to stop continuously partially unrolling the same loop we add the bool partially_unrolled to nir_loop, we add it here rather than in nir_loop_info because nir_loop_info is only set via loop analysis and is intended to be cleared before each analysis. Also nir_loop_info is never cloned.

[Mesa-dev] [PATCH v2 07/10] nir: add helper to return inversion op of a comparision

2018-12-12 Thread Timothy Arceri
This will be used to help find the trip count of loops that look like the following: while (a < x && i < 8) { ... i++; } Where the NIR will end up looking something like this: vec1 32 ssa_0 = load_const (0x /* 0.00 */) vec1 32 ssa_1 = load_const (0x0008

[Mesa-dev] [PATCH v2 03/10] nir: add partial loop unrolling support

2018-12-12 Thread Timothy Arceri
This adds partial loop unrolling support and makes use of a guessed trip count based on array access. The code is written so that we could use partial unrolling more generally, but for now it's only use when we have guessed the trip count. We use partial unrolling for this guessed trip count

[Mesa-dev] [PATCH v2 08/10] nir: add get_induction_and_limit_vars() helper to loop analysis

2018-12-12 Thread Timothy Arceri
This helps make find_trip_count() a little easier to follow but will also be used by a following patch. --- src/compiler/nir/nir_loop_analyze.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/compiler/nir/nir_loop_analyze.c

[Mesa-dev] [PATCH v2 10/10] nir: find induction/limit vars in iand instructions

2018-12-12 Thread Timothy Arceri
This will be used to help find the trip count of loops that look like the following: while (a < x && i < 8) { ... i++; } Where the NIR will end up looking something like this: vec1 32 ssa_0 = load_const (0x /* 0.00 */) vec1 32 ssa_1 = load_const (0x0008

[Mesa-dev] [PATCH v2 04/10] nir: calculate trip count for more loops

2018-12-12 Thread Timothy Arceri
This adds support to loop analysis for loops where the induction variable is compared to the result of min(variable, constant). For example: for (int i = 0; i < imin(x, 4); i++) ... We add a new bool to the loop terminator struct in order to differentiate terminators with this exit

[Mesa-dev] V2 More loop unrolling

2018-12-12 Thread Timothy Arceri
V2: - When guessing trip count in patch 1 check if the induction var is used in more than a single loop and get the smallest array size if so (Suggested by Jason). - A bunch of reviewed patches have been pushed Some piglit tests: https://patchwork.freedesktop.org/series/53712/

[Mesa-dev] [PATCH 2/4] nir: rename nir_link_constant_varyings() nir_link_opt_varyings()

2018-12-10 Thread Timothy Arceri
The following patches will add support for an addition optimisation so this function will no longer just optimise varying constants. --- src/amd/vulkan/radv_pipeline.c| 4 ++-- src/compiler/nir/nir.h| 2 +- src/compiler/nir/nir_linking_helpers.c| 2 +-

[Mesa-dev] [PATCH 3/4] nir: add can_replace_varying() helper

2018-12-10 Thread Timothy Arceri
This will be reused by the following patch. --- src/compiler/nir/nir_linking_helpers.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index b447729c60..37644d339f 100644 ---

[Mesa-dev] [PATCH 1/4] st/glsl_to_nir: call nir_lower_load_const_to_scalar() in the st

2018-12-10 Thread Timothy Arceri
This will help the new opt introduced in the following patches allowing us to remove extra duplicate varyings. --- src/gallium/drivers/radeonsi/si_shader_nir.c | 2 -- src/mesa/state_tracker/st_glsl_to_nir.cpp| 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git

[Mesa-dev] [PATCH 4/4] nir: link time opt duplicate varyings

2018-12-10 Thread Timothy Arceri
If we are outputting the same value to more than one output component rewrite the inputs to read from a single component. This will allow the duplicate varying components to be optimised away by the existing opts. shader-db results i965 (SKL): total instructions in shared programs: 12869230 ->

Re: [Mesa-dev] [PATCH] mesa: add EXT_debug_label support

2018-12-10 Thread Timothy Arceri
t would be easy enough to add, but it seems more valuable to suggest the developer use the more broadly supported extension." On 12/10/18 4:08 PM, Timothy Arceri wrote: KHR_debug already provides superior functionality but this extension is still in use and adding support for it seems fai

[Mesa-dev] [PATCH] mesa: add EXT_debug_label support

2018-12-10 Thread Timothy Arceri
KHR_debug already provides superior functionality but this extension is still in use and adding support for it seems fairly harmless. For example it seems to be used by Unity as seen in the Parkitect trace attached to Mesa bug #108919. --- src/mapi/glapi/gen/gl_API.xml| 17 +

Re: [Mesa-dev] [PATCH v2 3/4] nir: rewrite varying component packing

2018-12-09 Thread Timothy Arceri
Sorry please ignore this for now. I've realised there is a bug here where we could end up packing components in only one of the shaders but not the other. For example if we have an array on one side but just a bunch of individual varyings on the other (which is legal I believe). I'll send a

Re: [Mesa-dev] [PATCH 3/3] nir: fixed some missed varying compaction opportunities

2018-12-09 Thread Timothy Arceri
I'd much rather land the first 3 patches from this series if possible. https://patchwork.freedesktop.org/series/53800/ I've confirmed it packs the shaders you were looking at as expected once you patch 2 is applied. The series makes this code much more flexible (for future improvements) and

Re: [Mesa-dev] [RFC v2 4/4] nir: add crude live range analysis to nir_compact_varyings()

2018-12-09 Thread Timothy Arceri
0 %) Private memory VGPRs: 0 -> 0 (0.00 %) Scratch size: 0 -> 0 (0.00 %) dwords per thread Code Size: 1053168 -> 1055452 (0.22 %) bytes LDS: 0 -> 0 (0.00 %) blocks Max Waves: 4636 -> 4616 (-0.43 %) Wait states: 0 -> 0 (0.00 %) On 10/12/18 11:31 am, Timothy Arceri wrote: vkpipeline-d

[Mesa-dev] [PATCH v2 3/4] nir: rewrite varying component packing

2018-12-09 Thread Timothy Arceri
There are three reasons for the rewrite. 1. Adding support for packing tess patch varyings in a sane way. 2. Making use of qsort allowing the code to be much easier to follow. 3. Allowing us to add a crude live range analysis for deciding which components should be packed together. This

[Mesa-dev] [RFC v2 4/4] nir: add crude live range analysis to nir_compact_varyings()

2018-12-09 Thread Timothy Arceri
vkpipeline-db results RADV (VEGA): Totals from affected shaders: SGPRS: 27168 -> 27872 (2.59 %) VGPRS: 24180 -> 24056 (-0.51 %) Spilled SGPRs: 28 -> 24 (-14.29 %) Spilled VGPRs: 0 -> 0 (0.00 %) Private memory VGPRs: 0 -> 0 (0.00 %) Scratch size: 0 -> 0 (0.00 %) dwords per thread Code Size:

[Mesa-dev] [PATCH v2 1/4] nir: add support for marking used patches when packing varyings

2018-12-09 Thread Timothy Arceri
This adds support needed for marking the varyings as used but we don't actually support packing patches in this patch. --- src/compiler/nir/nir_linking_helpers.c | 73 ++ 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c

[Mesa-dev] [PATCH v2 2/4] nir: add is_packing_supported_for_type() helper

2018-12-09 Thread Timothy Arceri
This will be used in the following patches to determine if we support packing the components of a varying. --- src/compiler/nir/nir_linking_helpers.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/src/compiler/nir/nir_linking_helpers.c

Re: [Mesa-dev] [PATCH 2/3] mesa/st/nir: fix missing nir_compact_varyings

2018-12-09 Thread Timothy Arceri
to make this a little clearer. Also please add: Fixes: dbd52585fa9f ("st/nir: Disable varying packing when doing transform feedback.") With those changes patches 1-2 are: Reviewed-by: Timothy Arceri Thanks for looking into this. even if NumVaryings is zero. So make the check abo

Re: [Mesa-dev] [PATCH 07/20] nir: add guess trip count support to loop analysis

2018-12-07 Thread Timothy Arceri
On 8/12/18 11:16 am, Jason Ekstrand wrote: On Thu, Dec 6, 2018 at 9:08 PM Timothy Arceri <mailto:tarc...@itsqueeze.com>> wrote: This detects an induction variable used as an array index to guess the trip count of the loop. This enables us to do a partial unroll of the loop,

[Mesa-dev] [PATCH 08/20] nir: add new partially_unrolled bool to nir_loop

2018-12-06 Thread Timothy Arceri
In order to stop continuously partially unrolling the same loop we add the bool partialy_unrolled to nir_loop, we add it here rather than in nir_loop_info because nir_loop_info is only set via loop analysis and is intended to be cleared before each analysis. Also nir_loop_info is never cloned. ---

[Mesa-dev] [PATCH 10/20] nir: calculate trip count for more loops

2018-12-06 Thread Timothy Arceri
This adds support to loop analysis for loops where the induction variable is compared to the result of min(variable, constant). For example: for (int i = 0; i < imin(x, 4); i++) ... We add a new bool to the loop terminator struct in order to differentiate terminators with this exit

[Mesa-dev] [PATCH 17/20] nir: add helper to return inversion op of a comparision

2018-12-06 Thread Timothy Arceri
This will be used to help find the trip count of loops that look like the following: while (a < x && i < 8) { ... i++; } Where the NIR will end up looking something like this: vec1 32 ssa_0 = load_const (0x /* 0.00 */) vec1 32 ssa_1 = load_const (0x0008

[Mesa-dev] [PATCH 14/20] nir: reword code comment

2018-12-06 Thread Timothy Arceri
Reviewed-by: Thomas Helland --- src/compiler/nir/nir_loop_analyze.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index fbaa638884..ef69422c12 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++

[Mesa-dev] [PATCH 13/20] nir: in loop analysis track actual control flow type

2018-12-06 Thread Timothy Arceri
This will allow us to improve analysis to find more induction variables. Reviewed-by: Thomas Helland --- src/compiler/nir/nir_loop_analyze.c | 34 ++--- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/compiler/nir/nir_loop_analyze.c

[Mesa-dev] [PATCH 16/20] nir: simplify the loop analysis trip count code a little

2018-12-06 Thread Timothy Arceri
Here we create a helper is_supported_terminator_condition() and use that rather than embedding all the trip count code inside a switch. The new helper will also be used in a following patch. --- src/compiler/nir/nir_loop_analyze.c | 172 +++- 1 file changed, 93

[Mesa-dev] [PATCH 15/20] nir: detect more induction variables

2018-12-06 Thread Timothy Arceri
This allows loop analysis to detect inductions variables 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 */ vec1 32 ssa_8 = phi block_0: ssa_4, block_7: ssa_20 vec1 32 ssa_9 =

[Mesa-dev] [PATCH 11/20] nir: unroll some loops with a variable limit

2018-12-06 Thread Timothy Arceri
For some loops can have a single terminator but the exact trip count is still unknown. For example: for (int i = 0; i < imin(x, 4); i++) ... Shader-db results radeonsi (all affected are from Tropico 5): Totals from affected shaders: SGPRS: 200 -> 208 (4.00 %) VGPRS: 164 -> 148 (-9.76

[Mesa-dev] [PATCH 19/20] nir: pass nir_op to calculate_iterations()

2018-12-06 Thread Timothy Arceri
Rather than getting this from the alu instruction this allows us some flexibility. In the following pass we instead pass the inverse op. --- src/compiler/nir/nir_loop_analyze.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git

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

2018-12-06 Thread Timothy Arceri
Here we rework force_unroll_array_access() so that we can reused the induction variable detection in a following patch. Reviewed-by: Thomas Helland --- src/compiler/nir/nir_loop_analyze.c | 49 - 1 file changed, 35 insertions(+), 14 deletions(-) diff --git

[Mesa-dev] [PATCH 09/20] nir: add partial loop unrolling support

2018-12-06 Thread Timothy Arceri
This adds partial loop unrolling support and makes use of a guessed trip count based on array access. The code is written so that we could use partial unrolling more generally, but for now it's only use when we have guessed the trip count. We use partial unrolling for this guessed trip count

[Mesa-dev] [PATCH 20/20] nir: find induction/limit vars in iand instructions

2018-12-06 Thread Timothy Arceri
This will be used to help find the trip count of loops that look like the following: while (a < x && i < 8) { ... i++; } Where the NIR will end up looking something like this: vec1 32 ssa_0 = load_const (0x /* 0.00 */) vec1 32 ssa_1 = load_const (0x0008

[Mesa-dev] [PATCH 18/20] nir: add get_induction_and_limit_vars() helper to loop analysis

2018-12-06 Thread Timothy Arceri
This helps make find_trip_count() a little easier to follow but will also be used by a following patch. --- src/compiler/nir/nir_loop_analyze.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/compiler/nir/nir_loop_analyze.c

[Mesa-dev] [PATCH 12/20] nir: add if opt opt_if_loop_last_continue()

2018-12-06 Thread Timothy Arceri
vate memory VGPRs: 0 -> 0 (0.00 %) Scratch size: 0 -> 0 (0.00 %) dwords per thread Code Size: 8524 -> 8488 (-0.42 %) bytes LDS: 0 -> 0 (0.00 %) blocks Max Waves: 7 -> 7 (0.00 %) Wait states: 0 -> 0 (0.00 %) v2: (Timothy Arceri): - allow for continues in either branch - move

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

2018-12-06 Thread Timothy Arceri
Reviewed-by: Thomas Helland --- src/compiler/nir/nir_opt_loop_unroll.c | 115 ++--- 1 file changed, 64 insertions(+), 51 deletions(-) diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c index c267c185b6..8406880204 100644 ---

[Mesa-dev] [PATCH 07/20] nir: add guess trip count support to loop analysis

2018-12-06 Thread Timothy Arceri
This detects an induction variable used as an array index to guess the trip count of the loop. This enables us to do a partial unroll of the loop, with can eventually result in the loop being eliminated. --- src/compiler/nir/nir.h | 4 ++ src/compiler/nir/nir_loop_analyze.c | 78

[Mesa-dev] [PATCH 03/20] nir: add a new nir_cf_list_clone_and_reinsert() helper

2018-12-06 Thread Timothy Arceri
Reviewed-by: Thomas Helland --- src/compiler/nir/nir_control_flow.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/compiler/nir/nir_control_flow.h b/src/compiler/nir/nir_control_flow.h index 2ea460e5df..9111b30a29 100644 --- a/src/compiler/nir/nir_control_flow.h +++

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

2018-12-06 Thread Timothy Arceri
Reviewed-by: Thomas Helland --- src/compiler/nir/nir_opt_loop_unroll.c | 76 ++ 1 file changed, 28 insertions(+), 48 deletions(-) diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c index 0e9966320b..c267c185b6 100644 ---

[Mesa-dev] [PATCH 01/20] nir: small tidy ups for nir_loop_analyze()

2018-12-06 Thread Timothy Arceri
Reviewed-by: Thomas Helland --- src/compiler/nir/nir_loop_analyze.c | 31 ++--- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 9c3fd2f286..c779383b36 100644 ---

[Mesa-dev] [PATCH 02/20] nir: clarify some nit_loop_info member names

2018-12-06 Thread Timothy Arceri
Following commits will introduce additional fields such as guessed_trip_count. Renaming these will help avoid confusion as our unrolling feature set grows. Reviewed-by: Thomas Helland --- src/compiler/nir/nir.h | 8 +--- src/compiler/nir/nir_loop_analyze.c| 14

[Mesa-dev] More loop unrolling

2018-12-06 Thread Timothy Arceri
This is three series combined. I've sent the first two previously (patch 1-11 & patch 12-15) and they have been partially reviewed by Thomas. Please see the previous sends of those series for cover letters. There is a small bug fix in patch 11 that was discovered by some new piglit tests [1].

Re: [Mesa-dev] [PATCH v3 1/3] nir: add glsl_replace_vector_type()

2018-12-03 Thread Timothy Arceri
Ping! on the series ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] Partial loop unrolling support v2

2018-12-03 Thread Timothy Arceri
Ping! On 20/11/18 7:14 pm, Timothy Arceri wrote: This series add support for partial loop unrolling for loops with an unknown trip count. The new partial_unroll function allows the caller to specifiy how may times the loop should be unrolled and then the loop is inserted in the innermost

[Mesa-dev] [PATCH 1/2] nir: add support for marking used patches when packing varyings

2018-12-03 Thread Timothy Arceri
This adds support needed for marking the varyings as used but we don't actually support packing patches in this patch. --- src/compiler/nir/nir_linking_helpers.c | 73 ++ 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c

[Mesa-dev] [RFC 2/2] nir: rewrite varying component packing

2018-12-03 Thread Timothy Arceri
There are three reasons for the rewrite. 1. Adding support for packing tess patch varyings in a sane way. 2. Making use of qsort allowing the code to be much easier to follow. 3. Adding a crude live range analysis for deciding which components should be packed together. We could simplify

Re: [Mesa-dev] Representing explicit memory layouts in NIR

2018-11-30 Thread Timothy Arceri
On 1/12/18 9:11 am, Jason Ekstrand wrote: All, This week, I've been working on trying to move UBO and SSBO access in NIR over to deref instructions.  I'm hoping that this will allow us to start doing alias analysis and copy-propagation on it.  The passes we have in NIR *should* be able to

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

2018-11-30 Thread Timothy Arceri
On 30/11/18 5:38 pm, Thomas Helland wrote: 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 incremented in both

Re: [Mesa-dev] [PATCH 1/2] nir: add a compiler option for disabling float comparison simplifications

2018-11-29 Thread Timothy Arceri
On Thu, Nov 29, 2018, at 7:47 AM, Connor Abbott wrote: > On Thu, Nov 29, 2018 at 4:22 PM Jason Ekstrand wrote: > > > > Can you provide some context for this? Those rules are already flagged > > "inexact" (that's what the ~ means) so they won't apply to anything that's > > "precise" or

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

2018-11-28 Thread 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 incremented in both branches of an if rather than in a main loop block. For example: loop { block block_1

[Mesa-dev] [PATCH 2/4] nir: in loop analysis track actual control flow type

2018-11-27 Thread Timothy Arceri
This will allow us to improve analysis to find more induction variables. --- src/compiler/nir/nir_loop_analyze.c | 34 ++--- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index

<    1   2   3   4   5   6   7   8   9   10   >