MLIR 22.0.0git
mlir::arm_sme Namespace Reference

Namespaces

namespace  detail
 An interface for operations that use Arm SME tiles.
namespace  impl

Classes

class  ArmSMETileOpInterface
struct  EnableArmStreamingOptions
struct  TestTileAllocationOptions

Functions

std::unique_ptr<::mlir::PasscreateTestTileAllocation ()
std::unique_ptr<::mlir::PasscreateTestTileAllocation (TestTileAllocationOptions options)
std::unique_ptr< PasscreateEnableArmStreamingPass (const ArmStreamingMode=ArmStreamingMode::Streaming, const ArmZaMode=ArmZaMode::Disabled, bool ifRequiredByOps=false, bool ifContainsScalableVectors=false)
 Pass to enable Armv9 Streaming SVE mode.
std::unique_ptr< PasscreateOuterProductFusionPass ()
 Pass that fuses 'arm_sme.outerproduct' ops into 2-way or 4-way widening variants.
std::unique_ptr< PasscreateVectorLegalizationPass ()
 Pass that legalizes vectors so they can be lowered to ArmSME.
void registerEnableArmStreaming ()
void registerEnableArmStreamingPass ()
void registerOuterProductFusion ()
void registerOuterProductFusionPass ()
void registerTestTileAllocation ()
void registerTestTileAllocationPass ()
void registerVectorLegalization ()
void registerVectorLegalizationPass ()
void registerArmSMEPasses ()
void populateOuterProductFusionPatterns (RewritePatternSet &patterns)
LogicalResult allocateSMETiles (FunctionOpInterface function, bool dumpRanges=false)
 Allocate tile IDs to all ArmSME operations in a function.
unsigned getSizeInBytes (TypeSize type)
 Return the size represented by arm_sme::TypeSize in bytes.
unsigned getSMETileSliceMinNumElts (Type type)
 Return minimum number of elements for the given element type in a vector of SVL bits.
bool isValidSMETileElementType (Type type)
 Returns true if type is a valid element type for an SME tile or false otherwise.
bool isValidSMETileVectorType (VectorType vType)
 Returns true if vType is a valid vector type for an SME tile or false otherwise.
bool isValidSMETileVectorType (Type type)
std::optional< ArmSMETileType > getSMETileType (VectorType)
 Returns the type of SME tile this vector type corresponds to, or none if the vector type does not fit within an SME tile.
LogicalResult verifyOperationHasValidTileId (Operation *)
 Verifies the tile ID (if set) on this tile operation is valid.
scf::ForOp createLoopOverTileSlices (PatternRewriter &rewriter, Location loc, Value initTile, std::function< Value(OpBuilder &, Location, Value, Value)> makeLoopBody)
 Generates a for loop over ZA tile slices where the induction variable is the tile slice index and each iteration yields a new tile.
bool isMultipleOfSMETileVectorType (VectorType vType)
 Returns true if vType is a multiple of an SME tile size.
VectorType getSMETileTypeForElement (Type elementType)
 Creates a vector type for the SME tile of elementType.
void eraseTriviallyDeadTileOps (IRRewriter &rewriter, FunctionOpInterface function)
 Erase trivially dead tile ops from a function.
bool isTriviallyCloneableTileOp (arm_sme::ArmSMETileOpInterface tileOp)
 Returns true if tileOp is trivially cloneable.
bool hasTileResult (arm_sme::ArmSMETileOpInterface tileOp)
 Returns true if tileOp produces a tile result.
OpOperandgetTileOpOperand (arm_sme::ArmSMETileOpInterface tileOp)
 Returns the tile OpOperand for this tileOp (or null).
bool isTileTypeGreaterOrEqual (ArmSMETileType typeA, ArmSMETileType typeB)
 Returns true typeA is >= (in terms of bytes) than typeB.

Variables

static constexpr unsigned kInMemoryTileIdBase = 16
constexpr unsigned MinStreamingVectorLengthInBits = 128

Function Documentation

◆ allocateSMETiles()

LogicalResult mlir::arm_sme::allocateSMETiles ( FunctionOpInterface function,
bool dumpRanges = false )

Allocate tile IDs to all ArmSME operations in a function.

Requires the function to be lowered to control flow (cf dialect).

Definition at line 796 of file TileAllocation.cpp.

References b, eraseTriviallyDeadTileOps(), and success().

Referenced by mlir::impl::ConvertArmSMEToLLVMBase< DerivedT >::operator=().

◆ createEnableArmStreamingPass()

