@@ -30,6 +30,7 @@ class Metrics(Flag):
3030 # OCCUPANCY = auto()
3131 OFF_CHIP_ACCESSES = auto ()
3232 OP_INTENSITY = auto ()
33+ DEBUG = auto ()
3334
3435 @classmethod
3536 def all_metrics (cls ):
@@ -99,8 +100,9 @@ def record_storage(node):
99100 if storage .tensor_id not in found_tensors :
100101 found_tensors .add (storage .tensor_id )
101102 backing_storages .append (storage )
102-
103- logstring .append (f"Strg({ node ['dspace' ]} in { node ['target' ]} )" )
103+
104+ if Metrics .DEBUG in metrics :
105+ logstring .append (f"Strg({ node ['dspace' ]} in { node ['target' ]} )" )
104106
105107 def record_loop (node ):
106108 nonlocal cur_idx
@@ -118,7 +120,8 @@ def record_loop(node):
118120 )
119121 ranks_remaining [node ["rank" ]] = tile_shape
120122 full_tiling .append (loop )
121- logstring .append (f"{ node ['type' ][0 ].upper ()} { node ['rank' ]} size { tile_shape } " )
123+ if Metrics .DEBUG in metrics :
124+ logstring .append (f"{ node ['type' ][0 ].upper ()} { node ['rank' ]} size { tile_shape } " )
122125
123126 logstring = []
124127 full_tiling = []
@@ -157,16 +160,17 @@ def record_loop(node):
157160 if Metrics .ENERGY in metrics :
158161 results ["Energy" ] = energy
159162
160- offchip_ac = 0
161- for (level , tensor , einsum ), count in accesses .items ():
162- if level == 0 :
163- offchip_ac += count
164- logstring .append (f"Ac_{ level } _{ tensor } ={ count :.2e} " )
165-
166163 if Metrics .OFF_CHIP_ACCESSES in metrics :
164+ offchip_ac = 0
165+ for (level , tensor , einsum ), count in accesses .items ():
166+ if level == 0 :
167+ offchip_ac += count
167168 results ["Offchip Accesses" ] = offchip_ac
168-
169- logstring .append (f"{ result .fanout } " )
169+ if Metrics .DEBUG in metrics :
170+ logstring .append (f"Ac_{ level } _{ tensor } ={ count :.2e} " )
171+
172+ if Metrics .DEBUG in metrics :
173+ logstring .append (f"{ result .fanout } " )
170174
171175 # Only record non-backing reservations. We'll reserve backing storage later
172176 # when we free the tensors & we know all operations for which the tensor must
@@ -179,26 +183,25 @@ def record_loop(node):
179183 results [key ] += r .tile_size
180184 # logstring.append(f"{r}")
181185
182- if Metrics .LATENCY in metrics :
186+ if Metrics .LATENCY in metrics and Metrics . DEBUG in metrics :
183187 logstring .append (f"L={ results ['Latency' ]:.2e} " )
184188
185- if Metrics .ENERGY in metrics :
189+ if Metrics .ENERGY in metrics and Metrics . DEBUG in metrics :
186190 logstring .append (f"E={ results ['Energy' ]:.2e} " )
187191
188192 if Metrics .OP_INTENSITY in metrics :
189193 results ["Op_Intensity" ] = result .op_intensity [1 ]
190194
191- logstring .append (f"Results: { results } " )
192- results [LOGSTRING ] = {einsum_id : str (logstring )}
193- results [MAPPING ] = {einsum_id : tiling_full }
194- results [TENSORS ] = {einsum_id : backing_storages }
195- results [STATS ] = {
196- einsum_id : {k : v for k , v in results .items () if k not in RESERVED_COLUMNS }
197- }
198- results [IN_PROGRESS_STATS ] = {einsum_id : {}}
199- results [MAPPING_HASH ] = {einsum_id : hash ((einsum_id , tiling_compatibility ))}
200- results [TAGS ] = {einsum_id : tiling_compatibility .tags }
195+ if metrics .DEBUG in metrics :
196+ logstring .append (f"Results: { results } " )
197+ results [LOGSTRING ] = {einsum_id : str (logstring )}
198+ results [STATS ] = {einsum_id : {k : v for k , v in results .items () if k not in RESERVED_COLUMNS }}
199+ results [TAGS ] = {einsum_id : tiling_compatibility .tags }
200+ results [MAPPING_HASH ] = {einsum_id : hash ((einsum_id , tiling_compatibility ))}
201+ results [IN_PROGRESS_STATS ] = {einsum_id : {k : v for k , v in results .items () if k not in RESERVED_COLUMNS }}
202+ results [TENSORS ] = {einsum_id : backing_storages }
201203
204+ results [MAPPING ] = {einsum_id : tiling_full }
202205 key = (tiling_compatibility , fzs (results .keys ()))
203206
204207 is_pareto = True
0 commit comments