@@ -56,8 +56,6 @@ LinearLayout identityND(StringAttr inDimName, ArrayRef<unsigned> shape,
5656 LinearLayout ret = LinearLayout::empty ();
5757 for (int i = 0 ; i < shape.size (); i++) {
5858 // Start with the most-minor dimension, which is order[0].
59- std::cout << " i: " << i << " shape[i]: " << shape[i]
60- << " order[i]: " << order[i] << std::endl;
6159 int dim = order[i];
6260 ret *= LinearLayout::identity1D (shape[dim], inDimName, outDimNames[dim]);
6361 }
@@ -291,15 +289,6 @@ LinearLayout ensureLayoutNotSmallerThan(
291289 assert (actualSize > desiredSize ||
292290 desiredSize % actualSize == 0 && " bad shape" );
293291 ret *= LinearLayout::identity1D (desiredSize / actualSize, kDim , outDimName);
294- std::cout << " actualSize: " << actualSize << " desiredSize: " << desiredSize
295- << std::endl;
296- std::cout << " outDimName: " << outDimName.str () << std::endl;
297- std::cout << " identity1D: "
298- << LinearLayout::identity1D (desiredSize / actualSize, kDim ,
299- outDimName)
300- .toString ()
301- << std::endl;
302- std::cout << " ret: " << ret.toString () << std::endl;
303292 assert (ret.getOutDimSize (outDimName) >= desiredSize && " bad grow" );
304293 }
305294 return ret;
@@ -323,12 +312,6 @@ LinearLayout combineCtaCgaWithShape(LinearLayout ctaLayout,
323312
324313 SmallVector<StringAttr> outDimNames = standardOutDimNames (ctx, rank);
325314
326- std::cout << " shape: " ;
327- for (auto s : shape) {
328- std::cout << s << " , " ;
329- }
330-
331- std::cout << std::endl;
332315 llvm::SmallDenseMap<StringAttr, int64_t > labeledShape;
333316 for (auto [dim, size] : llvm::zip (outDimNames, shape)) {
334317 labeledShape[dim] = size;
@@ -337,7 +320,6 @@ LinearLayout combineCtaCgaWithShape(LinearLayout ctaLayout,
337320 LinearLayout cgaLayout =
338321 ensureLayoutNotLargerThan (makeCgaLayout (cgaLayoutAttr), labeledShape)
339322 .transposeOuts (llvm::to_vector (ctaLayout.getOutDimNames ()));
340- std::cout << " \n cgaLayout: " << cgaLayout.toString () << std::endl;
341323
342324 // Calculate the shape of the ctaLayout, which is `shape` divided by the
343325 // cgaLayout's size.
@@ -346,29 +328,19 @@ LinearLayout combineCtaCgaWithShape(LinearLayout ctaLayout,
346328 llvm::to_vector (cgaLayout.getOutDimNames ()) &&
347329 " bad layout" );
348330
349- std::cout << " ctaShape: " ;
350331 for (auto dim : ctaLayout.getOutDimNames ()) {
351332 ctaShape[dim] =
352333 std::max (int64_t {1 }, labeledShape[dim] / cgaLayout.getOutDimSize (dim));
353- std::cout << ctaShape[dim] << " , " ;
354334 }
355- std::cout << std::endl;
356335
357336 ctaLayout = ensureLayoutNotSmallerThan (ctaLayout, ctaShape);
358- std::cout << " \n ctaLayout not smaller than: " << ctaLayout.toString ()
359- << std::endl;
360337 ctaLayout = ensureLayoutNotLargerThan (ctaLayout, ctaShape);
361- std::cout << " \n ctaLayout not larger than: " << ctaLayout.toString ()
362- << std::endl;
363338
364- std::cout << " \n cta * cga: " << (ctaLayout * cgaLayout).toString ()
365- << std::endl;
366339 LinearLayout ret =
367340 (std::move (ctaLayout) * std::move (cgaLayout)).transposeOuts (outDimNames);
368341 for (auto dim : ret.getOutDimNames ()) {
369342 assert (ret.getOutDimSize (dim) == labeledShape[dim] && " bad shape" );
370343 }
371- std::cout << " \n combineCtaCgaWithShape: " << ret.toString () << std::endl;
372344 return ret;
373345}
374346
@@ -565,7 +537,6 @@ LinearLayout DPAStoLinearLayout(ArrayRef<int64_t> shape, Attribute layout,
565537 LinearLayout::identity1D (warpsPerCTA[0 ], kWarp , outDimNames[0 ]);
566538
567539 } else if (opIdx == 1 ) { // Operand B
568- std::cout << " \n Operand B" << std::endl;
569540 auto regBasesB = DPASRegBasesB (opsPerChannel, executionSize, threadsPerWarp,
570541 systolicDepth);
571542 auto laneBasesB =
@@ -587,32 +558,20 @@ LinearLayout DPAStoLinearLayout(ArrayRef<int64_t> shape, Attribute layout,
587558 tileLayout *=
588559 LinearLayout::identity1D (warpsPerCTA[0 ], kWarp , outDimNames[0 ]);
589560 } else { // opIdx=2 -> Operand C
590- std::cout << " \n Operand C" << std::endl;
591561 auto regBasesC = DPASRegBasesC (repeatCount, executionSize, threadsPerWarp);
592562 auto laneBasesC =
593563 DPASLaneBasesC (repeatCount, executionSize, threadsPerWarp);
594564 tileLayout = LinearLayout ({{kRegister , regBasesC}, {kLane , laneBasesC}},
595565 ArrayRef (outDimNames).take_back (2 ));
596- std::cout << tileLayout.toString () << std::endl;
597566 // The per-inst layout is repeated at each repCluster.
598567 // Hence, multiply with the identity layouts starting from the
599568 // least significant dimension.
600569 dimNonK = rank - 2 ;
601570 dimK = rank - 1 ;
602571 tileLayout *= LinearLayout::identity1D (repCluster[dimK], kRegister ,
603572 outDimNames[dimK]);
604- std::cout << (LinearLayout::identity1D (repCluster[dimK], kRegister ,
605- outDimNames[dimK])
606- .toString ())
607- << std::endl;
608- std::cout << (tileLayout.toString ()) << std::endl;
609573 tileLayout *= LinearLayout::identity1D (repCluster[dimNonK], kRegister ,
610574 outDimNames[dimNonK]);
611- std::cout << (LinearLayout::identity1D (repCluster[dimNonK], kRegister ,
612- outDimNames[dimNonK])
613- .toString ())
614- << std::endl;
615- std::cout << (tileLayout.toString ()) << std::endl;
616575
617576 // // The identical layout is repeated among warps
618577 tileLayout *=
@@ -622,23 +581,8 @@ LinearLayout DPAStoLinearLayout(ArrayRef<int64_t> shape, Attribute layout,
622581 if (rank == 3 )
623582 tileLayout *=
624583 LinearLayout::identity1D (warpsPerCTA[0 ], kWarp , outDimNames[0 ]);
625- // std::cout << (tileLayout.toString()) << std::endl;
626584 }
627585
628- // Lastly, the layout repeats to match the shape.
629- // Operand A/B repeats through the K-dimension first then repeats
630- // through the non-K dimension.
631- // SmallVector<int64_t> numReps = dpas.getDPASRepetitions(shape, opIdx);
632- // std::cout << "numReps: " << numReps[0] << ", " << numReps[1] << std::endl;
633- // tileLayout *=
634- // LinearLayout::identity1D(numReps[dimK], kRegister, outDimNames[dimK]);
635- // tileLayout *= LinearLayout::identity1D(numReps[dimNonK], kRegister,
636- // outDimNames[dimNonK]);
637- // if (rank == 3)
638- // tileLayout *=
639- // LinearLayout::identity1D(numReps[0], kRegister, outDimNames[0]);
640- // std::cout << (tileLayout.toString()) << std::endl;
641-
642586 return combineCtaCgaWithShape (std::move (tileLayout),
643587 CTALayoutAttr::getDefault (ctx, rank), shape);
644588}
0 commit comments