From 35d0141a0b68a188777e277e372f211098419f58 Mon Sep 17 00:00:00 2001 From: Divakar Verma <137818590+divakar-amd@users.noreply.github.com> Date: Thu, 21 May 2026 23:17:54 -0400 Subject: [PATCH] [ROCm][CI] add warmup to mem_util test before measurement (#43236) Signed-off-by: Divakar Verma --- tests/utils_/test_mem_utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/utils_/test_mem_utils.py b/tests/utils_/test_mem_utils.py index c56d6a44e7..861e73c7de 100644 --- a/tests/utils_/test_mem_utils.py +++ b/tests/utils_/test_mem_utils.py @@ -20,6 +20,13 @@ def test_memory_profiling(): # 512 MiB allocation outside of this instance handle1 = lib.cudaMalloc(512 * 1024 * 1024) + # Warm up PyTorch's CUDA/ROCm context so that its internal initialization + # overhead (streams, cuBLAS handles, etc.) is included in the baseline and + # does not inflate non-torch increase which is larger on ROCm than on CUDA + _warmup = torch.zeros(1, device="cuda") + del _warmup + torch.accelerator.empty_cache() + baseline_snapshot = MemorySnapshot() # load weights