1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[MCA] Correctly update the UsedResourceGroups mask in the InstrBuilder.

Found by inspection when looking at the debug output of MCA.
This problem was latent, and none of the upstream models were affected by it.
No functional change intended.

llvm-svn: 357000
This commit is contained in:
Andrea Di Biagio 2019-03-26 15:38:37 +00:00
parent 7bacd52b37
commit a1cb49539d
5 changed files with 16 additions and 10 deletions

View File

@ -68,9 +68,7 @@ class DispatchStage final : public Stage {
public:
DispatchStage(const MCSubtargetInfo &Subtarget, const MCRegisterInfo &MRI,
unsigned MaxDispatchWidth, RetireControlUnit &R,
RegisterFile &F)
: DispatchWidth(MaxDispatchWidth), AvailableEntries(MaxDispatchWidth),
CarryOver(0U), CarriedOver(), STI(Subtarget), RCU(R), PRF(F) {}
RegisterFile &F);
bool isAvailable(const InstRef &IR) const override;

View File

@ -115,6 +115,7 @@ static void initializeUsedResources(InstrDesc &ID,
} else {
// Remove the leading 1 from the resource group mask.
NormalizedMask ^= PowerOf2Floor(NormalizedMask);
UsedResourceGroups |= (A.first ^ NormalizedMask);
}
for (unsigned J = I + 1; J < E; ++J) {

View File

@ -25,6 +25,16 @@
namespace llvm {
namespace mca {
DispatchStage::DispatchStage(const MCSubtargetInfo &Subtarget,
const MCRegisterInfo &MRI,
unsigned MaxDispatchWidth, RetireControlUnit &R,
RegisterFile &F)
: DispatchWidth(MaxDispatchWidth), AvailableEntries(MaxDispatchWidth),
CarryOver(0U), CarriedOver(), STI(Subtarget), RCU(R), PRF(F) {
if (!DispatchWidth)
DispatchWidth = Subtarget.getSchedModel().IssueWidth;
}
void DispatchStage::notifyInstructionDispatched(const InstRef &IR,
ArrayRef<unsigned> UsedRegs,
unsigned UOps) const {

View File

@ -24,7 +24,8 @@ namespace mca {
SummaryView::SummaryView(const MCSchedModel &Model, ArrayRef<MCInst> S,
unsigned Width, bool EmitBottleneckAnalysis)
: SM(Model), Source(S), DispatchWidth(Width), LastInstructionIdx(0),
: SM(Model), Source(S), DispatchWidth(Width?Width: Model.IssueWidth),
LastInstructionIdx(0),
TotalCycles(0), NumMicroOps(0), BPI({0, 0, 0, 0, 0}),
ResourcePressureDistribution(Model.getNumProcResourceKinds(), 0),
ProcResourceUsage(Model.getNumProcResourceKinds(), 0),

View File

@ -381,17 +381,13 @@ int main(int argc, char **argv) {
const MCSchedModel &SM = STI->getSchedModel();
unsigned Width = SM.IssueWidth;
if (DispatchWidth)
Width = DispatchWidth;
// Create an instruction builder.
mca::InstrBuilder IB(*STI, *MCII, *MRI, MCIA.get());
// Create a context to control ownership of the pipeline hardware.
mca::Context MCA(*MRI, *STI);
mca::PipelineOptions PO(Width, RegisterFileSize, LoadQueueSize,
mca::PipelineOptions PO(DispatchWidth, RegisterFileSize, LoadQueueSize,
StoreQueueSize, AssumeNoAlias,
EnableBottleneckAnalysis);
@ -470,7 +466,7 @@ int main(int argc, char **argv) {
if (PrintSummaryView)
Printer.addView(llvm::make_unique<mca::SummaryView>(
SM, Insts, Width, EnableBottleneckAnalysis));
SM, Insts, DispatchWidth, EnableBottleneckAnalysis));
if (PrintInstructionInfoView)
Printer.addView(