Module: Mesa Branch: main Commit: f69863fd5a75fdd2c5906707c7ed9c289b4abcd8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f69863fd5a75fdd2c5906707c7ed9c289b4abcd8
Author: Hans-Kristian Arntzen <p...@arntzen-software.no> Date: Wed Aug 9 11:53:04 2023 +0200 radv/radeonsi: Forward correct GPU instance to umr. Signed-off-by: Hans-Kristian Arntzen <p...@arntzen-software.no> Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> Reviewed-by: Marek Olšák <marek.ol...@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24578> --- src/amd/common/ac_debug.c | 8 +++++--- src/amd/common/ac_debug.h | 3 ++- src/amd/vulkan/radv_debug.c | 21 ++++++++++++++------- src/gallium/drivers/radeonsi/si_debug.c | 2 +- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/amd/common/ac_debug.c b/src/amd/common/ac_debug.c index 85cdf1c9bf4..48040f85726 100644 --- a/src/amd/common/ac_debug.c +++ b/src/amd/common/ac_debug.c @@ -1137,16 +1137,18 @@ static int compare_wave(const void *p1, const void *p2) } /* Return wave information. "waves" should be a large enough array. */ -unsigned ac_get_wave_info(enum amd_gfx_level gfx_level, +unsigned ac_get_wave_info(enum amd_gfx_level gfx_level, const struct radeon_info *info, struct ac_wave_info waves[AC_MAX_WAVES_PER_CHIP]) { #ifdef _WIN32 return 0; #else - char line[2000], cmd[128]; + char line[2000], cmd[256]; unsigned num_waves = 0; - sprintf(cmd, "umr -O halt_waves -wa %s", gfx_level >= GFX10 ? "gfx_0.0.0" : "gfx"); + sprintf(cmd, "umr --by-pci %04x:%02x:%02x.%01x -O halt_waves -wa %s", + info->pci.domain, info->pci.bus, info->pci.dev, info->pci.func, + gfx_level >= GFX10 ? "gfx_0.0.0" : "gfx"); FILE *p = popen(cmd, "r"); if (!p) diff --git a/src/amd/common/ac_debug.h b/src/amd/common/ac_debug.h index 71ee58eea40..a45c16ede5b 100644 --- a/src/amd/common/ac_debug.h +++ b/src/amd/common/ac_debug.h @@ -8,6 +8,7 @@ #define AC_DEBUG_H #include "amd_family.h" +#include "ac_gpu_info.h" #include <stdbool.h> #include <stdint.h> @@ -56,7 +57,7 @@ void ac_parse_ib(FILE *f, uint32_t *ib, int num_dw, const int *trace_ids, unsign bool ac_vm_fault_occurred(enum amd_gfx_level gfx_level, uint64_t *old_dmesg_timestamp, uint64_t *out_addr); -unsigned ac_get_wave_info(enum amd_gfx_level gfx_level, +unsigned ac_get_wave_info(enum amd_gfx_level gfx_level, const struct radeon_info *info, struct ac_wave_info waves[AC_MAX_WAVES_PER_CHIP]); void ac_print_gpuvm_fault_status(FILE *output, enum amd_gfx_level gfx_level, diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c index c8b08175900..76ba55c4de2 100644 --- a/src/amd/vulkan/radv_debug.c +++ b/src/amd/vulkan/radv_debug.c @@ -504,7 +504,7 @@ radv_dump_queue_state(struct radv_queue *queue, const char *dump_dir, FILE *f) if (!(queue->device->instance->debug_flags & RADV_DEBUG_NO_UMR)) { struct ac_wave_info waves[AC_MAX_WAVES_PER_CHIP]; enum amd_gfx_level gfx_level = device->physical_device->rad_info.gfx_level; - unsigned num_waves = ac_get_wave_info(gfx_level, waves); + unsigned num_waves = ac_get_wave_info(gfx_level, &device->physical_device->rad_info, waves); fprintf(f, COLOR_CYAN "The number of active waves = %u" COLOR_RESET "\n\n", num_waves); @@ -653,36 +653,43 @@ radv_dump_device_name(const struct radv_device *device, FILE *f) static void radv_dump_umr_ring(const struct radv_queue *queue, FILE *f) { +#ifndef _WIN32 const enum amd_ip_type ring = radv_queue_ring(queue); const struct radv_device *device = queue->device; - char cmd[128]; + char cmd[256]; /* TODO: Dump compute ring. */ if (ring != AMD_IP_GFX) return; - sprintf(cmd, "umr -RS %s 2>&1", device->physical_device->rad_info.gfx_level >= GFX10 ? "gfx_0.0.0" : "gfx"); - + sprintf(cmd, "umr --by-pci %04x:%02x:%02x.%01x -RS %s 2>&1", device->physical_device->bus_info.domain, + device->physical_device->bus_info.bus, device->physical_device->bus_info.dev, + device->physical_device->bus_info.func, + device->physical_device->rad_info.gfx_level >= GFX10 ? "gfx_0.0.0" : "gfx"); fprintf(f, "\nUMR GFX ring:\n\n"); radv_dump_cmd(cmd, f); +#endif } static void radv_dump_umr_waves(struct radv_queue *queue, FILE *f) { +#ifndef _WIN32 enum amd_ip_type ring = radv_queue_ring(queue); struct radv_device *device = queue->device; - char cmd[128]; + char cmd[256]; /* TODO: Dump compute ring. */ if (ring != AMD_IP_GFX) return; - sprintf(cmd, "umr -O bits,halt_waves -go 0 -wa %s -go 1 2>&1", + sprintf(cmd, "umr --by-pci %04x:%02x:%02x.%01x -O bits,halt_waves -go 0 -wa %s -go 1 2>&1", + device->physical_device->bus_info.domain, device->physical_device->bus_info.bus, + device->physical_device->bus_info.dev, device->physical_device->bus_info.func, device->physical_device->rad_info.gfx_level >= GFX10 ? "gfx_0.0.0" : "gfx"); - fprintf(f, "\nUMR GFX waves:\n\n"); radv_dump_cmd(cmd, f); +#endif } static bool diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c index 511bf51e852..3199d70b5d3 100644 --- a/src/gallium/drivers/radeonsi/si_debug.c +++ b/src/gallium/drivers/radeonsi/si_debug.c @@ -941,7 +941,7 @@ static void si_print_annotated_shader(struct si_shader *shader, struct ac_wave_i static void si_dump_annotated_shaders(struct si_context *sctx, FILE *f) { struct ac_wave_info waves[AC_MAX_WAVES_PER_CHIP]; - unsigned num_waves = ac_get_wave_info(sctx->gfx_level, waves); + unsigned num_waves = ac_get_wave_info(sctx->gfx_level, &sctx->screen->info, waves); fprintf(f, COLOR_CYAN "The number of active waves = %u" COLOR_RESET "\n\n", num_waves);