std::unique_ptr< Pass > mlir::arm_sme::createEnableArmStreamingPass ( const ArmStreamingMode streamingMode = ArmStreamingMode::Streaming,
const ArmZaMode zaMode = ArmZaMode::Disabled,
bool ifRequiredByOps = false,
bool ifContainsScalableVectors = false )

Pass to enable Armv9 Streaming SVE mode.

Definition at line 143 of file EnableArmStreaming.cpp.

◆ createLoopOverTileSlices()

scf::ForOp mlir::arm_sme::createLoopOverTileSlices ( PatternRewriter & rewriter,
Location loc,
Value initTile,
std::function< Value(OpBuilder &, Location, Value, Value)> makeLoopBody )

Generates a for loop over ZA tile slices where the induction variable is the tile slice index and each iteration yields a new tile.

Loop body is built via makeLoopBody, which returns the next tile value.

Definition at line 89 of file Utils.cpp.

References mlir::arith::ConstantIndexOp::create(), mlir::Builder::getIndexType(), mlir::Value::getType(), and mlir::OpBuilder::setInsertionPointToStart().

◆ createOuterProductFusionPass()

std::unique_ptr< Pass > mlir::arm_sme::createOuterProductFusionPass ( )

Pass that fuses 'arm_sme.outerproduct' ops into 2-way or 4-way widening variants.

Definition at line 543 of file OuterProductFusion.cpp.

◆ createTestTileAllocation() [1/2]

std::unique_ptr<::mlir::Pass > mlir::arm_sme::createTestTileAllocation ( )

Definition at line 282 of file TileAllocation.cpp.

◆ createTestTileAllocation() [2/2]

std::unique_ptr<::mlir::Pass > mlir::arm_sme::createTestTileAllocation ( TestTileAllocationOptions options)

Definition at line 286 of file TileAllocation.cpp.

◆ createVectorLegalizationPass()

std::unique_ptr< Pass > mlir::arm_sme::createVectorLegalizationPass ( )

Pass that legalizes vectors so they can be lowered to ArmSME.

Definition at line 1042 of file VectorLegalization.cpp.

◆ eraseTriviallyDeadTileOps()

void mlir::arm_sme::eraseTriviallyDeadTileOps ( IRRewriter & rewriter,
FunctionOpInterface function )

Erase trivially dead tile ops from a function.

Definition at line 133 of file Utils.cpp.

References mlir::RewriterBase::eraseOp(), mlir::Operation::getOperands(), and mlir::isOpTriviallyDead().

Referenced by allocateSMETiles().

◆ getSizeInBytes()

unsigned mlir::arm_sme::getSizeInBytes ( TypeSize type)

Return the size represented by arm_sme::TypeSize in bytes.

Definition at line 17 of file Utils.cpp.

◆ getSMETileSliceMinNumElts()

unsigned mlir::arm_sme::getSMETileSliceMinNumElts ( Type type)

Return minimum number of elements for the given element type in a vector of SVL bits.

Definition at line 32 of file Utils.cpp.

References mlir::Type::getIntOrFloatBitWidth(), isValidSMETileElementType(), and MinStreamingVectorLengthInBits.

Referenced by getSMETileTypeForElement(), isMultipleOfSMETileVectorType(), and isValidSMETileVectorType().

◆ getSMETileType()

std::optional< ArmSMETileType > mlir::arm_sme::getSMETileType ( VectorType type)

Returns the type of SME tile this vector type corresponds to, or none if the vector type does not fit within an SME tile.

Definition at line 58 of file Utils.cpp.

References isValidSMETileVectorType().

◆ getSMETileTypeForElement()

VectorType mlir::arm_sme::getSMETileTypeForElement ( Type elementType)

Creates a vector type for the SME tile of elementType.

Definition at line 128 of file Utils.cpp.

References getSMETileSliceMinNumElts().

Referenced by mlir::arm_sme::impl::VectorLegalizationBase< DerivedT >::getDependentDialects().

◆ getTileOpOperand()

OpOperand * mlir::arm_sme::getTileOpOperand ( arm_sme::ArmSMETileOpInterface tileOp)

Returns the tile OpOperand for this tileOp (or null).

Definition at line 166 of file Utils.cpp.

References isValidSMETileVectorType().

◆ hasTileResult()

bool mlir::arm_sme::hasTileResult ( arm_sme::ArmSMETileOpInterface tileOp)

Returns true if tileOp produces a tile result.

Definition at line 158 of file Utils.cpp.

References isValidSMETileVectorType(), and result.

◆ isMultipleOfSMETileVectorType()

bool mlir::arm_sme::isMultipleOfSMETileVectorType ( VectorType vType)

Returns true if vType is a multiple of an SME tile size.

