LLVM 20.0.0git
|
Armv8.1m introduced MVE, M-Profile Vector Extension, and low-overhead branches to help accelerate DSP applications. More...
#include "ARM.h"
#include "ARMSubtarget.h"
#include "ARMTargetTransformInfo.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicsARM.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "mve-tail-predication" |
#define | DESC "Transform predicated vector loops to use MVE tail predication" |
Variables | |
cl::opt< TailPredication::Mode > | EnableTailPredication ("tail-predication", cl::desc("MVE tail-predication pass options"), cl::init(TailPredication::Enabled), cl::values(clEnumValN(TailPredication::Disabled, "disabled", "Don't tail-predicate loops"), clEnumValN(TailPredication::EnabledNoReductions, "enabled-no-reductions", "Enable tail-predication, but not for reduction loops"), clEnumValN(TailPredication::Enabled, "enabled", "Enable tail-predication, including reduction loops"), clEnumValN(TailPredication::ForceEnabledNoReductions, "force-enabled-no-reductions", "Enable tail-predication, but not for reduction loops, " "and force this which might be unsafe"), clEnumValN(TailPredication::ForceEnabled, "force-enabled", "Enable tail-predication, including reduction loops, " "and force this which might be unsafe"))) |
Armv8.1m introduced MVE, M-Profile Vector Extension, and low-overhead branches to help accelerate DSP applications.
These two extensions, combined with a new form of predication called tail-predication, can be used to provide implicit vector predication within a low-overhead loop. This is implicit because the predicate of active/inactive lanes is calculated by hardware, and thus does not need to be explicitly passed to vector instructions. The instructions responsible for this are the DLSTP and WLSTP instructions, which setup a tail-predicated loop and the the total number of data elements processed by the loop. The loop-end LETP instruction is responsible for decrementing and setting the remaining elements to be processed and generating the mask of active lanes.
The HardwareLoops pass inserts intrinsics identifying loops that the backend will attempt to convert into a low-overhead loop. The vectorizer is responsible for generating a vectorized loop in which the lanes are predicated upon an get.active.lane.mask intrinsic. This pass looks at these get.active.lane.mask intrinsic and attempts to convert them to VCTP instructions. This will be picked up by the ARM Low-overhead loop pass later in the backend, which performs the final transformation to a DLSTP or WLSTP tail-predicated loop.
Definition in file MVETailPredication.cpp.
#define DEBUG_TYPE "mve-tail-predication" |
Definition at line 57 of file MVETailPredication.cpp.
Definition at line 58 of file MVETailPredication.cpp.
cl::opt< TailPredication::Mode > EnableTailPredication("tail-predication", cl::desc("MVE tail-predication pass options"), cl::init(TailPredication::Enabled), cl::values(clEnumValN(TailPredication::Disabled, "disabled", "Don't tail-predicate loops"), clEnumValN(TailPredication::EnabledNoReductions, "enabled-no-reductions", "Enable tail-predication, but not for reduction loops"), clEnumValN(TailPredication::Enabled, "enabled", "Enable tail-predication, including reduction loops"), clEnumValN(TailPredication::ForceEnabledNoReductions, "force-enabled-no-reductions", "Enable tail-predication, but not for reduction loops, " "and force this which might be unsafe"), clEnumValN(TailPredication::ForceEnabled, "force-enabled", "Enable tail-predication, including reduction loops, " "and force this which might be unsafe"))) | ( | "tail-predication" | , |
cl::desc("MVE tail-predication pass options") | , | ||
cl::init(TailPredication::Enabled) | , | ||
cl::values(clEnumValN(TailPredication::Disabled, "disabled", "Don't tail-predicate loops"), clEnumValN(TailPredication::EnabledNoReductions, "enabled-no-reductions", "Enable tail-predication, but not for reduction loops"), clEnumValN(TailPredication::Enabled, "enabled", "Enable tail-predication, including reduction loops"), clEnumValN(TailPredication::ForceEnabledNoReductions, "force-enabled-no-reductions", "Enable tail-predication, but not for reduction loops, " "and force this which might be unsafe"), clEnumValN(TailPredication::ForceEnabled, "force-enabled", "Enable tail-predication, including reduction loops, " "and force this which might be unsafe")) | |||
) |