Skip to content

Commit daa3850

Browse files
committed
xml/export/v2: add Backend info back to OS devices
Keep the Backend info in the root. Signed-off-by: Brice Goglin <[email protected]>
1 parent 206b32e commit daa3850

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

hwloc/topology-xml.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,23 @@ hwloc__xml_export_object_contents (hwloc__xml_export_state_t state, hwloc_topolo
21462146

21472147
for(i=0; i<obj->infos_count; i++)
21482148
hwloc__xml_export_info_attr(state, obj->infos[i].name, obj->infos[i].value);
2149+
2150+
if (v2export && obj->type == HWLOC_OBJ_OS_DEVICE && obj->subtype && !hwloc_obj_get_info_by_name(obj, "Backend")) {
2151+
/* v2 gpus had Backend inside the object itself */
2152+
if (!strcmp(obj->subtype, "CUDA")) {
2153+
hwloc__xml_export_info_attr_safe(state, "Backend", "CUDA");
2154+
} else if (!strcmp(obj->subtype, "NVML")) {
2155+
hwloc__xml_export_info_attr_safe(state, "Backend", "NVML");
2156+
} else if (!strcmp(obj->subtype, "OpenCL")) {
2157+
hwloc__xml_export_info_attr_safe(state, "Backend", "OpenCL");
2158+
} else if (!strcmp(obj->subtype, "RSMI")) {
2159+
hwloc__xml_export_info_attr_safe(state, "Backend", "RSMI");
2160+
} else if (!strcmp(obj->subtype, "LevelZero")) {
2161+
hwloc__xml_export_info_attr_safe(state, "Backend", "LevelZero");
2162+
} else if (!strcmp(obj->subtype, "Display")) {
2163+
hwloc__xml_export_info_attr_safe(state, "Backend", "GL");
2164+
}
2165+
}
21492166
if (obj->userdata && topology->userdata_export_cb)
21502167
topology->userdata_export_cb((void*) state, topology, obj);
21512168
}

0 commit comments

Comments
 (0)