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 <sagar.ghuge@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3563>
This commit is contained in:
@@ -1136,6 +1136,9 @@ struct brw_tcs_prog_data
|
|||||||
|
|
||||||
/** Number vertices in output patch */
|
/** Number vertices in output patch */
|
||||||
int instances;
|
int instances;
|
||||||
|
|
||||||
|
/** Track patch count threshold */
|
||||||
|
int patch_count_threshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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 *
|
extern "C" const unsigned *
|
||||||
brw_compile_tcs(const struct brw_compiler *compiler,
|
brw_compile_tcs(const struct brw_compiler *compiler,
|
||||||
@@ -362,6 +390,8 @@ brw_compile_tcs(const struct brw_compiler *compiler,
|
|||||||
bool has_primitive_id =
|
bool has_primitive_id =
|
||||||
nir->info.system_values_read & (1 << SYSTEM_VALUE_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 &&
|
if (compiler->use_tcs_8_patch &&
|
||||||
nir->info.tess.tcs_vertices_out <= (devinfo->gen >= 12 ? 32 : 16) &&
|
nir->info.tess.tcs_vertices_out <= (devinfo->gen >= 12 ? 32 : 16) &&
|
||||||
2 + has_primitive_id + key->input_vertices <= 31) {
|
2 + has_primitive_id + key->input_vertices <= 31) {
|
||||||
|
Reference in New Issue
Block a user