Skip to content

Commit 9e00eec

Browse files
committed
Refactor: PR NVIDIA#702
Signed-off-by: gcunhase <4861122+gcunhase@users.noreply.github.com>
1 parent 2b6bd39 commit 9e00eec

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

modelopt/onnx/quantization/autotune/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,12 +531,19 @@ def add_pattern_schemes(self, pattern_schemes: PatternSchemes) -> None:
531531
else:
532532
# Existing scheme is better, skip new one
533533
too_similar = True
534+
if scheme.latency_ms < existing_scheme.latency_ms:
535+
# New scheme is better, mark existing for replacement
536+
schemes_to_replace.append(existing_scheme)
534537
break
535538

536539
if existing_to_remove is not None:
537540
filtered_schemes.remove(existing_to_remove)
538541
if not too_similar:
539542
filtered_schemes.append(scheme)
543+
elif schemes_to_replace:
544+
for scheme_to_replace in schemes_to_replace:
545+
filtered_schemes.remove(scheme_to_replace)
546+
filtered_schemes.append(scheme)
540547

541548
sorted_schemes = filtered_schemes
542549

0 commit comments

Comments
 (0)