14#ifndef AIE_DIALECT_AIEVEC_PIPELINES_PASSES_H
15#define AIE_DIALECT_AIEVEC_PIPELINES_PASSES_H
17#include "mlir/Pass/Pass.h"
18#include "mlir/Pass/PassOptions.h"
41 :
public mlir::PassPipelineOptions<CanonicalizeVectorForAIEVecOptions> {
44 llvm::cl::desc(
"Select AIE version: \"aie\" or \"aie2\". This will "
45 "determine the vector size and available operations."),
46 llvm::cl::init(
"aie")};
48 *
this,
"target-backend",
49 llvm::cl::desc(
"Select translation backend: \"cpp\" or \"llvmir\". This "
50 "will determine the aievec operations used to convert "
51 "from vector dialect."),
52 llvm::cl::init(
"cpp")};
54 *
this,
"bf16-emulation",
56 "Emulate f32 vector arithmetic using bf16 operations. Inserts "
57 "arith.truncf/arith.extf around f32 vector ops to compute in bf16. "
58 "Trades precision for performance."),
59 llvm::cl::init(
false)};
64 :
public mlir::PassPipelineOptions<LowerVectorToAIEVecOptions> {
67 llvm::cl::desc(
"Select AIE version: \"aie\" or \"aie2\". This will "
68 "determine the vector size and available operations."),
69 llvm::cl::init(
"aie")};
71 *
this,
"target-backend",
72 llvm::cl::desc(
"Select translation backend: \"cpp\" or \"llvmir\". This "
73 "will determine the aievec operations used to convert "
74 "from vector dialect."),
75 llvm::cl::init(
"cpp")};
80 :
public mlir::PassPipelineOptions<OptimizeAIEVecOptions> {
83 llvm::cl::desc(
"Select AIE version: \"aie\" or \"aie2\". This will "
84 "determine the vector size and available operations."),
85 llvm::cl::init(
"aie")};
87 *
this,
"target-backend",
88 llvm::cl::desc(
"Select translation backend: \"cpp\" or \"llvmir\". This "
89 "will determine the aievec operations used to convert "
90 "from vector dialect."),
91 llvm::cl::init(
"cpp")};
94 llvm::cl::desc(
"Shift parameter for rounding and saturation"),
100 :
public mlir::PassPipelineOptions<ConvertVectorToAIEVecOptions> {
105 llvm::cl::desc(
"Shift parameter for rounding and saturation"),
108 *
this,
"zero-offset",
109 llvm::cl::desc(
"Zero offset for indicating the location of zeroes in "
110 "convolution filter (useful for 16x16 scheme)"),
114 llvm::cl::desc(
"Duplication factor for each value in convolution filter "
115 "(useful in 8x8 scheme)"),
119 llvm::cl::desc(
"Select AIE version: \"aie\" or \"aie2\". This will "
120 "determine the vector size and available operations."),
121 llvm::cl::init(
"aie")};
123 *
this,
"target-backend",
124 llvm::cl::desc(
"Select translation backend: \"cpp\" or \"llvmir\". This "
125 "will determine the aievec operations used to convert "
126 "from vector dialect."),
127 llvm::cl::init(
"cpp")};
129 *
this,
"bf16-emulation",
131 "Emulate f32 vector arithmetic using bf16 operations. Inserts "
132 "arith.truncf/arith.extf around f32 vector ops to compute in bf16. "
133 "Trades precision for performance."),
134 llvm::cl::init(
false)};
137 auto res = PassPipelineOptions::parseFromString(options);
157 return canonicalizeOptions;
161 return optimizeOptions;
std::unique_ptr<::mlir::Pass > createCopyRemovalPass()
Create a pass that removes unnecessary Copy operations.
void registerAIEVecPipelines()
Register all pipelines for the AIE Vector dialect.
std::unique_ptr<::mlir::Pass > createSplitVectorLoadUpsChainsPass()
Create a pass that splits vector.load + aievec.ups chains to reduce shuffle operations for AIE2p targ...
void buildLowerVectorToAIEVec(mlir::OpPassManager &pm, const LowerVectorToAIEVecOptions &options)
std::unique_ptr<::mlir::Pass > createBF16EmulationPass()
Create a pass that emulates f32 vector arithmetic using bf16 operations.
std::unique_ptr<::mlir::Pass > createDynamicSizeNoImplicitBroadcastPass()
void buildCanonicalizeVectorForAIEVec(mlir::OpPassManager &pm, const CanonicalizeVectorForAIEVecOptions &options)
void buildConvertVectorToAIEVec(mlir::OpPassManager &pm, const ConvertVectorToAIEVecOptions &options)
Adds the "convert-vector-to-aievec" pipeline to the OpPassManager.
void buildDynamicSizeNoImplicitBroadcastPass(mlir::OpPassManager &pm)
void buildOptimizeAIEVec(mlir::OpPassManager &pm, const OptimizeAIEVecOptions &options)
Options for the "canonicalize-vector-for-aievec" pipeline.
PassOptions::Option< bool > enableBF16Emulation
PassOptions::Option< std::string > targetBackend
PassOptions::Option< std::string > aieTarget
Options for the "convert-vector-to-aievec" pipeline.
const LowerVectorToAIEVecOptions & getLowerVectorToAIEVecOptions() const
PassOptions::Option< unsigned > dupFactor
PassOptions::Option< std::string > aieTarget
PassOptions::Option< std::string > targetBackend
PassOptions::Option< unsigned > zeroOffset
PassOptions::Option< unsigned > shiftParam
mlir::LogicalResult parseFromString(mlir::StringRef options)
const CanonicalizeVectorForAIEVecOptions & getCanonicalizeVectorForAIEVecOptions() const
PassOptions::Option< bool > enableBF16Emulation
const OptimizeAIEVecOptions & getOptimizeAIEVecOptions() const
Options for the "lower-vector-to-aievec" pipeline.
PassOptions::Option< std::string > aieTarget
PassOptions::Option< std::string > targetBackend
Options for the "optimize-aievec" pipeline.
PassOptions::Option< unsigned > shiftParam
PassOptions::Option< std::string > targetBackend
PassOptions::Option< std::string > aieTarget