From 6690343e101a3d3444d8cc2eca8a0a19c690d430 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 15 Jul 2024 15:19:33 -0400 Subject: [PATCH] zink: match shader-db report.py format this way we can use shader-db report.py to analyze shader-db changes for zink with the vk driver of our choosing. requires corresponding report.py relaxations to be useful, the idea was to change zink a bit and change report.py a bit and meet in the middle with something useful for arbitrary vulkan drivers. the output isn't too pretty but it works, synthetic example on nvk: Instruction count HURT: shaders/glmark/1-1.shader_test vertex: 42 -> 43 (2.38%) total Instruction count in shared programs: 7135 -> 7136 (0.01%) Instruction count in affected programs: 42 -> 43 (2.38%) helped: 0 HURT: 1 total Code Size in shared programs: 114160 -> 114160 (0.00%) Code Size in affected programs: 0 -> 0 helped: 0 HURT: 0 total Number of GPRs in shared programs: 2677 -> 2677 (0.00%) Number of GPRs in affected programs: 0 -> 0 helped: 0 HURT: 0 total SLM Size in shared programs: 0 -> 0 SLM Size in affected programs: 0 -> 0 helped: 0 HURT: 0 Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/zink/zink_program.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/zink/zink_program.c b/src/gallium/drivers/zink/zink_program.c index 16da53bb9f2..8d211a13dbc 100644 --- a/src/gallium/drivers/zink/zink_program.c +++ b/src/gallium/drivers/zink/zink_program.c @@ -1385,7 +1385,7 @@ print_pipeline_stats(struct zink_screen *screen, VkPipeline pipeline, struct uti } FILE *f = u_memstream_get(&stream); - fprintf(f, "type: %s", props[e].name); + fprintf(f, "%s shader: ", props[e].name); VkPipelineExecutableStatisticKHR *stats = NULL; VKSCR(GetPipelineExecutableStatisticsKHR)(screen->dev, &info, &count, NULL); stats = calloc(count, sizeof(VkPipelineExecutableStatisticKHR)); @@ -1399,19 +1399,21 @@ print_pipeline_stats(struct zink_screen *screen, VkPipeline pipeline, struct uti VKSCR(GetPipelineExecutableStatisticsKHR)(screen->dev, &info, &count, stats); for (unsigned i = 0; i < count; i++) { - fprintf(f, ", "); + if (i) + fprintf(f, ", "); + switch (stats[i].format) { case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR: - fprintf(f, "%s: %u", stats[i].name, stats[i].value.b32); + fprintf(f, "%u %s", stats[i].value.b32, stats[i].name); break; case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR: - fprintf(f, "%s: %" PRIi64, stats[i].name, stats[i].value.i64); + fprintf(f, "%" PRIi64 " %s", stats[i].value.i64, stats[i].name); break; case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR: - fprintf(f, "%s: %" PRIu64, stats[i].name, stats[i].value.u64); + fprintf(f, "%" PRIu64 " %s", stats[i].value.u64, stats[i].name); break; case VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR: - fprintf(f, "%s: %g", stats[i].name, stats[i].value.f64); + fprintf(f, "%g %s", stats[i].value.f64, stats[i].name); break; default: unreachable("unknown statistic");