Add matrix cores

This commit is contained in:
Dr-Noob
2025-10-26 10:42:25 +01:00
parent 2fa90179b4
commit b5dc30d4b3
3 changed files with 14 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ enum {
ATTRIBUTE_FREQUENCY, // ALL ATTRIBUTE_FREQUENCY, // ALL
ATTRIBUTE_PEAK, // ALL ATTRIBUTE_PEAK, // ALL
ATTRIBUTE_COMPUTE_UNITS, // HSA ATTRIBUTE_COMPUTE_UNITS, // HSA
ATTRIBUTE_MATRIX_CORES, // HSA
ATTRIBUTE_XCDS, // HSA ATTRIBUTE_XCDS, // HSA
ATTRIBUTE_LDS_SIZE, // HSA ATTRIBUTE_LDS_SIZE, // HSA
ATTRIBUTE_STREAMINGMP, // CUDA ATTRIBUTE_STREAMINGMP, // CUDA
@@ -71,6 +72,7 @@ static const AttributeField ATTRIBUTE_INFO[] = {
{ ATTRIBUTE_FREQUENCY, "Max Frequency:", "Max Freq.:" }, { ATTRIBUTE_FREQUENCY, "Max Frequency:", "Max Freq.:" },
{ ATTRIBUTE_PEAK, "Peak Performance:", "Peak Perf.:" }, { ATTRIBUTE_PEAK, "Peak Performance:", "Peak Perf.:" },
{ ATTRIBUTE_COMPUTE_UNITS, "Compute Units (CUs):", "CUs" }, { ATTRIBUTE_COMPUTE_UNITS, "Compute Units (CUs):", "CUs" },
{ ATTRIBUTE_MATRIX_CORES, "Matrix Cores: ", "Matrix Cores:" },
{ ATTRIBUTE_XCDS, "XCDs:", "XCDs" }, { ATTRIBUTE_XCDS, "XCDs:", "XCDs" },
{ ATTRIBUTE_LDS_SIZE, "LDS size:", "LDS:" }, { ATTRIBUTE_LDS_SIZE, "LDS size:", "LDS:" },
{ ATTRIBUTE_STREAMINGMP, "SMs:", "SMs:" }, { ATTRIBUTE_STREAMINGMP, "SMs:", "SMs:" },
@@ -490,6 +492,7 @@ bool print_gpufetch_amd(struct gpu_info* gpu, STYLE s, struct color** cs, struct
char* uarch = get_str_uarch_hsa(gpu->arch); char* uarch = get_str_uarch_hsa(gpu->arch);
char* manufacturing_process = get_str_process(gpu->arch); char* manufacturing_process = get_str_process(gpu->arch);
char* cus = get_str_cu(gpu); char* cus = get_str_cu(gpu);
char* matrix_cores = get_str_matrix_cores(gpu);
char* xcds = get_str_xcds(gpu); char* xcds = get_str_xcds(gpu);
char* max_frequency = get_str_freq(gpu); char* max_frequency = get_str_freq(gpu);
char* bus_width = get_str_bus_width(gpu); char* bus_width = get_str_bus_width(gpu);
@@ -504,6 +507,7 @@ bool print_gpufetch_amd(struct gpu_info* gpu, STYLE s, struct color** cs, struct
setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process); setAttribute(art, ATTRIBUTE_TECHNOLOGY, manufacturing_process);
setAttribute(art, ATTRIBUTE_FREQUENCY, max_frequency); setAttribute(art, ATTRIBUTE_FREQUENCY, max_frequency);
setAttribute(art, ATTRIBUTE_COMPUTE_UNITS, cus); setAttribute(art, ATTRIBUTE_COMPUTE_UNITS, cus);
setAttribute(art, ATTRIBUTE_MATRIX_CORES, matrix_cores);
if (xcds != NULL) { if (xcds != NULL) {
setAttribute(art, ATTRIBUTE_XCDS, xcds); setAttribute(art, ATTRIBUTE_XCDS, xcds);
} }

View File

@@ -31,6 +31,7 @@ struct agent_info {
uint32_t num_shader_engines; uint32_t num_shader_engines;
uint32_t simds_per_cu; uint32_t simds_per_cu;
uint32_t num_xcc; // Acccelerator Complex Dies (XCDs) uint32_t num_xcc; // Acccelerator Complex Dies (XCDs)
uint32_t matrix_cores; // Cores with WMMA/MFMA capabilities
}; };
#define RET_IF_HSA_ERR(err) { \ #define RET_IF_HSA_ERR(err) { \
@@ -149,6 +150,9 @@ struct topology_h* get_topology_info(struct agent_info info) {
topo->num_shader_engines = info.num_shader_engines; // not printed at the moment 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->simds_per_cu = info.simds_per_cu; // not printed at the moment
topo->num_xcc = info.num_xcc; topo->num_xcc = info.num_xcc;
// Old GPUs (GCN I guess) might not have matrix cores.
// Not sure what would happen here?
topo->matrix_cores = topo->compute_units * topo->simds_per_cu;
return topo; return topo;
} }
@@ -232,4 +236,9 @@ char* get_str_xcds(struct gpu_info* gpu) {
return NULL; return NULL;
} }
return get_str_generic(gpu->topo_h->num_xcc); return get_str_generic(gpu->topo_h->num_xcc);
}
char* get_str_matrix_cores(struct gpu_info* gpu) {
// TODO: Show XX (WMMA/MFMA)
return get_str_generic(gpu->topo_h->matrix_cores);
} }

View File

@@ -6,5 +6,6 @@
struct gpu_info* get_gpu_info_hsa(int gpu_idx); struct gpu_info* get_gpu_info_hsa(int gpu_idx);
char* get_str_cu(struct gpu_info* gpu); char* get_str_cu(struct gpu_info* gpu);
char* get_str_xcds(struct gpu_info* gpu); char* get_str_xcds(struct gpu_info* gpu);
char* get_str_matrix_cores(struct gpu_info* gpu);
#endif #endif