Skip to content

Commit d19f156

Browse files
contentisadlerfaulkner
authored andcommitted
Enable Convolution AutoTuning (comfyanonymous#9301)
1 parent 90e2469 commit d19f156

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

comfy/cli_args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class PerformanceFeature(enum.Enum):
143143
Fp16Accumulation = "fp16_accumulation"
144144
Fp8MatrixMultiplication = "fp8_matrix_mult"
145145
CublasOps = "cublas_ops"
146+
AutoTune = "autotune"
146147

147148
parser.add_argument("--fast", nargs="*", type=PerformanceFeature, help="Enable some untested and potentially quality deteriorating optimizations. --fast with no arguments enables everything. You can pass a list specific optimizations if you only want to enable specific ones. Current valid optimizations: fp16_accumulation fp8_matrix_mult cublas_ops")
148149

comfy/ops.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def scaled_dot_product_attention(q, k, v, *args, **kwargs):
5252

5353
cast_to = comfy.model_management.cast_to #TODO: remove once no more references
5454

55+
if torch.cuda.is_available() and torch.backends.cudnn.is_available() and PerformanceFeature.AutoTune in args.fast:
56+
torch.backends.cudnn.benchmark = True
57+
5558
def cast_to_input(weight, input, non_blocking=False, copy=True):
5659
return comfy.model_management.cast_to(weight, input.dtype, input.device, non_blocking=non_blocking, copy=copy)
5760

0 commit comments

Comments
 (0)