The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
mm: discard async errors from pinning failures (#10738)
rattus9ca7e143afe6
diff --git a/comfy/model_management.py b/comfy/model_management.pyindex e5554e225..9fcb699bc 100644--- a/comfy/model_management.py+++ b/comfy/model_management.py@@ -1126,6 +1126,16 @@ if not args.disable_pinned_memory:PINNING_ALLOWED_TYPES = set(["Parameter", "QuantizedTensor"])+def discard_cuda_async_error():+ try:+ a = torch.tensor([1], dtype=torch.uint8, device=get_torch_device())+ b = torch.tensor([1], dtype=torch.uint8, device=get_torch_device())+ _ = a + b+ torch.cuda.synchronize()+ except torch.AcceleratorError:+ #Dump it! We already know about it from the synchronous return+ pass+def pin_memory(tensor):global TOTAL_PINNED_MEMORYif MAX_PINNED_MEMORY <= 0:@@ -1158,6 +1168,8 @@ def pin_memory(tensor):PINNED_MEMORY[ptr] = sizeTOTAL_PINNED_MEMORY += sizereturn True+ else:+ discard_cuda_async_error()return False@@ -1186,6 +1198,8 @@ def unpin_memory(tensor):if len(PINNED_MEMORY) == 0:TOTAL_PINNED_MEMORY = 0return True+ else:+ discard_cuda_async_error()return False