18using namespace mlir::amx;
24struct AMXIntrinsicOpConversion
29 matchAndRewrite(amx::AMXIntrinsicOp op, ArrayRef<Value> operands,
30 ConversionPatternRewriter &rewriter)
const override {
31 const LLVMTypeConverter &typeConverter = *getTypeConverter();
33 op, rewriter.getStringAttr(op.getIntrinsicName()),
34 op.getIntrinsicOperands(operands, typeConverter, rewriter),
35 typeConverter, rewriter);
43 patterns.add<AMXIntrinsicOpConversion>(converter);
44 converter.addConversion([&](amx::TileType type) {
45 return LLVM::LLVMX86AMXType::get(&converter.
getContext());
50 target.addIllegalDialect<AMXDialect>();
58 void populateConvertToLLVMConversionPatterns(
68 dialect->addInterfaces<AMXToLLVMDialectInterface>();
Utility class for operation conversions targeting the LLVM dialect that allows for matching and rewri...
ConvertOpInterfaceToLLVMPattern(const LLVMTypeConverter &typeConverter, PatternBenefit benefit=1)
Base class for dialect interfaces providing translation to LLVM IR.
ConvertToLLVMPatternInterface(Dialect *dialect)
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
bool addExtension(TypeID extensionID, std::unique_ptr< DialectExtensionBase > extension)
Add the given extension to the registry.
Derived class that automatically populates legalization information for different LLVM ops.
Conversion from types to the LLVM IR dialect.
MLIRContext & getContext() const
Returns the MLIR context.
MLIRContext is the top-level object for a collection of MLIR operations.
LogicalResult intrinsicRewrite(Operation *op, StringRef intrinsic, ValueRange operands, const LLVMTypeConverter &typeConverter, RewriterBase &rewriter)
Replaces the given operation "op" with a call to an LLVM intrinsic with the specified name "intrinsic...
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
void populateAMXLegalizeForLLVMExportPatterns(LLVMTypeConverter &converter, RewritePatternSet &patterns)
Collect a set of patterns to lower AMX ops to ops that map to LLVM intrinsics.
void configureAMXLegalizeForExportTarget(LLVMConversionTarget &target)
Configure the target to support lowering AMX ops to ops that map to LLVM intrinsics.
void registerConvertAMXToLLVMInterface(DialectRegistry ®istry)
Register LLVM conversion interface for AMX dialect.