v3d: add a debug option to optimize shader compile times

Particularly, this makes compilation stop as soon as we get a
valid shader and doesn't try to optimize spilling by trying
fallback strategies.

Might come in handy to reduce CTS execution time, for example,
dEQP-VK.ssbo.layout.random.8bit.all_per_block_buffers.6 goes from
43m46.715s down to 15m15.068s.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20601>
This commit is contained in:
Iago Toral Quiroga
2023-01-09 08:13:06 +01:00
committed by Marge Bot
parent dee97e7b99
commit f40afe9883
3 changed files with 5 additions and 1 deletions

View File

@@ -98,6 +98,8 @@ static const struct debug_named_value debug_control[] = {
#endif
{ "no_merge_jobs", V3D_DEBUG_NO_MERGE_JOBS,
"Don't try to merge subpasses in the same job even if they share framebuffer configuration (v3dv only)" },
{ "opt_compile_time", V3D_DEBUG_OPT_COMPILE_TIME,
"Don't try to reduce shader spilling, might improve compile times with expensive shaders." },
DEBUG_NAMED_VALUE_END
};

View File

@@ -68,6 +68,7 @@ extern uint32_t v3d_mesa_debug;
#define V3D_DEBUG_DOUBLE_BUFFER (1 << 22)
#define V3D_DEBUG_CACHE (1 << 23)
#define V3D_DEBUG_NO_MERGE_JOBS (1 << 24)
#define V3D_DEBUG_OPT_COMPILE_TIME (1 << 25)
#define V3D_DEBUG_SHADERS (V3D_DEBUG_TGSI | V3D_DEBUG_NIR | \
V3D_DEBUG_VIR | V3D_DEBUG_QPU | \

View File

@@ -1853,7 +1853,8 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
*/
if (c->compilation_result == V3D_COMPILATION_SUCCEEDED) {
if (c->spills == 0 ||
strategies[strat].min_threads == 4) {
strategies[strat].min_threads == 4 ||
V3D_DBG(OPT_COMPILE_TIME)) {
best_c = c;
break;
} else if (c->spills + c->fills <