radv/radeonsi: Forward correct GPU instance to umr.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24578>
This commit is contained in:
Hans-Kristian Arntzen 2023-08-09 11:53:04 +02:00 committed by Marge Bot
parent fd80140723
commit f69863fd5a
4 changed files with 22 additions and 12 deletions

View file

@ -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)

View file

@ -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,

View file

@ -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

View file

@ -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);