[Mesa-dev] [PATCH] i965: Move brw_init_compaction_tables() to brw_create_compiler().

Jason Ekstrand jason at jlekstrand.net
Fri Mar 10 01:13:17 UTC 2017


On Thu, Mar 9, 2017 at 4:06 PM, Matt Turner <mattst88 at gmail.com> wrote:

> ... so that we can avoid threading complications or unnecessary
> compaction table initializations (which just consists of setting some
> pointers based on devinfo->gen).
> ---
>  src/mesa/drivers/dri/i965/brw_compiler.c   | 2 ++
>  src/mesa/drivers/dri/i965/brw_eu.c         | 2 --
>  src/mesa/drivers/dri/i965/brw_eu_compact.c | 5 -----
>  3 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_compiler.c
> b/src/mesa/drivers/dri/i965/brw_compiler.c
> index fcad570..cd9473f 100644
> --- a/src/mesa/drivers/dri/i965/brw_compiler.c
> +++ b/src/mesa/drivers/dri/i965/brw_compiler.c
> @@ -23,6 +23,7 @@
>
>  #include "brw_compiler.h"
>  #include "brw_shader.h"
> +#include "brw_eu.h"
>  #include "common/gen_debug.h"
>  #include "compiler/nir/nir.h"
>  #include "main/errors.h"
> @@ -107,6 +108,7 @@ brw_compiler_create(void *mem_ctx, const struct
> gen_device_info *devinfo)
>
>     brw_fs_alloc_reg_sets(compiler);
>     brw_vec4_alloc_reg_set(compiler);
> +   brw_init_compaction_tables(devinfo);
>

Technically, you can call brw_compiler_create arbitrarily many times but
that's not really a thing that's going to happen.  It's also not really a
problem.  So

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>


>
>     compiler->precise_trig = env_var_as_boolean("INTEL_PRECISE_TRIG",
> false);
>
> diff --git a/src/mesa/drivers/dri/i965/brw_eu.c
> b/src/mesa/drivers/dri/i965/brw_eu.c
> index 1344f2b..d280ffd 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu.c
> @@ -354,8 +354,6 @@ brw_init_codegen(const struct gen_device_info *devinfo,
>     p->loop_stack_array_size = 16;
>     p->loop_stack = rzalloc_array(mem_ctx, int, p->loop_stack_array_size);
>     p->if_depth_in_loop = rzalloc_array(mem_ctx, int,
> p->loop_stack_array_size);
> -
> -   brw_init_compaction_tables(devinfo);
>  }
>
>
> diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c
> b/src/mesa/drivers/dri/i965/brw_eu_compact.c
> index 5b8e9b2..b2af76d 100644
> --- a/src/mesa/drivers/dri/i965/brw_eu_compact.c
> +++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c
> @@ -76,7 +76,6 @@
>  #include "brw_shader.h"
>  #include "intel_asm_annotation.h"
>  #include "common/gen_debug.h"
> -#include "util/u_atomic.h" /* for p_atomic_cmpxchg */
>
>  static const uint32_t g45_control_index_table[32] = {
>     0b00000000000000000,
> @@ -1345,10 +1344,6 @@ update_gen4_jump_count(const struct gen_device_info
> *devinfo, brw_inst *insn,
>  void
>  brw_init_compaction_tables(const struct gen_device_info *devinfo)
>  {
> -   static bool initialized;
> -   if (initialized || p_atomic_cmpxchg(&initialized, false, true) !=
> false)
> -      return;
> -
>     assert(g45_control_index_table[ARRAY_SIZE(g45_control_index_table) -
> 1] != 0);
>     assert(g45_datatype_table[ARRAY_SIZE(g45_datatype_table) - 1] != 0);
>     assert(g45_subreg_table[ARRAY_SIZE(g45_subreg_table) - 1] != 0);
> --
> 2.10.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170309/6b76d3bb/attachment.html>


More information about the mesa-dev mailing list