#ifndef MLIR_DIALECT_ARMSME_TRANSFORMS_PASSES_H
#define MLIR_DIALECT_ARMSME_TRANSFORMS_PASSES_H
+#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Pass/Pass.h"
namespace mlir {
class RewritePatternSet;
namespace arm_sme {
+//===----------------------------------------------------------------------===//
+// The EnableArmStreaming pass.
+//===----------------------------------------------------------------------===//
// Options for Armv9 Streaming SVE mode. By default, streaming-mode is part of
// the function interface (ABI) and the caller manages PSTATE.SM on entry/exit.
// In a locally streaming function PSTATE.SM is kept internal and the callee
std::unique_ptr<Pass> createTileAllocationPass();
//===----------------------------------------------------------------------===//
+// Type ArmSMETypeConverter pass.
+//===----------------------------------------------------------------------===//
+class ArmSMETypeConverter : public LLVMTypeConverter {
+public:
+ ArmSMETypeConverter(MLIRContext *ctx, const LowerToLLVMOptions &options);
+};
+
+//===----------------------------------------------------------------------===//
// Registration
//===----------------------------------------------------------------------===//
MLIRArmNeonDialect
MLIRArmSMEDialect
MLIRArmSMETransforms
+ MLIRVectorToArmSME
MLIRArmSVEDialect
MLIRArmSVETransforms
MLIRAMXDialect
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/ArmNeon/ArmNeonDialect.h"
#include "mlir/Dialect/ArmSME/IR/ArmSME.h"
+#include "mlir/Dialect/ArmSME/Transforms/Passes.h"
#include "mlir/Dialect/ArmSME/Transforms/Transforms.h"
#include "mlir/Dialect/ArmSVE/ArmSVEDialect.h"
#include "mlir/Dialect/ArmSVE/Transforms.h"
target.addLegalDialect<arith::ArithDialect>();
target.addLegalDialect<memref::MemRefDialect>();
target.addLegalOp<UnrealizedConversionCastOp>();
+ arm_sme::ArmSMETypeConverter armSMEConverter(&getContext(), options);
+
if (armNeon) {
// TODO: we may or may not want to include in-dialect lowering to
// LLVM-compatible operations here. So far, all operations in the dialect
}
if (armSME) {
configureArmSMELegalizeForExportTarget(target);
- populateArmSMELegalizeForLLVMExportPatterns(converter, patterns);
+ populateArmSMELegalizeForLLVMExportPatterns(armSMEConverter, patterns);
}
if (amx) {
configureAMXLegalizeForExportTarget(target);
--- /dev/null
+//===- ArmSMETypeConverter.cpp - Convert builtin to LLVM dialect types ----===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/ArmSME/Transforms/Passes.h"
+
+using namespace mlir;
+arm_sme::ArmSMETypeConverter::ArmSMETypeConverter(
+ MLIRContext *ctx, const LowerToLLVMOptions &options)
+ : LLVMTypeConverter(ctx, options) {
+ // Disable LLVM type conversion for vectors. This is to prevent 2-d scalable
+ // vectors (common in the context of ArmSME), e.g.
+ // `vector<[16]x[16]xi8>`,
+ // entering the LLVM Type converter. LLVM does not support arrays of scalable
+ // vectors, but in the case of SME such types are effectively eliminated when
+ // emitting ArmSME LLVM IR intrinsics.
+ addConversion([&](VectorType type) { return type; });
+}
add_mlir_dialect_library(MLIRArmSMETransforms
+ ArmSMETypeConverter.cpp
EnableArmStreaming.cpp
LegalizeForLLVMExport.cpp
TileAllocation.cpp