intel/fs: Add an option to lower variable group size in backend
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 28 Apr 2020 16:47:45 +0000 (09:47 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 1 May 2020 19:50:28 +0000 (12:50 -0700)
Adding this since Iris will handle variable group size parameters by
itself.

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/intel/compiler/brw_compiler.h
src/intel/compiler/brw_fs_nir.cpp
src/mesa/drivers/dri/i965/intel_screen.c

index 1045ef5076fd4ae57ff0ed81f9eba4ff95e39091..43a7c9918ea0048b99225a64a7ad23aeeefb3d98 100644 (file)
@@ -125,6 +125,12 @@ struct brw_compiler {
     * back-end compiler.
     */
    bool compact_params;
+
+   /**
+    * Whether or not the driver wants variable group size to be lowered by the
+    * back-end compiler.
+    */
+   bool lower_variable_group_size;
 };
 
 /**
index e4fbaa51050028a3fbb4dff0ce129deda3f10645..852626c617255e89e466fcff4d09cc5a7023a1bb 100644 (file)
@@ -105,7 +105,8 @@ fs_visitor::nir_setup_uniforms()
       assert(uniforms == prog_data->nr_params);
 
       uint32_t *param;
-      if (nir->info.cs.local_size_variable) {
+      if (nir->info.cs.local_size_variable &&
+          compiler->lower_variable_group_size) {
          param = brw_stage_prog_data_add_params(prog_data, 3);
          for (unsigned i = 0; i < 3; i++) {
             param[i] = (BRW_PARAM_BUILTIN_WORK_GROUP_SIZE_X + i);
@@ -3869,6 +3870,8 @@ fs_visitor::nir_emit_cs_intrinsic(const fs_builder &bld,
    }
 
    case nir_intrinsic_load_local_group_size: {
+      assert(compiler->lower_variable_group_size);
+      assert(nir->info.cs.local_size_variable);
       for (unsigned i = 0; i < 3; i++) {
          bld.MOV(retype(offset(dest, bld, i), BRW_REGISTER_TYPE_UD),
             group_size[i]);
index 822393f67312744ad02ac895de7ff3e2a1b21fd9..f2fbe70cada25a85a8ef479e1d422c2dda987491 100644 (file)
@@ -2823,6 +2823,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *dri_screen)
 
    screen->compiler->supports_pull_constants = true;
    screen->compiler->compact_params = true;
+   screen->compiler->lower_variable_group_size = true;
 
    screen->has_exec_fence =
      intel_get_boolean(screen, I915_PARAM_HAS_EXEC_FENCE);