Repository: pytorch
Issue: RuntimeError: free_upper_bound + pytorch_used_bytes[device] <= device_total INTERNAL ASSERT FAILED at "../c10/cuda/CUDAMallocAsyncAllocator.cpp":527
Labels: module: cuda,triaged

### 🐛 Describe the bug

!!! Exception during processing!!! free_upper_bound + pytorch_used_bytes[device] <= device_total INTERNAL ASSERT FAILED at "../c10/cuda/CUDAMallocAsyncAllocator.cpp":527, please report a bug to PyTorch. 
Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/custom_nodes/ComfyUI-LivePortraitKJ/nodes.py", line 333, in process
    output_video_path, _ = self.pipline.execute(self.args)
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/custom_nodes/ComfyUI-LivePortraitKJ/liveportrait/live_portrait_pipeline.py", line 214, in execute
    x_s_info = self.live_portrait_wrapper.get_kp_info(I_s)
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/custom_nodes/ComfyUI-LivePortraitKJ/liveportrait/live_portrait_wrapper.py", line 132, in get_kp_info
    kp_info = self.motion_extractor(x)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/custom_nodes/ComfyUI-LivePortraitKJ/liveportrait/modules/motion_extractor.py", line 34, in forward
    out = self.detector(x)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/custom_nodes/ComfyUI-LivePortraitKJ/liveportrait/modules/convnextv2.py", line 120, in forward
    x = self.forward_features(x)
  File "/opt/conda/lib/python3.9/site-packages/live_photo/ComfyUI/custom_nodes/ComfyUI-LivePortraitKJ/liveportrait/modules/convnextv2.py", line 115, in forward_features
    x = self.downsample_layers[i](x)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/container.py", line 217, in forward
    input = module(input)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 463, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/opt/conda/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 459, in _conv_forward
    return F.conv2d(input, weight, bias, self.stride,
RuntimeError: free_upper_bound + pytorch_used_bytes[device] <= device_total INTERNAL ASSERT FAILED at "../c10/cuda/CUDAMallocAsyncAllocator.cpp":527, please report a bug to PyTorch.

### Versions

PyTorch version: 2.0.0+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: CentOS Linux 7 (Core) (x86_64)
GCC version: (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Clang version: Could not collect
CMake version: version 3.30.1
Libc version: glibc-2.17

Python version: 3.9.12 (main, Apr  5 2022, 06:56:58)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.19.46-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA L40
Nvidia driver version: 525.125.06
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                112
On-line CPU(s) list:   0-111
Thread(s) per core:    2
Core(s) per socket:    28
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 106
Model name:            Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz
Stepping:              6
CPU MHz:               3400.000
CPU max MHz:           3500.0000
CPU min MHz:           800.0000
BogoMIPS:              5200.00
Virtualization:        VT-x
L1d cache:             48K
L1i cache:             32K
L2 cache:              1280K
L3 cache:              43008K
NUMA node0 CPU(s):     0-27,56-83
NUMA node1 CPU(s):     28-55,84-111
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid md_clear pconfig flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] numpy==1.26.4
[pip3] nvidia-cublas-cu11==11.10.3.66
[pip3] nvidia-cuda-cupti-cu11==11.7.101
[pip3] nvidia-cuda-nvrtc-cu11==11.7.99
[pip3] nvidia-cuda-runtime-cu11==11.7.99
[pip3] nvidia-cudnn-cu11==8.5.0.96
[pip3] nvidia-cufft-cu11==10.9.0.58
[pip3] nvidia-curand-cu11==10.2.10.91
[pip3] nvidia-cusolver-cu11==11.4.0.1
[pip3] nvidia-cusparse-cu11==11.7.4.91
[pip3] nvidia-nccl-cu11==2.14.3
[pip3] nvidia-nvtx-cu11==11.7.91
[pip3] onnx==1.17.0
[pip3] onnx2torch==1.5.15
[pip3] onnxruntime==1.16.3
[pip3] onnxruntime-gpu==1.16.3
[pip3] open_clip_torch==2.29.0
[pip3] torch==2.0.0
[pip3] torchaudio==2.0.1
[pip3] torchsde==0.2.6
[pip3] torchvision==0.15.1
[pip3] triton==2.0.0
[conda] numpy                     1.26.4                   pypi_0    pypi
[conda] nvidia-cublas-cu11        11.10.3.66               pypi_0    pypi
[conda] nvidia-cuda-cupti-cu11    11.7.101                 pypi_0    pypi
[conda] nvidia-cuda-nvrtc-cu11    11.7.99                  pypi_0    pypi
[conda] nvidia-cuda-runtime-cu11  11.7.99                  pypi_0    pypi
[conda] nvidia-cudnn-cu11         8.5.0.96                 pypi_0    pypi
[conda] nvidia-cufft-cu11         10.9.0.58                pypi_0    pypi
[conda] nvidia-curand-cu11        10.2.10.91               pypi_0    pypi
[conda] nvidia-cusolver-cu11      11.4.0.1                 pypi_0    pypi
[conda] nvidia-cusparse-cu11      11.7.4.91                pypi_0    pypi
[conda] nvidia-nccl-cu11          2.14.3                   pypi_0    pypi
[conda] nvidia-nvtx-cu11          11.7.91                  pypi_0    pypi
[conda] onnx2torch                1.5.15                   pypi_0    pypi
[conda] open-clip-torch           2.29.0                   pypi_0    pypi
[conda] torch                     2.0.0                    pypi_0    pypi
[conda] torchaudio                2.0.1                    pypi_0    pypi
[conda] torchsde                  0.2.6                    pypi_0    pypi
[conda] torchvision               0.15.1                   pypi_0    pypi
[conda] triton                    2.0.0                    pypi_0    pypi

cc @ptrblck @msaroufim