diff options
author | Michael Maitland <michaeltmaitland@gmail.com> | 2023-08-22 17:00:50 -0700 |
---|---|---|
committer | Michael Maitland <michaeltmaitland@gmail.com> | 2023-08-24 19:21:36 -0700 |
commit | 85e3875ad7461fa8320db6895e0189cffb91ae7d (patch) | |
tree | bb79a45adc3a5eafd3931ba2d6b2a118b7abbc97 /llvm/tools/llvm-mca | |
parent | 604aba0c8b79c48b7330ad654067c671786984c2 (diff) | |
download | llvm-85e3875ad7461fa8320db6895e0189cffb91ae7d.zip llvm-85e3875ad7461fa8320db6895e0189cffb91ae7d.tar.gz llvm-85e3875ad7461fa8320db6895e0189cffb91ae7d.tar.bz2 |
[TableGen] Rename ResourceCycles and StartAtCycle to clarify semantics
D150312 added a TODO:
TODO: consider renaming the field `StartAtCycle` and `Cycles` to
`AcquireAtCycle` and `ReleaseAtCycle` respectively, to stress the
fact that resource allocation is now represented as an interval,
relatively to the issue cycle of the instruction.
This patch implements that TODO. This naming clarifies how to use these
fields in the scheduler. In addition it was confusing that `StartAtCycle` was
singular but `Cycles` was plural. This renaming fixes this inconsistency.
This commit as previously reverted since it missed renaming that came
down after rebasing. This version of the commit fixes those problems.
Differential Revision: https://reviews.llvm.org/D158568
Diffstat (limited to 'llvm/tools/llvm-mca')
-rw-r--r-- | llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp | 6 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/Views/ResourcePressureView.cpp | 4 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/Views/ResourcePressureView.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp index b254ccd..b702113 100644 --- a/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp +++ b/llvm/tools/llvm-mca/Views/BottleneckAnalysis.cpp @@ -611,9 +611,9 @@ void BottleneckAnalysis::printBottleneckHints(raw_ostream &OS) const { ArrayRef<unsigned> Distribution = Tracker.getResourcePressureDistribution(); const MCSchedModel &SM = getSubTargetInfo().getSchedModel(); for (unsigned I = 0, E = Distribution.size(); I < E; ++I) { - unsigned ResourceCycles = Distribution[I]; - if (ResourceCycles) { - double Frequency = (double)ResourceCycles * 100 / TotalCycles; + unsigned ReleaseAtCycles = Distribution[I]; + if (ReleaseAtCycles) { + double Frequency = (double)ReleaseAtCycles * 100 / TotalCycles; const MCProcResourceDesc &PRDesc = *SM.getProcResource(I); OS << "\n - " << PRDesc.Name << " [ " << format("%.2f", floor((Frequency * 100) + 0.5) / 100) << "% ]"; diff --git a/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp b/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp index 0f059bc..f39350f 100644 --- a/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp +++ b/llvm/tools/llvm-mca/Views/ResourcePressureView.cpp @@ -54,7 +54,7 @@ void ResourcePressureView::onEvent(const HWInstructionEvent &Event) { const auto &IssueEvent = static_cast<const HWInstructionIssuedEvent &>(Event); ArrayRef<llvm::MCInst> Source = getSource(); const unsigned SourceIdx = Event.IR.getSourceIndex() % Source.size(); - for (const std::pair<ResourceRef, ResourceCycles> &Use : + for (const std::pair<ResourceRef, ReleaseAtCycles> &Use : IssueEvent.UsedResources) { const ResourceRef &RR = Use.first; assert(Resource2VecIndex.contains(RR.first)); @@ -181,7 +181,7 @@ json::Value ResourcePressureView::toJSON() const { ArrayRef<llvm::MCInst> Source = getSource(); const unsigned Executions = LastInstructionIdx / Source.size() + 1; for (const auto &R : enumerate(ResourceUsage)) { - const ResourceCycles &RU = R.value(); + const ReleaseAtCycles &RU = R.value(); if (RU.getNumerator() == 0) continue; unsigned InstructionIndex = R.index() / NumResourceUnits; diff --git a/llvm/tools/llvm-mca/Views/ResourcePressureView.h b/llvm/tools/llvm-mca/Views/ResourcePressureView.h index c3993a0..be8ad04 100644 --- a/llvm/tools/llvm-mca/Views/ResourcePressureView.h +++ b/llvm/tools/llvm-mca/Views/ResourcePressureView.h @@ -78,7 +78,7 @@ class ResourcePressureView : public InstructionView { llvm::DenseMap<unsigned, unsigned> Resource2VecIndex; // Table of resources used by instructions. - std::vector<ResourceCycles> ResourceUsage; + std::vector<ReleaseAtCycles> ResourceUsage; unsigned NumResourceUnits; void printResourcePressurePerIter(llvm::raw_ostream &OS) const; |