Disable cuDNN benchmark on ROCm and add cudnn_benchmark_limit option

This commit is contained in:
Disty0
2025-05-08 13:27:06 +03:00
parent 8433f685e7
commit dfebc909eb
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -395,10 +395,10 @@ def set_cudnn_params():
torch.use_deterministic_algorithms(opts.cudnn_deterministic)
if opts.cudnn_deterministic:
os.environ.setdefault('CUBLAS_WORKSPACE_CONFIG', ':4096:8')
torch.backends.cudnn.benchmark = True
torch.backends.cudnn.benchmark = opts.cudnn_benchmark
if opts.cudnn_benchmark:
log.debug('Torch cuDNN: enable benchmark')
torch.backends.cudnn.benchmark_limit = 0
torch.backends.cudnn.benchmark_limit = opts.cudnn_benchmark_limit
torch.backends.cudnn.allow_tf32 = True
except Exception as e:
log.warning(f'Torch cudnn: {e}')
+2 -1
View File
@@ -482,9 +482,10 @@ options_templates.update(options_section(('backends', "Backend Settings"), {
"other_sep": OptionInfo("<h2>Torch Options</h2>", "", gr.HTML),
"opt_channelslast": OptionInfo(False, "Channels last "),
"cudnn_deterministic": OptionInfo(False, "Deterministic mode"),
"cudnn_benchmark": OptionInfo(False, "Full-depth cuDNN benchmark"),
"diffusers_fuse_projections": OptionInfo(False, "Fused projections"),
"torch_expandable_segments": OptionInfo(False, "Expandable segments"),
"cudnn_benchmark": OptionInfo(devices.backend != "rocm", "Full-depth cuDNN benchmark"),
"cudnn_benchmark_limit": OptionInfo(10, "cuDNN benchmark limit", gr.Slider, {"minimum": 0, "maximum": 100, "step": 1}),
"torch_tunable_ops": OptionInfo("default", "Tunable ops", gr.Radio, {"choices": ["default", "true", "false"]}),
"torch_tunable_limit": OptionInfo(30, "Tunable ops limit", gr.Slider, {"minimum": 1, "maximum": 100, "step": 1}),
"cuda_mem_fraction": OptionInfo(0.0, "Memory limit", gr.Slider, {"minimum": 0, "maximum": 2.0, "step": 0.05}),