Skip to content

Conversation

@ahmadafzal007
Copy link

@ahmadafzal007 ahmadafzal007 commented Feb 6, 2026

Summary

Fixes #940 - Adds GPU models reported by users in the issue that are missing from the cudaMallocAsync blacklist, and replaces bare except: with except Exception: for better Python practices.

Changes

1. Added missing GPUs to the blacklist

Several users reported CUDA error: operation not supported on GPUs not yet in the blacklist. These have been added:

GPU Reporter Context
Tesla P40 @fahadshery Pascal datacenter GPU (CC 6.1), Driver 535.x
Tesla P4 (proactive) Same Pascal architecture as P40
NVIDIA L4 @efwfe Cloud/datacenter GPU, Driver 535.171.04
NVIDIA A10G @robert-pattern AWS EC2 GPU, confirmed --disable-cuda-malloc fixed it
GRID A800D @Kimizhao vGPU mode (A800D-80C), Driver 525.105.17

The blacklist uses substring matching (if b in x), so these entries correctly match the full GPU name strings returned by both nvidia-smi -L (Linux) and EnumDisplayDevicesA (Windows).

2. Replaced bare except: with except Exception:

Three locations in the file used bare except: which catches all exceptions including KeyboardInterrupt and SystemExit. This is a Python anti-pattern (PEP 8, B001/E722). Changed to except Exception: which still catches all operational errors (OSError, FileNotFoundError, RuntimeError, CalledProcessError, etc.) but allows clean process termination.

Locations changed:

  • cuda_malloc_supported() - catches failures from get_gpu_names() (nvidia-smi/ctypes)
  • Torch version detection block - catches import/file errors
  • cuda_malloc enablement block - catches version parsing errors

Testing

  • 8 blocked GPU tests - All newly added GPUs correctly blocked (Tesla P40, P4, L4, A10G, GRID A800D) plus existing entries (GTX 960M, 970, 980)
  • 5 allowed GPU tests - No false positives (RTX 4090, 3080, 2070, A100, H100 all pass through)
  • Exception handling tests - except Exception: catches RuntimeError, OSError, FileNotFoundError, CalledProcessError; correctly does NOT catch KeyboardInterrupt or SystemExit
  • Syntax check - py_compile passes

Comfy-Org#940)\n\nAdd GPU models reported in issue Comfy-Org#940 that are missing from the\ncudaMallocAsync blacklist:\n- Tesla P40 (Pascal datacenter GPU)\n- Tesla P4 (Pascal datacenter GPU)\n- NVIDIA L4 (reported by users in cloud environments)\n- NVIDIA A10G (AWS GPU, confirmed fix by user)\n- GRID A800D (vGPU mode, reported by user)\n\nAlso replace bare `except:` with `except Exception:` in three locations\nto follow Python best practices and avoid accidentally catching\nKeyboardInterrupt and SystemExit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default arg "cuda-malloc" causes CUDA error: operation not supported on GTX 960M GPU

1 participant