summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/SummaryView.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-mca/SummaryView.h')
-rw-r--r--llvm/tools/llvm-mca/SummaryView.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/llvm/tools/llvm-mca/SummaryView.h b/llvm/tools/llvm-mca/SummaryView.h
index 0484057fb10..fe8a5e20f9d 100644
--- a/llvm/tools/llvm-mca/SummaryView.h
+++ b/llvm/tools/llvm-mca/SummaryView.h
@@ -14,12 +14,12 @@
/// performance throughput. Below is an example of summary view:
///
///
-/// Iterations: 300
-/// Instructions: 900
-/// Total Cycles: 610
-/// Dispatch Width: 2
-/// IPC: 1.48
-///
+/// Iterations: 300
+/// Instructions: 900
+/// Total Cycles: 610
+/// Dispatch Width: 2
+/// IPC: 1.48
+/// Block RThroughput: 2.0
///
/// The summary view collects a few performance numbers. The two main
/// performance indicators are 'Total Cycles' and IPC (Instructions Per Cycle).
@@ -31,22 +31,41 @@
#include "SourceMgr.h"
#include "View.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/MC/MCSchedule.h"
#include "llvm/Support/raw_ostream.h"
namespace mca {
/// A view that collects and prints a few performance numbers.
class SummaryView : public View {
+ const llvm::MCSchedModel &SM;
const SourceMgr &Source;
const unsigned DispatchWidth;
unsigned TotalCycles;
+ // The total number of micro opcodes contributed by a block of instructions.
+ unsigned NumMicroOps;
+ // For each processor resource, this map stores the cumulative number of
+ // resource cycles consumed by a block of instructions. The resource mask ID
+ // is used as the key value to access elements of this map.
+ llvm::DenseMap<uint64_t, unsigned> ProcResourceUsage;
+
+ // Compute the reciprocal throughput for the analyzed code block.
+ // The reciprocal block throughput is computed as the MAX between:
+ // - NumMicroOps / DispatchWidth
+ // - Total Resource Cycles / #Units (for every resource consumed).
+ double getBlockRThroughput() const;
public:
- SummaryView(const SourceMgr &S, unsigned Width)
- : Source(S), DispatchWidth(Width), TotalCycles(0) {}
+ SummaryView(const llvm::MCSchedModel &Model, const SourceMgr &S,
+ unsigned Width)
+ : SM(Model), Source(S), DispatchWidth(Width), TotalCycles(0),
+ NumMicroOps(0) {}
void onCycleEnd() override { ++TotalCycles; }
+ void onInstructionEvent(const HWInstructionEvent &Event) override;
+
void printView(llvm::raw_ostream &OS) const override;
};
} // namespace mca
OpenPOWER on IntegriCloud