aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools
diff options
context:
space:
mode:
authorAndrea Di Biagio <andrea.dibiagio@sony.com>2021-06-15 21:34:41 +0100
committerAndrea Di Biagio <andrea.dibiagio@sony.com>2021-06-15 21:41:36 +0100
commita04f01bab2da4650cc90a351fd734e626e6797af (patch)
treed536041f6518272d389d5e3f2905f4ebbc0be550 /llvm/tools
parentf7a23ecece524564a0c3e09787142cc6061027bb (diff)
downloadllvm-a04f01bab2da4650cc90a351fd734e626e6797af.zip
llvm-a04f01bab2da4650cc90a351fd734e626e6797af.tar.gz
llvm-a04f01bab2da4650cc90a351fd734e626e6797af.tar.bz2
Revert "[MCA] Adding the CustomBehaviour class to llvm-mca"
This reverts commit f7a23ecece524564a0c3e09787142cc6061027bb. It appears to breaks buildbots that don't build the AMDGPU backend.
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-mca/CMakeLists.txt6
-rw-r--r--llvm/tools/llvm-mca/Views/DispatchStatistics.cpp2
-rw-r--r--llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.cpp33
-rw-r--r--llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.h57
-rw-r--r--llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt17
-rw-r--r--llvm/tools/llvm-mca/lib/CMakeLists.txt8
-rw-r--r--llvm/tools/llvm-mca/llvm-mca.cpp56
7 files changed, 1 insertions, 178 deletions
diff --git a/llvm/tools/llvm-mca/CMakeLists.txt b/llvm/tools/llvm-mca/CMakeLists.txt
index 1661ab9..9df1923 100644
--- a/llvm/tools/llvm-mca/CMakeLists.txt
+++ b/llvm/tools/llvm-mca/CMakeLists.txt
@@ -1,7 +1,5 @@
include_directories(include)
-add_subdirectory(lib)
-
set(LLVM_LINK_COMPONENTS
AllTargetsAsmParsers
AllTargetsDescs
@@ -32,7 +30,3 @@ add_llvm_tool(llvm-mca
)
set(LLVM_MCA_SOURCE_DIR ${CURRENT_SOURCE_DIR})
-
-target_link_libraries(llvm-mca PRIVATE
- ${LLVM_MCA_CUSTOMBEHAVIOUR_TARGETS}
- )
diff --git a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp
index d5e4171..a1c0cf2 100644
--- a/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp
+++ b/llvm/tools/llvm-mca/Views/DispatchStatistics.cpp
@@ -77,8 +77,6 @@ void DispatchStatistics::printDispatchStalls(raw_ostream &OS) const {
printStalls(SS, HWStalls[HWStallEvent::StoreQueueFull], NumCycles);
SS << "\nGROUP - Static restrictions on the dispatch group: ";
printStalls(SS, HWStalls[HWStallEvent::DispatchGroupStall], NumCycles);
- SS << "\nUSH - Uncategorised Structural Hazard: ";
- printStalls(SS, HWStalls[HWStallEvent::CustomBehaviourStall], NumCycles);
SS << '\n';
SS.flush();
OS << Buffer;
diff --git a/llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.cpp b/llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.cpp
deleted file mode 100644
index a655f3f..0000000
--- a/llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-//===------------------ AMDGPUCustomBehaviour.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.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-/// \file
-///
-/// This file implements methods from the AMDGPUCustomBehaviour class.
-///
-//===----------------------------------------------------------------------===//
-
-#include "AMDGPUCustomBehaviour.h"
-#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
-#include "SIInstrInfo.h"
-#include "llvm/Support/WithColor.h"
-
-namespace llvm {
-namespace mca {
-
-AMDGPUCustomBehaviour::AMDGPUCustomBehaviour(const MCSubtargetInfo &STI,
- const SourceMgr &SrcMgr,
- const MCInstrInfo &MCII)
- : CustomBehaviour(STI, SrcMgr, MCII) {}
-
-unsigned AMDGPUCustomBehaviour::checkCustomHazard(ArrayRef<InstRef> IssuedInst,
- const InstRef &IR) {
- return 0;
-}
-
-} // namespace mca
-} // namespace llvm
diff --git a/llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.h b/llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.h
deleted file mode 100644
index 0dd21c7..0000000
--- a/llvm/tools/llvm-mca/lib/AMDGPU/AMDGPUCustomBehaviour.h
+++ /dev/null
@@ -1,57 +0,0 @@
-//===------------------- AMDGPUCustomBehaviour.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.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-/// \file
-///
-/// This file defines the AMDGPUCustomBehaviour class which inherits from
-/// CustomBehaviour.
-///
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TOOLS_LLVM_MCA_LIB_AMDGPU_AMDGPUCUSTOMBEHAVIOUR_H
-#define LLVM_TOOLS_LLVM_MCA_LIB_AMDGPU_AMDGPUCUSTOMBEHAVIOUR_H
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/MCA/CustomBehaviour.h"
-#include "llvm/Support/TargetParser.h"
-
-namespace llvm {
-namespace mca {
-
-class AMDGPUInstrPostProcess : public InstrPostProcess {
-public:
- AMDGPUInstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
- : InstrPostProcess(STI, MCII) {}
-
- ~AMDGPUInstrPostProcess() {}
-
- void postProcessInstruction(std::unique_ptr<Instruction> &Inst,
- const MCInst &MCI) override {}
-};
-
-class AMDGPUCustomBehaviour : public CustomBehaviour {
-public:
- AMDGPUCustomBehaviour(const MCSubtargetInfo &STI, const SourceMgr &SrcMgr,
- const MCInstrInfo &MCII);
-
- ~AMDGPUCustomBehaviour() {}
-
- /// This method is used to determine if an instruction
- /// should be allowed to be dispatched. The return value is
- /// how many cycles until the instruction can be dispatched.
- /// This method is called after MCA has already checked for
- /// register and hardware dependencies so this method should only
- /// implement custom behaviour and dependencies that are not picked up
- /// by MCA naturally.
- unsigned checkCustomHazard(ArrayRef<InstRef> IssuedInst,
- const InstRef &IR) override;
-};
-
-} // namespace mca
-} // namespace llvm
-
-#endif /* LLVM_TOOLS_LLVM_MCA_LIB_AMDGPU_AMDGPUCUSTOMBEHAVIOUR_H */
diff --git a/llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt b/llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
deleted file mode 100644
index 19c3a8f..0000000
--- a/llvm/tools/llvm-mca/lib/AMDGPU/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-include_directories(
- ${LLVM_MAIN_SRC_DIR}/lib/Target/AMDGPU
- ${LLVM_BINARY_DIR}/lib/Target/AMDGPU
- )
-
-set(LLVM_LINK_COMPONENTS
- AMDGPU
- Core
- Support
- )
-
-add_llvm_library(LLVMMCACustomBehaviourAMDGPU
- AMDGPUCustomBehaviour.cpp
-
- DEPENDS
- AMDGPUCommonTableGen
- )
diff --git a/llvm/tools/llvm-mca/lib/CMakeLists.txt b/llvm/tools/llvm-mca/lib/CMakeLists.txt
deleted file mode 100644
index 75f639e..0000000
--- a/llvm/tools/llvm-mca/lib/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-set(TARGETS_TO_APPEND "")
-
-if (LLVM_TARGETS_TO_BUILD MATCHES "AMDGPU")
- add_subdirectory(AMDGPU)
- list(APPEND TARGETS_TO_APPEND LLVMMCACustomBehaviourAMDGPU)
-endif()
-
-set(LLVM_MCA_CUSTOMBEHAVIOUR_TARGETS ${TARGETS_TO_APPEND} PARENT_SCOPE)
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index df19c74..3bb2f10 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -32,7 +32,6 @@
#include "Views/SchedulerStatistics.h"
#include "Views/SummaryView.h"
#include "Views/TimelineView.h"
-#include "lib/AMDGPU/AMDGPUCustomBehaviour.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeEmitter.h"
@@ -43,7 +42,6 @@
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
#include "llvm/MCA/CodeEmitter.h"
#include "llvm/MCA/Context.h"
-#include "llvm/MCA/CustomBehaviour.h"
#include "llvm/MCA/InstrBuilder.h"
#include "llvm/MCA/Pipeline.h"
#include "llvm/MCA/Stages/EntryStage.h"
@@ -222,12 +220,6 @@ static cl::opt<bool> ShowEncoding(
cl::desc("Print encoding information in the instruction info view"),
cl::cat(ViewOptions), cl::init(false));
-static cl::opt<bool> DisableCustomBehaviour(
- "disable-cb",
- cl::desc(
- "Disable custom behaviour (use the default class which does nothing)."),
- cl::cat(ViewOptions), cl::init(false));
-
namespace {
const Target *getTarget(const char *ProgName) {
@@ -293,39 +285,6 @@ static void processViewOptions(bool IsOutOfOrder) {
processOptionImpl(PrintRetireStats, Default);
}
-std::unique_ptr<mca::InstrPostProcess>
-createInstrPostProcess(const Triple &TheTriple, const MCSubtargetInfo &STI,
- const MCInstrInfo &MCII) {
- // Might be a good idea to have a separate flag so that InstrPostProcess
- // can be used with or without CustomBehaviour
- if (DisableCustomBehaviour)
- return std::make_unique<mca::InstrPostProcess>(STI, MCII);
-
- if (TheTriple.isAMDGPU())
- return std::make_unique<mca::AMDGPUInstrPostProcess>(STI, MCII);
-
- return std::make_unique<mca::InstrPostProcess>(STI, MCII);
-}
-
-std::unique_ptr<mca::CustomBehaviour>
-createCustomBehaviour(const Triple &TheTriple, const MCSubtargetInfo &STI,
- const mca::SourceMgr &SrcMgr, const MCInstrInfo &MCII) {
- // Build the appropriate CustomBehaviour object for the current target.
- // The CustomBehaviour class should never depend on the source code,
- // but it can depend on the list of mca::Instruction and any classes
- // that can be built using just the target info. If you need extra
- // information from the source code or the list of MCInst, consider
- // adding that information to the mca::Instruction class and setting
- // it during InstrBuilder::createInstruction().
- if (DisableCustomBehaviour)
- return std::make_unique<mca::CustomBehaviour>(STI, SrcMgr, MCII);
-
- if (TheTriple.isAMDGPU())
- return std::make_unique<mca::AMDGPUCustomBehaviour>(STI, SrcMgr, MCII);
-
- return std::make_unique<mca::CustomBehaviour>(STI, SrcMgr, MCII);
-}
-
// Returns true on success.
static bool runPipeline(mca::Pipeline &P) {
// Handle pipeline errors here.
@@ -539,8 +498,6 @@ int main(int argc, char **argv) {
// Lower the MCInst sequence into an mca::Instruction sequence.
ArrayRef<MCInst> Insts = Region->getInstructions();
mca::CodeEmitter CE(*STI, *MAB, *MCE, Insts);
- std::unique_ptr<mca::InstrPostProcess> IPP =
- createInstrPostProcess(TheTriple, *STI, *MCII);
std::vector<std::unique_ptr<mca::Instruction>> LoweredSequence;
for (const MCInst &MCI : Insts) {
Expected<std::unique_ptr<mca::Instruction>> Inst =
@@ -563,8 +520,6 @@ int main(int argc, char **argv) {
return 1;
}
- IPP->postProcessInstruction(Inst.get(), MCI);
-
LoweredSequence.emplace_back(std::move(Inst.get()));
}
@@ -592,17 +547,8 @@ int main(int argc, char **argv) {
continue;
}
- // Create the CustomBehaviour object for enforcing Target Specific
- // behaviours and dependencies that aren't expressed well enough
- // in the tablegen. CB cannot depend on the list of MCInst or
- // the source code (but it can depend on the list of
- // mca::Instruction or any objects that can be reconstructed
- // from the target information).
- std::unique_ptr<mca::CustomBehaviour> CB =
- createCustomBehaviour(TheTriple, *STI, S, *MCII);
-
// Create a basic pipeline simulating an out-of-order backend.
- auto P = MCA.createDefaultPipeline(PO, S, *CB);
+ auto P = MCA.createDefaultPipeline(PO, S);
mca::PipelinePrinter Printer(*P, PrintJson ? mca::View::OK_JSON
: mca::View::OK_READABLE);