Basic support
This commit is contained in:
@@ -46,6 +46,9 @@ struct topology_c {
|
||||
// HSA topology
|
||||
struct topology_h {
|
||||
int32_t compute_units;
|
||||
int32_t num_shader_engines;
|
||||
int32_t simds_per_cu;
|
||||
int32_t num_xcc;
|
||||
};
|
||||
|
||||
// Intel topology
|
||||
|
||||
@@ -22,10 +22,15 @@ struct agent_info {
|
||||
char vendor_name[64];
|
||||
char device_mkt_name[64];
|
||||
uint32_t max_clock_freq;
|
||||
uint32_t compute_unit;
|
||||
// Memory
|
||||
uint32_t bus_width;
|
||||
uint32_t lds_size;
|
||||
uint64_t global_size;
|
||||
// Topology
|
||||
uint32_t compute_unit;
|
||||
uint32_t num_shader_engines;
|
||||
uint32_t simds_per_cu;
|
||||
uint32_t num_xcc;
|
||||
};
|
||||
|
||||
#define RET_IF_HSA_ERR(err) { \
|
||||
@@ -115,6 +120,17 @@ hsa_status_t agent_callback(hsa_agent_t agent, void *data) {
|
||||
err = hsa_agent_get_info(agent, (hsa_agent_info_t) HSA_AMD_AGENT_INFO_MEMORY_WIDTH, &info->bus_width);
|
||||
RET_IF_HSA_ERR(err);
|
||||
|
||||
err = hsa_agent_get_info(agent, (hsa_agent_info_t) HSA_AMD_AGENT_INFO_NUM_SHADER_ENGINES, &info->num_shader_engines);
|
||||
RET_IF_HSA_ERR(err);
|
||||
|
||||
err = hsa_agent_get_info(agent, (hsa_agent_info_t) HSA_AMD_AGENT_INFO_NUM_SIMDS_PER_CU, &info->simds_per_cu);
|
||||
RET_IF_HSA_ERR(err);
|
||||
|
||||
err = hsa_agent_get_info(agent, (hsa_agent_info_t) HSA_AMD_AGENT_INFO_NUM_XCC, &info->num_xcc);
|
||||
RET_IF_HSA_ERR(err);
|
||||
|
||||
// TODO: Matrix cores?
|
||||
|
||||
// We will check against zero to see if it was set beforehand.
|
||||
info->global_size = 0;
|
||||
info->lds_size = 0;
|
||||
@@ -130,6 +146,11 @@ 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_xcc = info.num_xcc;
|
||||
|
||||
printf("%d %d %d\n", topo->num_shader_engines, topo->simds_per_cu, topo->num_xcc);
|
||||
|
||||
return topo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user