Skip to content

Commit a4fa5ea

Browse files
committed
feat: added p90 step time logic for GEMM and HBM tail latencies
1 parent 7aca2ce commit a4fa5ea

2 files changed

Lines changed: 78 additions & 16 deletions

File tree

Ironwood/src/benchmark_hbm.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,24 @@ def single_device_hbm_copy_calculate_metrics(
8989
)
9090
print(
9191
f"Tensor size: {tensor_size_bytes / 1024**2} MB, "
92-
f"time taken (median): {time_statistics.statistics["p50"]:.4f} ms, "
93-
f"bandwidth (median): {statistics.statistics["p50"]:.3f} GB/s"
92+
f"time taken (p10): {time_statistics.statistics['p10']:.4f} ms, "
93+
f"time taken (median): {time_statistics.statistics['p50']:.4f} ms, "
94+
f"time taken (p90): {time_statistics.statistics['p90']:.4f} ms, "
95+
f"bandwidth (p10): {statistics.statistics['p10']:.3f} GB/s, "
96+
f"bandwidth (median): {statistics.statistics['p50']:.3f} GB/s, "
97+
f"bandwidth (p90): {statistics.statistics['p90']:.3f} GB/s"
9498
)
9599
print()
96100
# Gather the metrics to report.
97101
metadata.update(
98102
{
99103
"tensor_size_gbytes": tensor_size_gbytes,
104+
"time_taken(p10,ms)": time_statistics.statistics["p10"],
105+
"time_taken(median,ms)": time_statistics.statistics["p50"],
106+
"time_taken(p90,ms)": time_statistics.statistics["p90"],
107+
"bandwidth(p10,GB/s)": statistics.statistics["p10"],
108+
"bandwidth(median,GB/s)": statistics.statistics["p50"],
109+
"bandwidth(p90,GB/s)": statistics.statistics["p90"],
100110
}
101111
)
102112
metrics.update(time_statistics.serialize_statistics())

