Skip to content

Commit 35d0141

Browse files
authored
[ROCm][CI] add warmup to mem_util test before measurement (vllm-project#43236)
Signed-off-by: Divakar Verma <divakar.verma@amd.com>
1 parent 86ccef7 commit 35d0141

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/utils_/test_mem_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ def test_memory_profiling():
2020
# 512 MiB allocation outside of this instance
2121
handle1 = lib.cudaMalloc(512 * 1024 * 1024)
2222

23+
# Warm up PyTorch's CUDA/ROCm context so that its internal initialization
24+
# overhead (streams, cuBLAS handles, etc.) is included in the baseline and
25+
# does not inflate non-torch increase which is larger on ROCm than on CUDA
26+
_warmup = torch.zeros(1, device="cuda")
27+
del _warmup
28+
torch.accelerator.empty_cache()
29+
2330
baseline_snapshot = MemorySnapshot()
2431

2532
# load weights

0 commit comments

Comments
 (0)