Skip to content

Commit 7714544

Browse files
committed
[MCA] Do not allocate space for DependenceEdge by default in DependencyGraphNode (NFC)
For each instruction from the input assembly sequence, DependencyGraph has a dedicated node (DGNode). Outgoing edges (data, resource and memory dependencies) are tracked as SmallVector<..., 8> for each DGNode in the graph. However, it's rather unlikely that a usual input instruction will have approximately eight dependent instructions. Below is my statistics for several RISC-V input sequences: Number of | Number of nodes with edges | this # of edges -------------------------------------------- 0 | 8239447 1 | 464252 2 | 6164 3 | 6783 4 | 939 5 | 500 6 | 545 7 | 116 8 | 2 9 | 1 10 | 1 Approximately the same distribution is produced by llvm-mca lit tests (even modified ones with extra dependencies added). On a rather big input asm sequences, the use of SmallVector<..., 8> dramatically increases memory consumption without any need for it. In my case, replacing it with SmallVector<...,0> reduces memory usage by ~28% or ~1700% of input file size (2.2GB in absolute values). There is no change in execution time, I verified it on mca lit-tests and on my big test (execution time is ~30s in both cases).
1 parent 56a0a7f commit 7714544

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/tools/llvm-mca/Views/BottleneckAnalysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class DependencyGraph {
228228
unsigned Depth;
229229

230230
DependencyEdge CriticalPredecessor;
231-
SmallVector<DependencyEdge, 8> OutgoingEdges;
231+
SmallVector<DependencyEdge, 0> OutgoingEdges;
232232
};
233233
SmallVector<DGNode, 16> Nodes;
234234

0 commit comments

Comments
 (0)