summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagar Ghuge <[email protected]>2020-01-23 22:24:37 -0800
committerMarge Bot <[email protected]>2020-03-23 17:57:57 +0000
commit1a5ac646cefaa183ee09b149ea31931d122c0f51 (patch)
tree469dbb65f1989e329fadc077a211399427ee8c74
parentb3dd54fe13b52f3e9a7265ba047135e823c476c7 (diff)
intel/compiler: Track patch count threshold
Return the number of patches to accumulate before an 8_PATCH mode thread is launched. v2: (Kenneth Graunke) - Track patch count threshold instead of input control points. Signed-off-by: Sagar Ghuge <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3563>
-rw-r--r--src/intel/compiler/brw_compiler.h3
-rw-r--r--src/intel/compiler/brw_vec4_tcs.cpp30
2 files changed, 33 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index 181f7e5f67c..2048cfaafcc 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -1136,6 +1136,9 @@ struct brw_tcs_prog_data
/** Number vertices in output patch */
int instances;
+
+ /** Track patch count threshold */
+ int patch_count_threshold;
};
diff --git a/src/intel/compiler/brw_vec4_tcs.cpp b/src/intel/compiler/brw_vec4_tcs.cpp
index 1cba9a9a4f8..fcefe395f2d 100644
--- a/src/intel/compiler/brw_vec4_tcs.cpp
+++ b/src/intel/compiler/brw_vec4_tcs.cpp
@@ -323,6 +323,34 @@ vec4_tcs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
}
}
+/**
+ * Return the number of patches to accumulate before an 8_PATCH mode thread is
+ * launched. In cases with a large number of input control points and a large
+ * amount of VS outputs, the VS URB space needed to store an entire 8 patches
+ * worth of data can be prohibitive, so it can be beneficial to launch threads
+ * early.
+ *
+ * See the 3DSTATE_HS::Patch Count Threshold documentation for the recommended
+ * values. Note that 0 means to "disable" early dispatch, meaning to wait for
+ * a full 8 patches as normal.
+ */
+static int
+get_patch_count_threshold(int input_control_points)
+{
+ if (input_control_points <= 4)
+ return 0;
+ else if (input_control_points <= 6)
+ return 5;
+ else if (input_control_points <= 8)
+ return 4;
+ else if (input_control_points <= 10)
+ return 3;
+ else if (input_control_points <= 14)
+ return 2;
+
+ /* Return patch count 1 for PATCHLIST_15 - PATCHLIST_32 */
+ return 1;
+}
extern "C" const unsigned *
brw_compile_tcs(const struct brw_compiler *compiler,
@@ -362,6 +390,8 @@ brw_compile_tcs(const struct brw_compiler *compiler,
bool has_primitive_id =
nir->info.system_values_read & (1 << SYSTEM_VALUE_PRIMITIVE_ID);
+ prog_data->patch_count_threshold = get_patch_count_threshold(key->input_vertices);
+
if (compiler->use_tcs_8_patch &&
nir->info.tess.tcs_vertices_out <= (devinfo->gen >= 12 ? 32 : 16) &&
2 + has_primitive_id + key->input_vertices <= 31) {