diff options
author | Matt Davis <Matthew.Davis@sony.com> | 2018-09-11 18:47:48 +0000 |
---|---|---|
committer | Matt Davis <Matthew.Davis@sony.com> | 2018-09-11 18:47:48 +0000 |
commit | db834837c2645ed2f3df1e77aff6a4aa14d6980c (patch) | |
tree | edb28df17860ea6553ec0623500d056e4adc9725 /llvm/tools/llvm-mca/include/HardwareUnits | |
parent | 44c1b3a331cd58792491a04c623b399b42ba3d1f (diff) | |
download | bcm5719-llvm-db834837c2645ed2f3df1e77aff6a4aa14d6980c.tar.gz bcm5719-llvm-db834837c2645ed2f3df1e77aff6a4aa14d6980c.zip |
[llvm-mca] Delay calculation of Cycles per Resources, separate the cycles and resource quantities.
Summary:
This patch removes the storing of accumulated floating point data
within the llvm-mca library.
This patch splits-up the two quantities: cycles and number of resource units.
By splitting-up these two quantities, we delay the calculation of "cycles per resource unit"
until that value is read, reducing the chance of accumulating floating point error.
I considered using the APFloat, but after measuring performance, for a large (many iteration)
sample, I decided to go with this faster solution.
Reviewers: andreadb, courbet, RKSimon
Reviewed By: andreadb
Subscribers: llvm-commits, javed.absar, tschuett, gbedwell
Differential Revision: https://reviews.llvm.org/D51903
llvm-svn: 341980
Diffstat (limited to 'llvm/tools/llvm-mca/include/HardwareUnits')
-rw-r--r-- | llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h | 3 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h | 11 |
2 files changed, 8 insertions, 6 deletions
diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h b/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h index c3f893660eb..dfac15f53fc 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/ResourceManager.h @@ -17,6 +17,7 @@ #define LLVM_TOOLS_LLVM_MCA_RESOURCE_MANAGER_H #include "Instruction.h" +#include "Support.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" @@ -344,7 +345,7 @@ public: void issueInstruction( const InstrDesc &Desc, - llvm::SmallVectorImpl<std::pair<ResourceRef, double>> &Pipes); + llvm::SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Pipes); void cycleEvent(llvm::SmallVectorImpl<ResourceRef> &ResourcesFreed); diff --git a/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h b/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h index 61bbf3fcf36..db124958ee5 100644 --- a/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h +++ b/llvm/tools/llvm-mca/include/HardwareUnits/Scheduler.h @@ -18,6 +18,7 @@ #include "HardwareUnits/HardwareUnit.h" #include "HardwareUnits/LSUnit.h" #include "ResourceManager.h" +#include "Support.h" #include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCSchedule.h" @@ -103,7 +104,7 @@ class Scheduler : public HardwareUnit { /// Issue an instruction without updating the ready queue. void issueInstructionImpl( InstRef &IR, - llvm::SmallVectorImpl<std::pair<ResourceRef, double>> &Pipes); + llvm::SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Pipes); // Identify instructions that have finished executing, and remove them from // the IssuedSet. References to executed instructions are added to input @@ -164,10 +165,10 @@ public: /// Issue an instruction and populates a vector of used pipeline resources, /// and a vector of instructions that transitioned to the ready state as a /// result of this event. - void - issueInstruction(InstRef &IR, - llvm::SmallVectorImpl<std::pair<ResourceRef, double>> &Used, - llvm::SmallVectorImpl<InstRef> &Ready); + void issueInstruction( + InstRef &IR, + llvm::SmallVectorImpl<std::pair<ResourceRef, ResourceCycles>> &Used, + llvm::SmallVectorImpl<InstRef> &Ready); /// Returns true if IR has to be issued immediately, or if IR is a zero /// latency instruction. |