Skip to content

Commit abf558b

Browse files
committed
[Verifier] Improve command line output for equivalences with different fingerprints
1 parent 91c5922 commit abf558b

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/python/verifier/verifier.py

+18-13
Original file line numberDiff line numberDiff line change
@@ -712,11 +712,11 @@ def find_equivalences(
712712
num_different_dags_with_same_hash[hashtag] = len(output_dict_)
713713

714714
hashtags_in_more_equivalences = set()
715+
more_equivalences = []
716+
equivalent_called_2 = 0
717+
num_equivalences_under_phase_shift = 0
718+
possible_num_equivalences_under_phase_shift = 0
715719
if check_equivalence_with_different_hash:
716-
more_equivalences = []
717-
equivalent_called_2 = 0
718-
num_equivalences_under_phase_shift = 0
719-
possible_num_equivalences_under_phase_shift = 0
720720
print("Start checking equivalence with different hash...")
721721
for hashtag, dags in output_dict.items():
722722
from collections import defaultdict
@@ -847,12 +847,12 @@ def find_equivalences(
847847
)
848848
output_dict = [more_equivalences, output_dict]
849849
if print_basic_info:
850-
print(
851-
f"Solver invoked {equivalent_called_2} times to find {len(more_equivalences)} equivalences"
852-
f" with different hash,"
853-
f" including {num_equivalences_under_phase_shift} out of"
854-
f" {possible_num_equivalences_under_phase_shift} possible equivalences under phase shift."
855-
)
850+
print(f"End checking equivalence with different hash."
851+
f" Solver invoked {equivalent_called_2} times to find {len(more_equivalences)} equivalences"
852+
f" with different hash,"
853+
f" including {num_equivalences_under_phase_shift} out of"
854+
f" {possible_num_equivalences_under_phase_shift} possible equivalences under phase shift."
855+
)
856856
else:
857857
# Add a placeholder here
858858
output_dict = [[], output_dict]
@@ -866,10 +866,15 @@ def find_equivalences(
866866
t_end = time.monotonic()
867867
if print_basic_info:
868868
print(
869-
f"{total_equivalence_found} equivalences found in {t_end - t_start} seconds"
870-
f" (solver invoked {equivalent_called} times for {num_dags} DAGs"
869+
f"{total_equivalence_found + len(more_equivalences)} equivalences"
870+
f"{f' (including {len(more_equivalences)} with different hash values)' if len(more_equivalences) > 0 else ''}"
871+
f" found in {t_end - t_start} seconds"
872+
f" (solver invoked {equivalent_called + equivalent_called_2} times"
873+
f"{f' (including {equivalent_called_2} times for circuits with different hash values)' if equivalent_called_2 > 0 else ''}"
874+
f" for {num_dags} circuits"
871875
f" with {num_hashtags} different hash values and {num_potential_equivalences} potential equivalences),"
872-
f" output {len(output_dict[1])} equivalence classes."
876+
f" output {len(output_dict[1])} equivalence classes"
877+
f"{f' (will be merged into {len(output_dict[1]) - len(more_equivalences)} equivalence classes after dealing with equivalent equivalence classes with different hash values)' if len(more_equivalences) > 0 else ''}."
873878
)
874879
t_start = time.monotonic()
875880
dump_json(output_dict, output_file)

0 commit comments

Comments
 (0)