Skip to content

Commit f6bb115

Browse files
committed
memattrs: add CXL memory tier type
Combined with others for CXL-DRAM, CXL-NVM (and all non actually possible yet). Signed-off-by: Brice Goglin <[email protected]>
1 parent 50efae7 commit f6bb115

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

doc/hwloc.doxy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,8 +1936,9 @@ subtype <tt>DRAM</tt> (for usual main memory),
19361936
<tt>HBM</tt> (high-bandwidth memory),
19371937
<tt>SPM</tt> (specific-purpose memory, usually reserved for some custom applications),
19381938
<tt>NVM</tt> (non-volatile memory when used as main memory),
1939-
<tt>MCDRAM</tt> (on KNL)
1940-
or <tt>GPUMemory</tt> (on POWER architecture with NVIDIA GPU memory shared over NVLink).
1939+
<tt>MCDRAM</tt> (on KNL),
1940+
<tt>GPUMemory</tt> (on POWER architecture with NVIDIA GPU memory shared over NVLink),
1941+
<tt>CXL-DRAM</tt> or <tt>CXL-NVM</tt> for CXL DRAM or non-volatile memory.
19411942
</li>
19421943
<li>Groups:
19431944
subtype <tt>Cluster</tt>, <tt>Module</tt>, <tt>Tile</tt>, <tt>Compute Unit</tt>,

hwloc/memattrs.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,8 @@ enum hwloc_memory_tier_type_e {
12261226
HWLOC_MEMORY_TIER_DRAM = 1UL<<1,
12271227
HWLOC_MEMORY_TIER_GPU = 1UL<<2,
12281228
HWLOC_MEMORY_TIER_SPM = 1UL<<3, /* Specific-Purpose Memory is usually HBM, we'll use BW to confirm or force*/
1229-
HWLOC_MEMORY_TIER_NVM = 1UL<<4
1229+
HWLOC_MEMORY_TIER_NVM = 1UL<<4,
1230+
HWLOC_MEMORY_TIER_CXL = 1UL<<5
12301231
};
12311232
typedef unsigned long hwloc_memory_tier_type_t;
12321233
#define HWLOC_MEMORY_TIER_UNKNOWN 0UL
@@ -1239,6 +1240,12 @@ static const char * hwloc_memory_tier_type_snprintf(hwloc_memory_tier_type_t typ
12391240
case HWLOC_MEMORY_TIER_GPU: return "GPUMemory";
12401241
case HWLOC_MEMORY_TIER_SPM: return "SPM";
12411242
case HWLOC_MEMORY_TIER_NVM: return "NVM";
1243+
case HWLOC_MEMORY_TIER_CXL:
1244+
case HWLOC_MEMORY_TIER_CXL|HWLOC_MEMORY_TIER_DRAM: return "CXL-DRAM";
1245+
case HWLOC_MEMORY_TIER_CXL|HWLOC_MEMORY_TIER_HBM: return "CXL-HBM";
1246+
case HWLOC_MEMORY_TIER_CXL|HWLOC_MEMORY_TIER_GPU: return "CXL-GPUMemory";
1247+
case HWLOC_MEMORY_TIER_CXL|HWLOC_MEMORY_TIER_SPM: return "CXL-SPM";
1248+
case HWLOC_MEMORY_TIER_CXL|HWLOC_MEMORY_TIER_NVM: return "CXL-NVM";
12421249
default: return NULL;
12431250
}
12441251
}
@@ -1333,6 +1340,14 @@ hwloc__group_memory_tiers(hwloc_topology_t topology,
13331340
nodeinfos[i].type = HWLOC_MEMORY_TIER_NVM;
13341341
else if (daxtype && !strcmp(daxtype, "SPM"))
13351342
nodeinfos[i].type = HWLOC_MEMORY_TIER_SPM;
1343+
/* add CXL flag */
1344+
if (hwloc_obj_get_info_by_name(node, "CXLDevice") != NULL) {
1345+
/* CXL is always SPM for now. HBM and DRAM not possible here yet.
1346+
* Hence remove all but NVM first.
1347+
*/
1348+
nodeinfos[i].type &= HWLOC_MEMORY_TIER_NVM;
1349+
nodeinfos[i].type |= HWLOC_MEMORY_TIER_CXL;
1350+
}
13361351

13371352
/* get local bandwidth */
13381353
imtg = NULL;

0 commit comments

Comments
 (0)