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 <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30194>
This commit is contained in:
Alyssa Rosenzweig
2024-07-15 15:19:33 -04:00
committed by Marge Bot
parent d45e2f3f15
commit 6690343e10
+8 -6
View File
@@ -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");