|
LLVM 24.0.0git
|
#include "llvm/Transforms/IPO/OpenMPOpt.h"#include "IPOOptions.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/EnumeratedArray.h"#include "llvm/ADT/PostOrderIterator.h"#include "llvm/ADT/SetVector.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/StringExtras.h"#include "llvm/ADT/StringRef.h"#include "llvm/Analysis/CallGraph.h"#include "llvm/Analysis/MemoryBuiltins.h"#include "llvm/Analysis/MemoryLocation.h"#include "llvm/Analysis/OptimizationRemarkEmitter.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/Frontend/OpenMP/OMPConstants.h"#include "llvm/Frontend/OpenMP/OMPDeviceConstants.h"#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"#include "llvm/IR/Assumptions.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DiagnosticInfo.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/Function.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/IntrinsicsAMDGPU.h"#include "llvm/IR/IntrinsicsNVPTX.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/ProfDataUtils.h"#include "llvm/IR/ProfileSummary.h"#include "llvm/Support/Casting.h"#include "llvm/Support/Debug.h"#include "llvm/TargetParser/AtomicScope.h"#include "llvm/TargetParser/Triple.h"#include "llvm/Transforms/IPO/Attributor.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/CallGraphUpdater.h"#include <algorithm>#include <memory>#include <optional>#include <string>#include "llvm/Frontend/OpenMP/OMPKinds.def"Go to the source code of this file.
Namespaces | |
| namespace | KernelInfo |
Macros | |
| #define | DEBUG_TYPE "openmp-opt" |
| #define | KERNEL_ENVIRONMENT_IDX(MEMBER, IDX) |
| #define | KERNEL_ENVIRONMENT_CONFIGURATION_IDX(MEMBER, IDX) |
| #define | KERNEL_ENVIRONMENT_GETTER(MEMBER, RETURNTYPE) |
| #define | KERNEL_ENVIRONMENT_CONFIGURATION_GETTER(MEMBER) |
| #define | ICV_RT_SET(_Name, RTL) |
| #define | ICV_RT_GET(Name, RTL) |
| #define | ICV_DATA_ENV(Enum, _Name, _EnvVarName, Init) |
| #define | OMP_TYPE(VarName, ...) |
| #define | OMP_ARRAY_TYPE(VarName, ...) |
| #define | OMP_FUNCTION_TYPE(VarName, ...) |
| #define | OMP_STRUCT_TYPE(VarName, ...) |
| #define | OMP_RTL(_Enum, _Name, _IsVarArg, _ReturnType, ...) |
| #define | OMP_RTL_CB_INFO(_Enum, _Name, _ArgNo, _ArgIndices, _IsVarArg) |
| #define | KERNEL_ENVIRONMENT_CONFIGURATION_SETTER(MEMBER) |
Functions | |
| STATISTIC (NumOpenMPRuntimeCallsDeduplicated, "Number of OpenMP runtime calls deduplicated") | |
| STATISTIC (NumOpenMPParallelRegionsDeleted, "Number of OpenMP parallel regions deleted") | |
| STATISTIC (NumOpenMPRuntimeFunctionsIdentified, "Number of OpenMP runtime functions identified") | |
| STATISTIC (NumOpenMPRuntimeFunctionUsesIdentified, "Number of OpenMP runtime function uses identified") | |
| STATISTIC (NumOpenMPTargetRegionKernels, "Number of OpenMP target region entry points (=kernels) identified") | |
| STATISTIC (NumNonOpenMPTargetRegionKernels, "Number of non-OpenMP target region kernels identified") | |
| STATISTIC (NumOpenMPTargetRegionKernelsSPMD, "Number of OpenMP target region entry points (=kernels) executed in " "SPMD-mode instead of generic-mode") | |
| STATISTIC (NumOpenMPTargetRegionKernelsWithoutStateMachine, "Number of OpenMP target region entry points (=kernels) executed in " "generic-mode without a state machines") | |
| STATISTIC (NumOpenMPTargetRegionKernelsCustomStateMachineWithFallback, "Number of OpenMP target region entry points (=kernels) executed in " "generic-mode with customized state machines with fallback") | |
| STATISTIC (NumOpenMPTargetRegionKernelsCustomStateMachineWithoutFallback, "Number of OpenMP target region entry points (=kernels) executed in " "generic-mode with customized state machines without fallback") | |
| STATISTIC (NumOpenMPParallelRegionsReplacedInGPUStateMachine, "Number of OpenMP parallel regions replaced with ID in GPU state machines") | |
| STATISTIC (NumOpenMPParallelRegionsMerged, "Number of OpenMP parallel regions merged") | |
| STATISTIC (NumBytesMovedToSharedMemory, "Amount of memory pushed to shared memory") | |
| STATISTIC (NumBarriersEliminated, "Number of redundant barriers eliminated") | |
| GlobalVariable * | KernelInfo::getKernelEnvironementGVFromKernelInitCB (CallBase *KernelInitCB) |
| ConstantStruct * | KernelInfo::getKernelEnvironementFromKernelInitCB (CallBase *KernelInitCB) |
| static bool | shouldSpecializeIndirectCallee (Attributor &A, const AbstractAttribute &, CallBase &, Function &, unsigned NumAssumedCallees) |
| Bound the if-cascade AAIndirectCallInfo builds for an indirect call. | |
Variables | |
| static constexpr auto | TAG = "[" DEBUG_TYPE "]" |
| #define DEBUG_TYPE "openmp-opt" |
Definition at line 74 of file OpenMPOpt.cpp.
| #define ICV_DATA_ENV | ( | Enum, | |
| _Name, | |||
| _EnvVarName, | |||
| Init ) |
| #define ICV_RT_GET | ( | Name, | |
| RTL ) |
| #define ICV_RT_SET | ( | _Name, | |
| RTL ) |
| #define KERNEL_ENVIRONMENT_CONFIGURATION_GETTER | ( | MEMBER | ) |
Definition at line 166 of file OpenMPOpt.cpp.
| #define KERNEL_ENVIRONMENT_CONFIGURATION_IDX | ( | MEMBER, | |
| IDX ) |
Definition at line 143 of file OpenMPOpt.cpp.
| #define KERNEL_ENVIRONMENT_CONFIGURATION_SETTER | ( | MEMBER | ) |
Definition at line 3772 of file OpenMPOpt.cpp.
| #define KERNEL_ENVIRONMENT_GETTER | ( | MEMBER, | |
| RETURNTYPE ) |
Definition at line 156 of file OpenMPOpt.cpp.
| #define KERNEL_ENVIRONMENT_IDX | ( | MEMBER, | |
| IDX ) |
Definition at line 135 of file OpenMPOpt.cpp.
| #define OMP_ARRAY_TYPE | ( | VarName, | |
| ... ) |
| #define OMP_FUNCTION_TYPE | ( | VarName, | |
| ... ) |
| #define OMP_RTL | ( | _Enum, | |
| _Name, | |||
| _IsVarArg, | |||
| _ReturnType, | |||
| ... ) |
| #define OMP_RTL_CB_INFO | ( | _Enum, | |
| _Name, | |||
| _ArgNo, | |||
| _ArgIndices, | |||
| _IsVarArg ) |
| #define OMP_STRUCT_TYPE | ( | VarName, | |
| ... ) |
| #define OMP_TYPE | ( | VarName, | |
| ... ) |
|
static |
Bound the if-cascade AAIndirectCallInfo builds for an indirect call.
Device code reaches its callees through function-pointer tables and virtual dispatch, so a call site can see every address-taken candidate in the module; specializing all of them costs more in code size and compile time than the direct calls are worth.
This is a threshold on the call site rather than a limit on how many callees get specialized: the Attributor asks about each callee with the same total, so a site above the threshold keeps its indirect call instead of getting this many direct ones plus a fallback.
Definition at line 5910 of file OpenMPOpt.cpp.
References A().
Referenced by llvm::OpenMPOptCGSCCPass::run(), and llvm::OpenMPOptPass::run().
| STATISTIC | ( | NumBarriersEliminated | , |
| "Number of redundant barriers eliminated" | ) |
| STATISTIC | ( | NumBytesMovedToSharedMemory | , |
| "Amount of memory pushed to shared memory" | ) |
| STATISTIC | ( | NumNonOpenMPTargetRegionKernels | , |
| "Number of non-OpenMP target region kernels identified" | ) |
| STATISTIC | ( | NumOpenMPParallelRegionsDeleted | , |
| "Number of OpenMP parallel regions deleted" | ) |
| STATISTIC | ( | NumOpenMPParallelRegionsMerged | , |
| "Number of OpenMP parallel regions merged" | ) |
| STATISTIC | ( | NumOpenMPParallelRegionsReplacedInGPUStateMachine | , |
| "Number of OpenMP parallel regions replaced with ID in GPU state machines" | ) |
| STATISTIC | ( | NumOpenMPRuntimeCallsDeduplicated | , |
| "Number of OpenMP runtime calls deduplicated" | ) |
| STATISTIC | ( | NumOpenMPRuntimeFunctionsIdentified | , |
| "Number of OpenMP runtime functions identified" | ) |
| STATISTIC | ( | NumOpenMPRuntimeFunctionUsesIdentified | , |
| "Number of OpenMP runtime function uses identified" | ) |
| STATISTIC | ( | NumOpenMPTargetRegionKernels | , |
| "Number of OpenMP target region entry points (=kernels) identified" | ) |
| STATISTIC | ( | NumOpenMPTargetRegionKernelsCustomStateMachineWithFallback | , |
| "Number of OpenMP target region entry points (=kernels) executed in " "generic-mode with customized state machines with fallback" | ) |
| STATISTIC | ( | NumOpenMPTargetRegionKernelsCustomStateMachineWithoutFallback | , |
| "Number of OpenMP target region entry points (=kernels) executed in " "generic-mode with customized state machines without fallback" | ) |
| STATISTIC | ( | NumOpenMPTargetRegionKernelsSPMD | , |
| "Number of OpenMP target region entry points (=kernels) executed in " "SPMD-mode instead of generic-mode" | ) |
| STATISTIC | ( | NumOpenMPTargetRegionKernelsWithoutStateMachine | , |
| "Number of OpenMP target region entry points (=kernels) executed in " "generic-mode without a state machines" | ) |
|
staticconstexpr |
Definition at line 110 of file OpenMPOpt.cpp.
Referenced by llvm::yaml::ScalarEnumerationTraits< WasmYAML::ExportKind >::enumeration(), llvm::yaml::ScalarEnumerationTraits< WasmYAML::SectionType >::enumeration(), llvm::yaml::ScalarEnumerationTraits< WasmYAML::SymbolKind >::enumeration(), llvm::OpenMPOptCGSCCPass::run(), llvm::OpenMPOptPass::run(), and llvm::wasm::sectionTypeToString().