intel: Let drivers call brw_nir_lower_cs_intrinsics()
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 28 Apr 2020 20:28:02 +0000 (13:28 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 1 May 2020 19:50:37 +0000 (12:50 -0700)
The motivating factor is: this lowering may cause
nir_intrinsic_load_local_group_size intrinsics to be added to the
shader, and by moving this around we make possible for the drivers to
lower that intrinsic by themselves.

Iris will do just that in a later patch for implementing variable
group size.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4794>

src/gallium/drivers/iris/iris_program.c
src/intel/compiler/brw_fs.cpp
src/intel/vulkan/anv_pipeline.c
src/mesa/drivers/dri/i965/brw_cs.c

index d1cee0df841acb9e966438631b61ba8f9001791a..8cf15c6ced95f179e1371518d09769f4afca789a 100644 (file)
@@ -1947,6 +1947,8 @@ iris_compile_cs(struct iris_context *ice,
 
    nir_shader *nir = nir_shader_clone(mem_ctx, ish->nir);
 
+   NIR_PASS_V(nir, brw_nir_lower_cs_intrinsics);
+
    iris_setup_uniforms(compiler, mem_ctx, nir, prog_data, &system_values,
                        &num_system_values, &num_cbufs);
 
index 8725b78a647d0b56700ffd9e500e1c719ab7a2f7..089fb15a48e19236be0de1eedb8d113634908b1b 100644 (file)
@@ -9006,8 +9006,6 @@ compile_cs_to_nir(const struct brw_compiler *compiler,
    nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
    brw_nir_apply_key(shader, compiler, &key->base, dispatch_width, true);
 
-   NIR_PASS_V(shader, brw_nir_lower_cs_intrinsics);
-
    NIR_PASS_V(shader, brw_nir_lower_simd, dispatch_width);
 
    /* Clean up after the local index and ID calculations. */
index 5c6150d26ff51e40c28a076c302580a012ce0fd0..0767aaf6cf26ba19986f16e7b4a6f5677ad3a181 100644 (file)
@@ -1660,6 +1660,7 @@ anv_pipeline_compile_cs(struct anv_compute_pipeline *pipeline,
                  nir_var_mem_shared, shared_type_info);
       NIR_PASS_V(stage.nir, nir_lower_explicit_io,
                  nir_var_mem_shared, nir_address_format_32bit_offset);
+      NIR_PASS_V(stage.nir, brw_nir_lower_cs_intrinsics);
 
       stage.num_stats = 1;
       stage.code = brw_compile_cs(compiler, pipeline->base.device, mem_ctx,
index 1f2fefc2fb37dd592836685e4aa129af0a338922..d6aceccd9f0cd5c4ae373542e958b8c13a223d0d 100644 (file)
@@ -118,6 +118,8 @@ brw_codegen_cs_prog(struct brw_context *brw,
          gl_ctx->Const.MaxComputeVariableGroupInvocations;
    }
 
+   brw_nir_lower_cs_intrinsics(nir);
+
    char *error_str;
    program = brw_compile_cs(brw->screen->compiler, brw, mem_ctx, key,
                             &prog_data, nir, st_index, NULL, &error_str);