Returns false if the vType exactly matches the size of an SME tile.

Definition at line 111 of file Utils.cpp.

References getSMETileSliceMinNumElts(), and isValidSMETileElementType().

Referenced by mlir::arm_sme::impl::VectorLegalizationBase< DerivedT >::getDependentDialects().

◆ isTileTypeGreaterOrEqual()

bool mlir::arm_sme::isTileTypeGreaterOrEqual ( ArmSMETileType typeA,
ArmSMETileType typeB )

Returns true typeA is >= (in terms of bytes) than typeB.

Definition at line 181 of file Utils.cpp.

◆ isTriviallyCloneableTileOp()

bool mlir::arm_sme::isTriviallyCloneableTileOp ( arm_sme::ArmSMETileOpInterface tileOp)

Returns true if tileOp is trivially cloneable.

A tile operation is trivially cloneable if:

  1. It has no operands (and only a single tile result)
  2. It is 'Pure'

This ensures that the cloned operation will not share any dependencies with the original operation (which could also need to be considered), and that inserting the cloned operation at a different point in the program won't change the semantics of the program (as it has no side effects).

Definition at line 153 of file Utils.cpp.

References mlir::isPure().

◆ isValidSMETileElementType()

bool mlir::arm_sme::isValidSMETileElementType ( Type type)

Returns true if type is a valid element type for an SME tile or false otherwise.

Definition at line 37 of file Utils.cpp.

References mlir::Type::isBF16(), mlir::Type::isF128(), mlir::Type::isF16(), mlir::Type::isF32(), mlir::Type::isF64(), and mlir::Type::isInteger().

Referenced by getSMETileSliceMinNumElts(), isMultipleOfSMETileVectorType(), and isValidSMETileVectorType().

◆ isValidSMETileVectorType() [1/2]

bool mlir::arm_sme::isValidSMETileVectorType ( Type type)
inline

Definition at line 50 of file Utils.h.

References isValidSMETileVectorType().

◆ isValidSMETileVectorType() [2/2]

bool mlir::arm_sme::isValidSMETileVectorType ( VectorType vType)

◆ populateOuterProductFusionPatterns()

void mlir::arm_sme::populateOuterProductFusionPatterns ( RewritePatternSet & patterns)

Definition at line 534 of file OuterProductFusion.cpp.

References mlir::patterns.

◆ registerArmSMEPasses()

void mlir::arm_sme::registerArmSMEPasses ( )
inline

Definition at line 454 of file Passes.h.

Referenced by mlir::registerAllPasses().

◆ registerEnableArmStreaming()

void mlir::arm_sme::registerEnableArmStreaming ( )
inline

Definition at line 370 of file Passes.h.

◆ registerEnableArmStreamingPass()

void mlir::arm_sme::registerEnableArmStreamingPass ( )
inline

Definition at line 377 of file Passes.h.

◆ registerOuterProductFusion()

void mlir::arm_sme::registerOuterProductFusion ( )
inline

Definition at line 391 of file Passes.h.

◆ registerOuterProductFusionPass()

void mlir::arm_sme::registerOuterProductFusionPass ( )
inline

Definition at line 398 of file Passes.h.

◆ registerTestTileAllocation()

void mlir::arm_sme::registerTestTileAllocation ( )
inline

Definition at line 412 of file Passes.h.

◆ registerTestTileAllocationPass()

void mlir::arm_sme::registerTestTileAllocationPass ( )
inline

Definition at line 419 of file Passes.h.

◆ registerVectorLegalization()

void mlir::arm_sme::registerVectorLegalization ( )
inline

Definition at line 433 of file Passes.h.

◆ registerVectorLegalizationPass()

void mlir::arm_sme::registerVectorLegalizationPass ( )
inline

Definition at line 440 of file Passes.h.

◆ verifyOperationHasValidTileId()

LogicalResult mlir::arm_sme::verifyOperationHasValidTileId ( Operation * op)

Verifies the tile ID (if set) on this tile operation is valid.

Definition at line 77 of file Utils.cpp.

References success().

Referenced by mlir::arm_sme::detail::verifyArmSMETileOpInterface().

Variable Documentation

◆ kInMemoryTileIdBase

unsigned mlir::arm_sme::kInMemoryTileIdBase = 16
staticconstexpr

Definition at line 22 of file ArmSMEOpInterfaces.h.

◆ MinStreamingVectorLengthInBits

unsigned mlir::arm_sme::MinStreamingVectorLengthInBits = 128
constexpr

Definition at line 33 of file Utils.h.

Referenced by getSMETileSliceMinNumElts().