From 378898cba7b2b7a3472d45205b5d384e833dcffc Mon Sep 17 00:00:00 2001 From: Eddie Yan Date: Sat, 18 Apr 2026 21:46:37 +0000 Subject: [PATCH 1/2] [TEST][CUDA] Fix `test_throw_on_cudamalloc_oom` alllocation size (#180699) GPUs with more than 100 GiB of global memory exist asked claude "can you believe this" Pull Request resolved: https://github.com/pytorch/pytorch/pull/180699 Approved by: https://github.com/nWEIdia, https://github.com/Skylion007, https://github.com/mlazos --- test/test_cuda.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/test_cuda.py b/test/test_cuda.py index b33f21e6dfce2..b00fb9934fed9 100644 --- a/test/test_cuda.py +++ b/test/test_cuda.py @@ -5045,12 +5045,16 @@ def test_throw_on_cudamalloc_oom(self): # preemptively rejected with OutOfMemoryError. # Both settings must go through _accelerator_setAllocatorSettings so # they are read from CUDAAllocatorConfig. + fraction = 0.005 torch._C._accelerator_setAllocatorSettings( - "throw_on_cudamalloc_oom:True,per_process_memory_fraction:0.01" + f"throw_on_cudamalloc_oom:True,per_process_memory_fraction:{fraction}" ) + total_mem = torch.cuda.get_device_properties(0).total_memory + # Allocate the allowed threshold + 1 MiB to guarantee rejection + alloc_bytes = int(total_mem * fraction) + 1024 * 1024 with self.assertRaises(torch.cuda.OutOfMemoryError): - torch.empty(1024 * 1024 * 1024, dtype=torch.int8, device="cuda") + torch.empty(alloc_bytes, dtype=torch.int8, device="cuda") # Check that rejection counter was incremented stats = torch.cuda.memory_stats() From 956f9f8dd8ad5b23bc6e72ed6471c0b23f9a2bdb Mon Sep 17 00:00:00 2001 From: Dmitry Nikolaev Date: Thu, 14 May 2026 21:22:21 +0000 Subject: [PATCH 2/2] fix test_cpp_warnings_have_python_context --- test/test_torch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_torch.py b/test/test_torch.py index 48a463a0d2959..e6991c0513fdd 100644 --- a/test/test_torch.py +++ b/test/test_torch.py @@ -828,6 +828,7 @@ def test_cpp_warnings_have_python_context(self, device): s = ".+Triggered internally at.+RangeFactories.+" # nvfuser deprecation warning filter warnings.filterwarnings("ignore", "torch::jit::fuser::cuda", UserWarning) + warnings.filterwarnings("ignore", ".*", DeprecationWarning) # ignore all deprecation warnings def cpp_warn_fn(): out = torch.empty((5,))