Ironwood/src/benchmark_utils.py

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ def _calculate_statistics(self) -> Dict[str, float]:
858858
if not self.metrics_list:
859859
return {} # Return an empty dict if metrics_list is empty
860860
return {
861+
"p10": np.percentile(self.metrics_list, 10),
861862
"p50": np.percentile(self.metrics_list, 50),
862863
"p90": np.percentile(self.metrics_list, 90),
863864
"p95": np.percentile(self.metrics_list, 95),
@@ -1288,28 +1289,63 @@ def unified_flops_metrics(
12881289
dtype_prefix = f"[{dtype}] " if dtype is not None else ""
12891290
print(
12901291
f"{dtype_prefix}"
1291-
f"Total floating-point ops: {total_flops}, Step Time (median): "
1292-
f"{average_time_ms_statistics.statistics["p50"]:.2f}, "
1292+
f"Total floating-point ops: {total_flops}, "
1293+
f"Step Time (p10): "
1294+
f"{average_time_ms_statistics.statistics['p10']:.2f}, "
1295+
f"Step Time (median): "
1296+
f"{average_time_ms_statistics.statistics['p50']:.2f}, "
1297+
f"Step Time (p90): "
1298+
f"{average_time_ms_statistics.statistics['p90']:.2f}, "
1299+
f"Throughput (p10): "
1300+
f"{tflops_per_sec_statistics.statistics['p10']:.2f}"
1301+
f" TFLOP / second / device, "
12931302
f"Throughput (median): "
1294-
f"{tflops_per_sec_statistics.statistics["p50"]:.2f}"
1303+
f"{tflops_per_sec_statistics.statistics['p50']:.2f}"
1304+
f" TFLOP / second / device, "
1305+
f"Throughput (p90): "
1306+
f"{tflops_per_sec_statistics.statistics['p90']:.2f}"
12951307
f" TFLOP / second / device, "
1308+
f"TotalThroughput (p10): "
1309+
f"{tflops_per_sec_all_devices_statistics.statistics['p10']:.2f} "
1310+
f"TFLOP / second, "
12961311
f"TotalThroughput (median): "
1297-
f"{tflops_per_sec_all_devices_statistics.statistics["p50"]:.2f} "
1312+
f"{tflops_per_sec_all_devices_statistics.statistics['p50']:.2f} "
1313+
f"TFLOP / second, "
1314+
f"TotalThroughput (p90): "
1315+
f"{tflops_per_sec_all_devices_statistics.statistics['p90']:.2f} "
12981316
f"TFLOP / second, "
1299-
f"MFU: {mfu_statistics.statistics["p50"]:.2%}"
1317+
f"MFU (p10): {mfu_statistics.statistics['p10']:.2%}, "
1318+
f"MFU (median): {mfu_statistics.statistics['p50']:.2%}, "
1319+
f"MFU (p90): {mfu_statistics.statistics['p90']:.2%}"
13001320
)
13011321

13021322
# Gather the metrics to report.
13031323
metadata.update(
13041324
{
1325+
"StepTime(p10,ms)": average_time_ms_statistics.statistics["p10"],
13051326
"StepTime(median,ms)": average_time_ms_statistics.statistics["p50"],
1327+
"StepTime(p90,ms)": average_time_ms_statistics.statistics["p90"],
1328+
"Throughput(p10,TFLOP/s/device)": (
1329+
tflops_per_sec_statistics.statistics["p10"]
1330+
),
13061331
"Throughput(median,TFLOP/s/device)": (
13071332
tflops_per_sec_statistics.statistics["p50"]
13081333
),
1334+
"Throughput(p90,TFLOP/s/device)": (
1335+
tflops_per_sec_statistics.statistics["p90"]
1336+
),
1337+
"TotalThroughput(p10,TFLOP/s)": (
1338+
tflops_per_sec_all_devices_statistics.statistics["p10"]
1339+
),
13091340
"TotalThroughput(median,TFLOP/s)": (
13101341
tflops_per_sec_all_devices_statistics.statistics["p50"]
13111342
),
1312-
"MFU": mfu_statistics.statistics["p50"],
1343+
"TotalThroughput(p90,TFLOP/s)": (
1344+
tflops_per_sec_all_devices_statistics.statistics["p90"]
1345+
),
1346+
"MFU(p10)": mfu_statistics.statistics["p10"],
1347+
"MFU(median)": mfu_statistics.statistics["p50"],
1348+
"MFU(p90)": mfu_statistics.statistics["p90"],
13131349
"total_flops": total_flops,
13141350
}
13151351
)
@@ -1373,25 +1409,41 @@ def unified_bytes_metrics(
13731409
type_prefix = f"[d={dtype}] "
13741410
print(
13751411
f"{type_prefix}"
1376-
f"Total bytes: {total_bytes}, Step Time (median): "
1377-
f"{average_time_ms_statistics.statistics["p50"]:.2f}, "
1378-
f"Throughput (median):"
1379-
f"{gigabytes_per_sec_statistics.statistics["p50"]:.2f} "
1380-
f"GBytes / second / device, "
1381-
f"TotalThroughput (median): "
1382-
f"{gigabytes_per_sec_all_devices_statistics.statistics["p50"]:.2f} "
1383-
f"GBytes / second"
1412+
f"Total bytes: {total_bytes}, "
1413+
f"Step Time (p10): {average_time_ms_statistics.statistics['p10']:.2f}, "
1414+
f"Step Time (median): {average_time_ms_statistics.statistics['p50']:.2f}, "
1415+
f"Step Time (p90): {average_time_ms_statistics.statistics['p90']:.2f}, "
1416+
f"Throughput (p10): {gigabytes_per_sec_statistics.statistics['p10']:.2f} GBytes / second / device, "
1417+
f"Throughput (median): {gigabytes_per_sec_statistics.statistics['p50']:.2f} GBytes / second / device, "
1418+
f"Throughput (p90): {gigabytes_per_sec_statistics.statistics['p90']:.2f} GBytes / second / device, "
1419+
f"TotalThroughput (p10): {gigabytes_per_sec_all_devices_statistics.statistics['p10']:.2f} GBytes / second, "
1420+
f"TotalThroughput (median): {gigabytes_per_sec_all_devices_statistics.statistics['p50']:.2f} GBytes / second, "
1421+
f"TotalThroughput (p90): {gigabytes_per_sec_all_devices_statistics.statistics['p90']:.2f} GBytes / second"
13841422
)
13851423
print()
13861424
metadata.update(
13871425
{
1426+
"StepTime(p10,ms)": average_time_ms_statistics.statistics["p10"],
13881427
"StepTime(median,ms)": average_time_ms_statistics.statistics["p50"],
1428+
"StepTime(p90,ms)": average_time_ms_statistics.statistics["p90"],
1429+
"Throughput(p10,GBytes/s/device)": (
1430+
gigabytes_per_sec_statistics.statistics["p10"]
1431+
),
13891432
"Throughput(median,GBytes/s/device)": (
13901433
gigabytes_per_sec_statistics.statistics["p50"]
13911434
),
1435+
"Throughput(p90,GBytes/s/device)": (
1436+
gigabytes_per_sec_statistics.statistics["p90"]
1437+
),
1438+
"TotalThroughput(p10,GBytes/s)": (
1439+
gigabytes_per_sec_all_devices_statistics.statistics["p10"]
1440+
),
13921441
"TotalThroughput(median,GBytes/s)": (
13931442
gigabytes_per_sec_all_devices_statistics.statistics["p50"]
13941443
),
1444+
"TotalThroughput(p90,GBytes/s)": (
1445+
gigabytes_per_sec_all_devices_statistics.statistics["p90"]
1446+
),
13951447
"total_bytes": total_bytes,
13961448
}
13971449
)

0 commit comments

Comments
 (0)