[llvm] 14f7757 - [llvm-mca] [NFC] Formatting code
Marcos Horro via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 13 10:14:42 PDT 2021
Author: Marcos Horro
Date: 2021-07-13T19:13:59+02:00
New Revision: 14f77576c9c4f502267a92992abe3bdcbeb96b2c
URL: https://github.com/llvm/llvm-project/commit/14f77576c9c4f502267a92992abe3bdcbeb96b2c
DIFF: https://github.com/llvm/llvm-project/commit/14f77576c9c4f502267a92992abe3bdcbeb96b2c.diff
LOG: [llvm-mca] [NFC] Formatting code
Applied clang-format to all files. Discarded BottleneckAnalysis.h
80-column width violation since it contains an example of report.
Caught some typos and minor style details.
Reviewed By: andreadb
Differential Revision: https://reviews.llvm.org/D105900
Added:
Modified:
llvm/tools/llvm-mca/PipelinePrinter.cpp
llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp
llvm/tools/llvm-mca/Views/BottleneckAnalysis.h
llvm/tools/llvm-mca/Views/DispatchStatistics.cpp
llvm/tools/llvm-mca/Views/InstructionView.cpp
llvm/tools/llvm-mca/Views/InstructionView.h
llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp
llvm/tools/llvm-mca/Views/SummaryView.cpp
llvm/tools/llvm-mca/Views/SummaryView.h
llvm/tools/llvm-mca/Views/TimelineView.h
llvm/tools/llvm-mca/Views/View.h
llvm/tools/llvm-mca/llvm-mca.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-mca/PipelinePrinter.cpp b/llvm/tools/llvm-mca/PipelinePrinter.cpp
index 8e84abc4dfe5c..4f86ab4258335 100644
--- a/llvm/tools/llvm-mca/PipelinePrinter.cpp
+++ b/llvm/tools/llvm-mca/PipelinePrinter.cpp
@@ -59,7 +59,7 @@ json::Object PipelinePrinter::getJSONTargetInfo() const {
for (unsigned J = 0; J < NumUnits; ++J) {
std::string ResourceName = ProcResource.Name;
if (NumUnits > 1) {
- ResourceName += ".";
+ ResourceName += ".";
ResourceName += J;
}
diff --git a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp
index 0fe1cb091fb9d..5b110d6602df0 100644
--- a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp
+++ b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp
@@ -198,8 +198,8 @@ void DependencyGraph::initializeRootSet(
}
}
-void DependencyGraph::propagateThroughEdges(
- SmallVectorImpl<unsigned> &RootSet, unsigned Iterations) {
+void DependencyGraph::propagateThroughEdges(SmallVectorImpl<unsigned> &RootSet,
+ unsigned Iterations) {
SmallVector<unsigned, 8> ToVisit;
// A critical sequence is computed as the longest path from a node of the
@@ -221,14 +221,14 @@ void DependencyGraph::propagateThroughEdges(
// The `unvisited nodes` set initially contains all the nodes from the
// RootSet. A node N is added to the `unvisited nodes` if all its
// predecessors have been visited already.
- //
+ //
// For simplicity, every node tracks the number of unvisited incoming edges in
// field `NumVisitedPredecessors`. When the value of that field drops to
// zero, then the corresponding node is added to a `ToVisit` set.
//
// At the end of every iteration of the outer loop, set `ToVisit` becomes our
// new `unvisited nodes` set.
- //
+ //
// The algorithm terminates when the set of unvisited nodes (i.e. our RootSet)
// is empty. This algorithm works under the assumption that the graph is
// acyclic.
@@ -267,8 +267,9 @@ void DependencyGraph::getCriticalSequence(
// that node is the last instruction of our critical sequence.
// Field N.Depth would tell us the total length of the sequence.
//
- // To obtain the sequence of critical edges, we simply follow the chain of critical
- // predecessors starting from node N (field DGNode::CriticalPredecessor).
+ // To obtain the sequence of critical edges, we simply follow the chain of
+ // critical predecessors starting from node N (field
+ // DGNode::CriticalPredecessor).
const auto It = std::max_element(
Nodes.begin(), Nodes.end(),
[](const DGNode &Lhs, const DGNode &Rhs) { return Lhs.Cost < Rhs.Cost; });
diff --git a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h
index 73401c62b7f39..cd5af0afcf5b6 100644
--- a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h
+++ b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.h
@@ -33,9 +33,9 @@
/// In particular, this occurs when there is a delta between the number of uOps
/// dispatched and the number of uOps issued to the underlying pipelines.
///
-/// The bottleneck analysis view is also responsible for identifying and printing
-/// the most "critical" sequence of dependent instructions according to the
-/// simulated run.
+/// The bottleneck analysis view is also responsible for identifying and
+/// printing the most "critical" sequence of dependent instructions according to
+/// the simulated run.
///
/// Below is the critical sequence computed for the dot-product example on
/// btver2:
@@ -62,13 +62,14 @@
/// and edges of the graph represent data dependencies or processor resource
/// interferences.
///
-/// Edges are dynamically 'discovered' by observing instruction state transitions
-/// and backend pressure increase events. Edges are internally ranked based on
-/// their "criticality". A dependency is considered to be critical if it takes a
-/// long time to execute, and if it contributes to backend pressure increases.
-/// Criticality is internally measured in terms of cycles; it is computed for
-/// every edge in the graph as a function of the edge latency and the number of
-/// backend pressure increase cycles contributed by that edge.
+/// Edges are dynamically 'discovered' by observing instruction state
+/// transitions and backend pressure increase events. Edges are internally
+/// ranked based on their "criticality". A dependency is considered to be
+/// critical if it takes a long time to execute, and if it contributes to
+/// backend pressure increases. Criticality is internally measured in terms of
+/// cycles; it is computed for every edge in the graph as a function of the edge
+/// latency and the number of backend pressure increase cycles contributed by
+/// that edge.
///
/// At the end of simulation, costs are propagated to nodes through the edges of
/// the graph, and the most expensive path connecting the root-set (a
@@ -217,8 +218,8 @@ struct DependencyEdge {
// Loop carried dependencies are carefully expanded by the bottleneck analysis
// to guarantee that the graph stays acyclic. To this end, extra nodes are
// pre-allocated at construction time to describe instructions from "past and
-// future" iterations. The graph is kept acyclic mainly because it simplifies the
-// complexity of the algorithm that computes the critical sequence.
+// future" iterations. The graph is kept acyclic mainly because it simplifies
+// the complexity of the algorithm that computes the critical sequence.
class DependencyGraph {
struct DGNode {
unsigned NumPredecessors;
@@ -239,7 +240,8 @@ class DependencyGraph {
void pruneEdges(unsigned Iterations);
void initializeRootSet(SmallVectorImpl<unsigned> &RootSet) const;
- void propagateThroughEdges(SmallVectorImpl<unsigned> &RootSet, unsigned Iterations);
+ void propagateThroughEdges(SmallVectorImpl<unsigned> &RootSet,
+ unsigned Iterations);
#ifndef NDEBUG
void dumpDependencyEdge(raw_ostream &OS, const DependencyEdge &DE,
diff --git a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp
index 9d3cdf81a504e..3dc17c8754d80 100644
--- a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp
+++ b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp
@@ -1,5 +1,4 @@
-//===--------------------- DispatchStatistics.cpp ---------------------*- C++
-//-*-===//
+//===--------------------- DispatchStatistics.cpp ---------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/llvm/tools/llvm-mca/Views/InstructionView.cpp b/llvm/tools/llvm-mca/Views/InstructionView.cpp
index 2abe9073cd9fc..3b174a0649852 100644
--- a/llvm/tools/llvm-mca/Views/InstructionView.cpp
+++ b/llvm/tools/llvm-mca/Views/InstructionView.cpp
@@ -1,4 +1,4 @@
-//===----------------------- View.cpp ---------------------------*- C++ -*-===//
+//===----------------------- InstructionView.cpp ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -21,7 +21,8 @@ namespace mca {
InstructionView::~InstructionView() = default;
-StringRef InstructionView::printInstructionString(const llvm::MCInst &MCI) const {
+StringRef
+InstructionView::printInstructionString(const llvm::MCInst &MCI) const {
InstructionString = "";
MCIP.printInst(&MCI, 0, "", STI, InstrStream);
InstrStream.flush();
diff --git a/llvm/tools/llvm-mca/Views/InstructionView.h b/llvm/tools/llvm-mca/Views/InstructionView.h
index 41e943b3eb71b..1843b0513dfc6 100644
--- a/llvm/tools/llvm-mca/Views/InstructionView.h
+++ b/llvm/tools/llvm-mca/Views/InstructionView.h
@@ -1,4 +1,4 @@
-//===----------------------- InstrucionView.h -----------------------------*- C++ -*-===//
+//===----------------------- InstructionView.h ------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -16,8 +16,8 @@
#define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONVIEW_H
#include "Views/View.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/JSON.h"
+#include "llvm/Support/raw_ostream.h"
namespace llvm {
namespace mca {
@@ -34,15 +34,12 @@ class InstructionView : public View {
public:
void printView(llvm::raw_ostream &) const override {}
InstructionView(const llvm::MCSubtargetInfo &STI,
- llvm::MCInstPrinter &Printer,
- llvm::ArrayRef<llvm::MCInst> S)
+ llvm::MCInstPrinter &Printer, llvm::ArrayRef<llvm::MCInst> S)
: STI(STI), MCIP(Printer), Source(S), InstrStream(InstructionString) {}
virtual ~InstructionView();
- StringRef getNameAsString() const override {
- return "Instructions";
- }
+ StringRef getNameAsString() const override { return "Instructions"; }
// Return a reference to a string representing a given machine instruction.
// The result should be used or copied before the next call to
diff --git a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
index e4e816fb76ca9..4ef8053bff410 100644
--- a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
+++ b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
@@ -65,7 +65,7 @@ void RegisterFileStatistics::updateMoveElimInfo(const Instruction &Inst) {
for (size_t I = 0, E = Inst.getDefs().size(); I < E; ++I) {
const WriteState &WS = Inst.getDefs()[I];
- const ReadState &RS = Inst.getUses()[E - (I+1)];
+ const ReadState &RS = Inst.getUses()[E - (I + 1)];
MoveEliminationInfo &Info =
MoveElimInfo[Inst.getDefs()[0].getRegisterFileID()];
diff --git a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp
index 61c115b27be13..1c40428fb0182 100644
--- a/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp
+++ b/llvm/tools/llvm-mca/Views/RetireControlUnitStatistics.cpp
@@ -71,7 +71,8 @@ void RetireControlUnitStatistics::printView(raw_ostream &OS) const {
}
unsigned AvgUsage = (double)SumOfUsedEntries / NumCycles;
- double MaxUsagePercentage = ((double)MaxUsedEntries / TotalROBEntries) * 100.0;
+ double MaxUsagePercentage =
+ ((double)MaxUsedEntries / TotalROBEntries) * 100.0;
double NormalizedMaxPercentage = floor((MaxUsagePercentage * 10) + 0.5) / 10;
double AvgUsagePercentage = ((double)AvgUsage / TotalROBEntries) * 100.0;
double NormalizedAvgPercentage = floor((AvgUsagePercentage * 10) + 0.5) / 10;
diff --git a/llvm/tools/llvm-mca/Views/SummaryView.cpp b/llvm/tools/llvm-mca/Views/SummaryView.cpp
index c0fe3b5193a79..bf258b4c26b15 100644
--- a/llvm/tools/llvm-mca/Views/SummaryView.cpp
+++ b/llvm/tools/llvm-mca/Views/SummaryView.cpp
@@ -1,4 +1,4 @@
-//===--------------------- SummaryView.cpp -------------------*- C++ -*-===//
+//===--------------------- SummaryView.cpp ----------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -24,9 +24,8 @@ namespace mca {
SummaryView::SummaryView(const MCSchedModel &Model, ArrayRef<MCInst> S,
unsigned Width)
- : SM(Model), Source(S), DispatchWidth(Width?Width: Model.IssueWidth),
- LastInstructionIdx(0),
- TotalCycles(0), NumMicroOps(0),
+ : SM(Model), Source(S), DispatchWidth(Width ? Width : Model.IssueWidth),
+ LastInstructionIdx(0), TotalCycles(0), NumMicroOps(0),
ProcResourceUsage(Model.getNumProcResourceKinds(), 0),
ProcResourceMasks(Model.getNumProcResourceKinds()),
ResIdx2ProcResID(Model.getNumProcResourceKinds(), 0) {
diff --git a/llvm/tools/llvm-mca/Views/SummaryView.h b/llvm/tools/llvm-mca/Views/SummaryView.h
index 2622e869ef23e..e2c7cfd19e94a 100644
--- a/llvm/tools/llvm-mca/Views/SummaryView.h
+++ b/llvm/tools/llvm-mca/Views/SummaryView.h
@@ -1,4 +1,4 @@
-//===--------------------- SummaryView.h ---------------------*- C++ -*-===//
+//===--------------------- SummaryView.h ------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/llvm/tools/llvm-mca/Views/TimelineView.h b/llvm/tools/llvm-mca/Views/TimelineView.h
index 81f2b0335081d..81be8244b779d 100644
--- a/llvm/tools/llvm-mca/Views/TimelineView.h
+++ b/llvm/tools/llvm-mca/Views/TimelineView.h
@@ -125,7 +125,7 @@ class TimelineView : public InstructionView {
unsigned LastCycle;
struct TimelineViewEntry {
- int CycleDispatched; // A negative value is an "invalid cycle".
+ int CycleDispatched; // A negative value is an "invalid cycle".
unsigned CycleReady;
unsigned CycleIssued;
unsigned CycleExecuted;
diff --git a/llvm/tools/llvm-mca/Views/View.h b/llvm/tools/llvm-mca/Views/View.h
index 09d8f1b561d7c..c604733d4ec9a 100644
--- a/llvm/tools/llvm-mca/Views/View.h
+++ b/llvm/tools/llvm-mca/Views/View.h
@@ -17,8 +17,8 @@
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MCA/HWEventListener.h"
-#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/JSON.h"
+#include "llvm/Support/raw_ostream.h"
namespace llvm {
namespace mca {
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index 0f1e74baaefc6..a1557337e22e4 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -95,15 +95,13 @@ static cl::opt<std::string>
cl::desc("Target a specific cpu type (-mcpu=help for details)"),
cl::value_desc("cpu-name"), cl::cat(ToolOptions), cl::init("native"));
-static cl::opt<std::string>
- MATTR("mattr",
- cl::desc("Additional target features."),
- cl::cat(ToolOptions));
+static cl::opt<std::string> MATTR("mattr",
+ cl::desc("Additional target features."),
+ cl::cat(ToolOptions));
-static cl::opt<bool>
- PrintJson("json",
- cl::desc("Print the output in json format"),
- cl::cat(ToolOptions), cl::init(false));
+static cl::opt<bool> PrintJson("json",
+ cl::desc("Print the output in json format"),
+ cl::cat(ToolOptions), cl::init(false));
static cl::opt<int>
OutputAsmVariant("output-asm-variant",
@@ -573,8 +571,8 @@ int main(int argc, char **argv) {
mca::PipelinePrinter Printer(*P, *Region, RegionIdx, *STI);
if (PrintJson) {
- auto IV = std::make_unique<mca::InstructionView>(*STI, *IP, Insts);
- Printer.addView(std::move(IV));
+ Printer.addView(
+ std::make_unique<mca::InstructionView>(*STI, *IP, Insts));
}
// Create the views for this pipeline, execute, and emit a report.
More information about the llvm-commits
mailing list