[Mesa-dev] [PATCH 1/3] i965/vec4: Always use NIR

Jason Ekstrand jason at jlekstrand.net
Mon Sep 21 15:18:41 PDT 2015


GLSL IR vs. NIR shader-db results for vec4 programs on i965:

   total instructions in shared programs: 1499395 -> 1408109 (-6.09%)
   instructions in affected programs:     1309372 -> 1218086 (-6.97%)
   helped:                                6359
   HURT:                                  4528

GLSL IR vs. NIR shader-db results for vec4 programs on G4x:

   total instructions in shared programs: 1436866 -> 1345580 (-6.35%)
   instructions in affected programs:     1265868 -> 1174582 (-7.21%)
   helped:                                6359
   HURT:                                  4528

GLSL IR vs. NIR shader-db results for vec4 programs on Iron Lake:

   total instructions in shared programs: 1436856 -> 1345570 (-6.35%)
   instructions in affected programs:     1265858 -> 1174572 (-7.21%)
   helped:                                6359
   HURT:                                  4528

GLSL IR vs. NIR shader-db results for vec4 programs on Sandy Bridge:

   total instructions in shared programs: 2020573 -> 1822601 (-9.80%)
   instructions in affected programs:     1883334 -> 1685362 (-10.51%)
   helped:                                13328
   HURT:                                  3594

GLSL IR vs. NIR shader-db results for vec4 programs on Ivy Bridge:

   total instructions in shared programs: 1852351 -> 1683842 (-9.10%)
   instructions in affected programs:     1686970 -> 1518461 (-9.99%)
   helped:                                12677
   HURT:                                  3940

GLSL IR vs. NIR shader-db results for vec4 programs on Bay Trail:

   total instructions in shared programs: 1852351 -> 1683842 (-9.10%)
   instructions in affected programs:     1686970 -> 1518461 (-9.99%)
   helped:                                12677
   HURT:                                  3940

GLSL IR vs. NIR shader-db results for vec4 programs on Haswell:

   total instructions in shared programs: 1852351 -> 1683842 (-9.10%)
   instructions in affected programs:     1686970 -> 1518461 (-9.99%)
   helped:                                12677
   HURT:                                  3940
---
 src/mesa/drivers/dri/i965/brw_shader.cpp |  3 +--
 src/mesa/drivers/dri/i965/brw_vec4.cpp   | 35 +++++++-------------------------
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index c311a03..bfb7287 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -140,8 +140,7 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo)
       if (devinfo->gen < 7)
          compiler->glsl_compiler_options[i].EmitNoIndirectSampler = true;
 
-      if (is_scalar || brw_env_var_as_boolean("INTEL_USE_NIR", true))
-         compiler->glsl_compiler_options[i].NirOptions = nir_options;
+      compiler->glsl_compiler_options[i].NirOptions = nir_options;
    }
 
    return compiler;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index ed49cd3..8f8f03c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1755,9 +1755,6 @@ vec4_visitor::emit_shader_time_write(int shader_time_subindex, src_reg value)
 bool
 vec4_visitor::run()
 {
-   bool use_vec4_nir =
-      compiler->glsl_compiler_options[stage].NirOptions != NULL;
-
    sanity_param_count = prog->Parameters->NumParameters;
 
    if (shader_time_index >= 0)
@@ -1767,19 +1764,10 @@ vec4_visitor::run()
 
    emit_prolog();
 
-   if (use_vec4_nir) {
-      assert(prog->nir != NULL);
-      emit_nir_code();
-      if (failed)
-         return false;
-   } else if (shader) {
-      /* Generate VS IR for main().  (the visitor only descends into
-       * functions called "main").
-       */
-      visit_instructions(shader->base.ir);
-   } else {
-      emit_program_code();
-   }
+   assert(prog->nir != NULL);
+   emit_nir_code();
+   if (failed)
+      return false;
    base_ir = NULL;
 
    emit_thread_end();
@@ -1792,18 +1780,9 @@ vec4_visitor::run()
     * that we have reladdr computations available for CSE, since we'll
     * often do repeated subexpressions for those.
     */
-   if (shader || use_vec4_nir) {
-      move_grf_array_access_to_scratch();
-      move_uniform_array_access_to_pull_constants();
-   } else {
-      /* The ARB_vertex_program frontend emits pull constant loads directly
-       * rather than using reladdr, so we don't need to walk through all the
-       * instructions looking for things to move.  There isn't anything.
-       *
-       * We do still need to split things to vec4 size.
-       */
-      split_uniform_registers();
-   }
+   move_grf_array_access_to_scratch();
+   move_uniform_array_access_to_pull_constants();
+
    pack_uniform_registers();
    move_push_constants_to_pull_constants();
    split_virtual_grfs();
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list