@@ -82,7 +82,7 @@ def test_hierarchical_1d(self):
8282 * (KN / MAC_TILE ) # number of used Scratchpad
8383 * M_TILE
8484 * KN # temporal for n1 in mapping
85- * sum (i + 1 for i in range (MAC_TILE )) # unicast along X-axis of MacArray
85+ * sum (i + 1 for i in range (MAC_TILE )) # unicast along X-axis of MacArray
8686 * BITS_PER_VALUE ,
8787 )
8888 # NOTE: assuming XY routing (as defined in mapping)
@@ -92,7 +92,7 @@ def test_hierarchical_1d(self):
9292 * (KN / MAC_TILE )
9393 * M_TILE
9494 * KN # temporal for n1 in mapping
95- * MAC_TILE # multicast along X-axis of MacArray
95+ * MAC_TILE # multicast along X-axis of MacArray
9696 * BITS_PER_VALUE ,
9797 )
9898 self .assertEqual (
@@ -101,14 +101,16 @@ def test_hierarchical_1d(self):
101101 * (KN / MAC_TILE )
102102 * M_TILE
103103 * KN
104- * sum (i + 1 for i in range (MAC_TILE ))
104+ * sum (i + 1 for i in range (MAC_TILE ))
105105 * BITS_PER_VALUE ,
106106 )
107107
108108 self .assertEqual (
109109 result .data ["Matmul0<SEP>action<SEP>PeArray<SEP>T0<SEP>hops" ].iloc [0 ],
110110 (M / M_TILE )
111- * sum (i + 1 for i in range (KN // MAC_TILE )) # unicast along X-axis of PeArray
111+ * sum (
112+ i + 1 for i in range (KN // MAC_TILE )
113+ ) # unicast along X-axis of PeArray
112114 * M_TILE
113115 * MAC_TILE
114116 * BITS_PER_VALUE ,
@@ -117,15 +119,16 @@ def test_hierarchical_1d(self):
117119 self .assertEqual (
118120 result .data ["Matmul0<SEP>action<SEP>PeArray<SEP>T1<SEP>hops" ].iloc [0 ],
119121 (M / M_TILE )
120- * KN // MAC_TILE # multicast along X-axis of PeArray
122+ * KN
123+ // MAC_TILE # multicast along X-axis of PeArray
121124 * M_TILE
122125 * KN
123126 * BITS_PER_VALUE ,
124127 )
125128 self .assertEqual (
126129 result .data ["Matmul0<SEP>action<SEP>PeArray<SEP>W0<SEP>hops" ].iloc [0 ],
127130 (M / M_TILE )
128- * sum (i + 1 for i in range (KN // MAC_TILE )) # unicast along PeArray
131+ * sum (i + 1 for i in range (KN // MAC_TILE )) # unicast along PeArray
129132 * MAC_TILE
130133 * KN
131134 * BITS_PER_VALUE ,
@@ -160,9 +163,8 @@ def test_hierarchical(self):
160163 * (KN / MAC_TILE ) ** 2
161164 * M_TILE
162165 * (
163- sum (i + 1 for i in range (MAC_TILE )) # unicasting along X
164- +
165- MAC_TILE * MAC_TILE # multicast along Y for each column
166+ sum (i + 1 for i in range (MAC_TILE )) # unicasting along X
167+ + MAC_TILE * MAC_TILE # multicast along Y for each column
166168 )
167169 * BITS_PER_VALUE ,
168170 )
@@ -173,9 +175,10 @@ def test_hierarchical(self):
173175 * (KN / MAC_TILE ) ** 2
174176 * M_TILE
175177 * (
176- MAC_TILE * MAC_TILE # multicast along X (the tile is shape N1, which is MAC_TILE here)
177- +
178- MAC_TILE * sum (i + 1 for i in range (MAC_TILE )) # unicasting along Y for each row
178+ MAC_TILE
179+ * MAC_TILE # multicast along X (the tile is shape N1, which is MAC_TILE here)
180+ + MAC_TILE
181+ * sum (i + 1 for i in range (MAC_TILE )) # unicasting along Y for each row
179182 )
180183 * BITS_PER_VALUE ,
181184 )
@@ -185,35 +188,27 @@ def test_hierarchical(self):
185188 * (KN / MAC_TILE ) ** 2
186189 * M_TILE
187190 * (
188- MAC_TILE * sum (i + 1 for i in range (MAC_TILE )) # unicast along X (the tile is shape N1, which is MAC_TILE here)
189- +
190- MAC_TILE * sum (i + 1 for i in range (MAC_TILE )) # unicasting along Y for each row
191+ MAC_TILE
192+ * sum (
193+ i + 1 for i in range (MAC_TILE )
194+ ) # unicast along X (the tile is shape N1, which is MAC_TILE here)
195+ + MAC_TILE
196+ * sum (i + 1 for i in range (MAC_TILE )) # unicasting along Y for each row
191197 )
192198 * BITS_PER_VALUE ,
193199 )
194200
195201 self .assertEqual (
196202 result .data ["Matmul0<SEP>action<SEP>PeArray<SEP>T0<SEP>hops" ].iloc [0 ],
197- (M / M_TILE )
198- * (
199- sum (i + 1 for i in range (PE_TILE ))
200- +
201- PE_TILE * PE_TILE
202- )
203+ (M / M_TILE ) * (sum (i + 1 for i in range (PE_TILE )) + PE_TILE * PE_TILE )
203204 # tile shape
204- * M_TILE
205- * MAC_TILE
206- * BITS_PER_VALUE ,
205+ * M_TILE * MAC_TILE * BITS_PER_VALUE ,
207206 )
208207 # NOTE: assuming XY routing (as defined in mapping)
209208 self .assertEqual (
210209 result .data ["Matmul0<SEP>action<SEP>PeArray<SEP>T1<SEP>hops" ].iloc [0 ],
211210 (M / M_TILE )
212- * (
213- PE_TILE * PE_TILE
214- +
215- PE_TILE * sum (i + 1 for i in range (PE_TILE ))
216- )
211+ * (PE_TILE * PE_TILE + PE_TILE * sum (i + 1 for i in range (PE_TILE )))
217212 * M_TILE
218213 * MAC_TILE
219214 * BITS_PER_VALUE ,
@@ -222,9 +217,8 @@ def test_hierarchical(self):
222217 result .data ["Matmul0<SEP>action<SEP>PeArray<SEP>W0<SEP>hops" ].iloc [0 ],
223218 (M / M_TILE )
224219 * (
225- PE_TILE * sum (i + 1 for i in range (PE_TILE ))
226- +
227- PE_TILE * sum (i + 1 for i in range (PE_TILE ))
220+ PE_TILE * sum (i + 1 for i in range (PE_TILE ))
221+ + PE_TILE * sum (i + 1 for i in range (PE_TILE ))
228222 )
229223 * MAC_TILE ** 2
230224 * BITS_PER_VALUE ,
@@ -252,4 +246,4 @@ def test_hierarchical(self):
252246 "M_TILE" : M_TILE ,
253247 },
254248 )
255- result = spec .map_workload_to_arch ()
249+ result = spec .map_workload_to_arch ()
0 commit comments