@@ -149,26 +149,30 @@ def print_most_freqs(data, max_percent=10):
149149 most = sorted (data .items (), key = lambda e : e [1 ], reverse = True )
150150 interesting = most [:(len (most ) * max_percent ) // 100 ]
151151 if compute_super_insts_usage :
152+ threshold = 10
153+ over , under = [(x , c ) for (x , c ) in most if c > threshold ], [(x , c ) for (x , c ) in most if c <= threshold ]
154+
155+ if under :
156+ print (f"Some Super Instructions are under the usage threshold ({ threshold } ).\n " )
157+ print ("| Super Instruction | Uses in compiled code |" )
158+ print ("\n " .join (f"| { insts } | { count } |" for (insts , count ) in under ))
159+
160+ print ("<details><summary>Super Instructions over the threshold</summary>\n " )
152161 print ("| Super Instruction | Uses in compiled code |" )
153162 print ("| ----------------- | --------------------- |" )
154- print ("\n " .join (f"| { insts } | { count } |" for (insts , count ) in interesting ))
163+ print ("\n " .join (f"| { insts } | { count } |" for (insts , count ) in over ))
164+ print ("\n </details>" )
155165 else :
156166 print ("\n " .join (f"{ insts } -> { count } " for (insts , count ) in interesting ))
157167
158- if compute_super_insts_usage :
159- threshold = 10
160- for (inst , count ) in most :
161- if count <= threshold :
162- sys .exit (1 )
163-
164-
165- if not compute_super_insts_usage :
166- print ("Super instructions present:" )
167- print_most_freqs (super_insts_freqs , max_percent = 100 )
168168
169169if compute_super_insts_usage :
170- sys .exit (0 )
170+ print_most_freqs (super_insts_freqs , max_percent = 100 )
171+ else :
172+ print ("Super instructions present:" )
173+ print_most_freqs (super_insts_freqs , max_percent = 100 )
171174
172- for i in (2 , 3 , 4 ):
173- print (f"\n Pairs of { i } :" )
174- print_most_freqs (frequent [i ])
175+ print ("Potential pairs of instructions that could be optimized:" )
176+ for i in (2 , 3 , 4 ):
177+ print (f"\n Pairs of { i } :" )
178+ print_most_freqs (frequent [i ])
0 commit comments