turnip: Add a TU_DEBUG=perf debug option.

For doing performance investigation, I often find it useful to have a "are
we tripping over any of our performance TODOs?" flag, so add it and use it
in a few of the TODOs.

This also greatly cleans up the deqp-vk logs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16316>
This commit is contained in:
Emma Anholt 2022-04-18 10:10:10 -07:00 committed by Marge Bot
parent 0d0165db8e
commit b282d504a4
6 changed files with 20 additions and 5 deletions

View File

@ -1794,6 +1794,7 @@ tu_copy_image_to_image(struct tu_cmd_buffer *cmd,
/* Both formats use UBWC and so neither can be reinterpreted.
* TODO: We could do an in-place decompression of the dst instead.
*/
perf_debug(cmd->device, "TODO: Do in-place UBWC decompression for UBWC->UBWC blits");
use_staging_blit = true;
}
@ -2534,7 +2535,9 @@ tu_clear_gmem_attachments(struct tu_cmd_buffer *cmd,
const struct tu_subpass *subpass = cmd->state.subpass;
struct tu_cs *cs = &cmd->draw_cs;
/* TODO: swap the loops for smaller cmdstream */
if (rect_count > 1)
perf_debug(cmd->device, "TODO: Swap tu_clear_gmem_attachments() loop for smaller command stream");
for (unsigned i = 0; i < rect_count; i++) {
unsigned x1 = rects[i].rect.offset.x;
unsigned y1 = rects[i].rect.offset.y;

View File

@ -3476,11 +3476,10 @@ tu_CmdNextSubpass2(VkCommandBuffer commandBuffer,
if (pass->attachments[a].gmem_offset < 0)
continue;
/* TODO:
* check if the resolved attachment is needed by later subpasses,
/* check if the resolved attachment is needed by later subpasses,
* if it is, should be doing a GMEM->GMEM resolve instead of GMEM->MEM->GMEM..
*/
tu_finishme("missing GMEM->GMEM resolve path\n");
perf_debug(cmd->device, "TODO: missing GMEM->GMEM resolve path\n");
tu_load_gmem_attachment(cmd, cs, a, false, true);
}
}
@ -3711,8 +3710,10 @@ tu6_calculate_lrz_state(struct tu_cmd_buffer *cmd,
* so if there is a depth write - LRZ must be disabled.
*/
if (z_write_enable) {
perf_debug(cmd->device, "Invalidating LRZ due to ALWAYS/NOT_EQUAL");
disable_lrz = true;
} else {
perf_debug(cmd->device, "Skipping LRZ due to ALWAYS/NOT_EQUAL");
temporary_disable_lrz = true;
}
break;
@ -3750,8 +3751,10 @@ tu6_calculate_lrz_state(struct tu_cmd_buffer *cmd,
lrz_direction != TU_LRZ_UNKNOWN &&
cmd->state.lrz.prev_direction != lrz_direction) {
if (z_write_enable) {
perf_debug(cmd->device, "Invalidating LRZ due to direction change");
disable_lrz = true;
} else {
perf_debug(cmd->device, "Skipping LRZ due to direction change");
temporary_disable_lrz = true;
}
}

View File

@ -335,6 +335,7 @@ static const struct debug_control tu_debug_options[] = {
{ "noubwc", TU_DEBUG_NOUBWC },
{ "nomultipos", TU_DEBUG_NOMULTIPOS },
{ "nolrz", TU_DEBUG_NOLRZ },
{ "perf", TU_DEBUG_PERF },
{ "perfc", TU_DEBUG_PERFC },
{ "flushall", TU_DEBUG_FLUSHALL },
{ "syncdraw", TU_DEBUG_SYNCDRAW },

View File

@ -96,8 +96,10 @@ tu_render_pass_add_subpass_dep(struct tu_render_pass *pass,
if (src == dst)
return;
if (dep_invalid_for_gmem(dep))
if (dep_invalid_for_gmem(dep)) {
perf_debug((struct tu_device *)pass->base.device, "Disabling gmem rendering due to invalid subpass dependency");
pass->gmem_pixels = 0;
}
struct tu_subpass_barrier *dst_barrier;
if (dst == VK_SUBPASS_EXTERNAL) {

View File

@ -270,6 +270,7 @@ enum tu_debug_flags
TU_DEBUG_UNALIGNED_STORE = 1 << 15,
TU_DEBUG_LAYOUT = 1 << 16,
TU_DEBUG_LOG_SKIP_GMEM_OPS = 1 << 17,
TU_DEBUG_PERF = 1 << 18,
};
struct tu_instance

View File

@ -329,4 +329,9 @@ tu6_pack_border_color(struct bcolor_entry *bcolor, const VkClearColorValue *val,
void
tu_dbg_log_gmem_load_store_skips(struct tu_device *device);
#define perf_debug(device, fmt, ...) do { \
if (unlikely((device)->instance->debug_flags & TU_DEBUG_PERF)) \
mesa_log(MESA_LOG_WARN, (MESA_LOG_TAG), (fmt), ##__VA_ARGS__); \
} while(0)
#endif /* TU_UTIL_H */