Skip to content

Commit f3f6293

Browse files
committed
emit statistics
1 parent 3ab763b commit f3f6293

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/ADT/ScopeExit.h"
2323
#include "llvm/ADT/SmallSet.h"
2424
#include "llvm/ADT/SmallVector.h"
25+
#include "llvm/ADT/Statistic.h"
2526
#include "llvm/Analysis/AliasAnalysis.h"
2627
#include "llvm/Analysis/DomTreeUpdater.h"
2728
#include "llvm/Analysis/LoopInfo.h"
@@ -53,6 +54,10 @@ using namespace PatternMatch;
5354

5455
#define DEBUG_TYPE "lower-matrix-intrinsics"
5556

57+
STATISTIC(FlattenedMatrices, "Number of matrix flattenings");
58+
STATISTIC(ReshapedMatrices, "Number of matrix reshapes");
59+
STATISTIC(SplitMatrices, "Number of matrix splits");
60+
5661
static cl::opt<bool>
5762
FuseMatrix("fuse-matrix", cl::init(true), cl::Hidden,
5863
cl::desc("Enable/disable fusing matrix instructions."));
@@ -597,11 +602,13 @@ class LowerMatrixIntrinsics {
597602
dbgs() << "matrix reshape from " << Found->second.shape() << " to "
598603
<< SI << " using at least " << SplitVecs.size()
599604
<< " shuffles on behalf of:\n" << *Inst << '\n';
605+
ReshapedMatrices++;
600606
} else if (!ShapeMap.contains(MatrixVal)) {
601607
dbgs() << "splitting a " << SI << " matrix with " << SplitVecs.size()
602608
<< " shuffles beacuse we do not have a shape-aware lowering for "
603609
"its def:\n"
604610
<< *Inst << '\n';
611+
SplitMatrices++;
605612
} else {
606613
// The ShapeMap has it, so it's a case where we're being lowered
607614
// before the def, and we expect that InstCombine will clean things up
@@ -1428,6 +1435,7 @@ class LowerMatrixIntrinsics {
14281435
<< "\nbecause we do not have a shape-aware lowering for its "
14291436
"user:\n"
14301437
<< *User << '\n';);
1438+
FlattenedMatrices++;
14311439
}
14321440
U.set(Flattened);
14331441
}

0 commit comments

Comments
 (0)