Skip to content

Commit bf702a5

Browse files
authored
simplify hwToGpuKey: split on first '-' instead of explicit suffix list (#294)
1 parent c52b513 commit bf702a5

1 file changed

Lines changed: 5 additions & 19 deletions

File tree

packages/db/src/etl/normalizers.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,17 @@ import {
1212
export { GPU_KEYS };
1313

1414
/**
15-
* Strip known hw suffixes (-trt, -multinode-slurm, -amds, etc.) from a raw
16-
* hardware identifier and return the canonical lowercase GPU key.
15+
* Strip everything from the first `-` onwards (and any trailing `_<digits>`
16+
* runner-index suffix) from a raw hardware identifier and return the canonical
17+
* lowercase GPU key. All keys in `GPU_KEYS` are single-segment, so this is
18+
* sufficient; unknown bases return `null`.
1719
*
1820
* @param hw - Raw hardware string from the benchmark artifact (e.g. `"h200-nv"`, `"mi355x-amds"`).
1921
* @returns The canonical GPU key (e.g. `"h200"`, `"mi355x"`), or `null` if the
2022
* stripped base is not in `GPU_KEYS`.
2123
*/
2224
export function hwToGpuKey(hw: string): string | null {
23-
const base = hw
24-
.toLowerCase()
25-
.replace(/_\d+$/, '') // strip runner index suffix (e.g. mi355x-amd_0 → mi355x-amd)
26-
.replace(/-trt$/, '')
27-
.replace(/-multinode-slurm$/, '')
28-
.replace(/-multinode$/, '')
29-
.replace(/-nvs$/, '')
30-
.replace(/-disagg$/, '')
31-
.replace(/-amds$/, '')
32-
.replace(/-amd$/, '')
33-
.replace(/-nvd$/, '')
34-
.replace(/-dgxc-slurm$/, '')
35-
.replace(/-dgxc$/, '')
36-
.replace(/-nb$/, '')
37-
.replace(/-dsv4$/, '')
38-
.replace(/-cw$/, '')
39-
.replace(/-nv$/, '');
25+
const base = hw.toLowerCase().split('-')[0];
4026
return GPU_KEYS.has(base) ? base : null;
4127
}
4228

0 commit comments

Comments
 (0)