From 711936be813bb84b1b77d1446a07595e8e872ba4 Mon Sep 17 00:00:00 2001 From: Dr-Noob Date: Sun, 26 Oct 2025 10:27:51 +0100 Subject: [PATCH] Show XCDs --- src/common/printer.cpp | 6 ++++++ src/hsa/hsa.cpp | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/common/printer.cpp b/src/common/printer.cpp index cd3e452..88469ec 100644 --- a/src/common/printer.cpp +++ b/src/common/printer.cpp @@ -48,6 +48,7 @@ enum { ATTRIBUTE_FREQUENCY, // ALL ATTRIBUTE_PEAK, // ALL ATTRIBUTE_COMPUTE_UNITS, // HSA + ATTRIBUTE_XCDS, // HSA ATTRIBUTE_LDS_SIZE, // HSA ATTRIBUTE_STREAMINGMP, // CUDA ATTRIBUTE_CORESPERMP, // CUDA @@ -70,6 +71,7 @@ static const AttributeField ATTRIBUTE_INFO[] = { { ATTRIBUTE_FREQUENCY, "Max Frequency:", "Max Freq.:" }, { ATTRIBUTE_PEAK, "Peak Performance:", "Peak Perf.:" }, { ATTRIBUTE_COMPUTE_UNITS, "Compute Units (CUs):", "CUs" }, + { ATTRIBUTE_XCDS, "XCDs:", "XCDs" } { ATTRIBUTE_LDS_SIZE, "LDS size:", "LDS:" }, { ATTRIBUTE_STREAMINGMP, "SMs:", "SMs:" }, { ATTRIBUTE_CORESPERMP, "Cores/SM:", "Cores/SM:" }, @@ -488,6 +490,7 @@ bool print_gpufetch_amd(struct gpu_info* gpu, STYLE s, struct color** cs, struct char* uarch = get_str_uarch_hsa(gpu->arch); char* manufacturing_process = get_str_process(gpu->arch); char* cus = get_str_cu(gpu); + char* xcds = get_str_xcds(gpu); char* max_frequency = get_str_freq(gpu); char* bus_width = get_str_bus_width(gpu); char* mem_size = get_str_memory_size(gpu); @@ -501,6 +504,9 @@ bool print_gpufetch_amd(struct gpu_info* gpu, STYLE s, struct color** cs, struct setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process); setAttribute(art, ATTRIBUTE_FREQUENCY, max_frequency); setAttribute(art, ATTRIBUTE_COMPUTE_UNITS, cus); + if (xcds != NULL) { + setAttribute(art, ATTRIBUTE_XCDS, xcds); + } setAttribute(art, ATTRIBUTE_LDS_SIZE, lds_size); setAttribute(art, ATTRIBUTE_MEMORY, mem_size); setAttribute(art, ATTRIBUTE_BUS_WIDTH, bus_width); diff --git a/src/hsa/hsa.cpp b/src/hsa/hsa.cpp index 61ff652..414e700 100644 --- a/src/hsa/hsa.cpp +++ b/src/hsa/hsa.cpp @@ -30,7 +30,7 @@ struct agent_info { uint32_t compute_unit; uint32_t num_shader_engines; uint32_t simds_per_cu; - uint32_t num_xcc; + uint32_t num_xcc; // Acccelerator Complex Dies (XCDs) }; #define RET_IF_HSA_ERR(err) { \ @@ -146,12 +146,10 @@ struct topology_h* get_topology_info(struct agent_info info) { struct topology_h* topo = (struct topology_h*) emalloc(sizeof(struct topology_h)); topo->compute_units = info.compute_unit; - topo->num_shader_engines = info.num_shader_engines; - topo->simds_per_cu = info.simds_per_cu; + topo->num_shader_engines = info.num_shader_engines; // not printed at the moment + topo->simds_per_cu = info.simds_per_cu; // not printed at the moment topo->num_xcc = info.num_xcc; - printf("%d %d %d\n", topo->num_shader_engines, topo->simds_per_cu, topo->num_xcc); - return topo; } @@ -226,3 +224,12 @@ struct gpu_info* get_gpu_info_hsa(int gpu_idx) { char* get_str_cu(struct gpu_info* gpu) { return get_str_generic(gpu->topo_h->compute_units); } + +char* get_str_xcds(struct gpu_info* gpu) { + // If there is a single XCD, then we dont want to + // print it. + if (gpu->topo_h->num_xcc == 1) { + return NULL; + } + return get_str_generic(gpu->topo_h->num_xcc); +} \ No newline at end of file