MLIR  20.0.0git
Namespaces | Classes | Typedefs | Functions
mlir::transform Namespace Reference

Namespaces

 detail
 
 gpu
 

Classes

class  StructuredOpPredicateOpTrait
 
struct  TileSizesSpec
 
struct  NumThreadsSpec
 
class  AtMostOneOpMatcherOpTrait
 
class  SingleOpMatcherOpTrait
 
class  SingleValueMatcherOpTrait
 
class  TransformOptions
 Options controlling the application of transform operations by the TransformState. More...
 
class  TransformState
 The state maintained across applications of various ops implementing the TransformOpInterface. More...
 
class  TransformResults
 Local mapping between values defined by a specific op implementing the TransformOpInterface and the payload IR ops they correspond to. More...
 
struct  TrackingListenerConfig
 A configuration object for customizing a TrackingListener. More...
 
class  TrackingListener
 A listener that updates a TransformState based on IR modifications. More...
 
class  ErrorCheckingTrackingListener
 A specialized listener that keeps track of cases in which no replacement payload could be found. More...
 
class  TransformRewriter
 This is a special rewriter to be used in transform op implementations, providing additional helper functions to update the transform state, etc. More...
 
class  PossibleTopLevelTransformOpTrait
 This trait is supposed to be attached to Transform dialect operations that can be standalone top-level transforms. More...
 
class  TransformEachOpTrait
 Trait implementing the TransformOpInterface for operations applying a transformation to a single operation handle and producing an arbitrary number of handles and parameter values. More...
 
struct  TransformMappingResource
 Side effect resource corresponding to the mapping between Transform IR values and Payload IR operations. More...
 
struct  PayloadIRResource
 Side effect resource corresponding to the Payload IR itself. More...
 
class  FunctionalStyleTransformOpTrait
 Trait implementing the MemoryEffectOpInterface for operations that "consume" their operands and produce new results. More...
 
class  NavigationTransformOpTrait
 Trait implementing the MemoryEffectOpInterface for operations that use their operands without consuming and without modifying the Payload IR to potentially produce new handles. More...
 
class  ParamProducerTransformOpTrait
 Trait implementing the MemoryEffectsOpInterface for operations that produce transform dialect parameters. More...
 
class  ReportTrackingListenerFailuresOpTrait
 TrackingListener failures are reported only for ops that have this trait. More...
 
class  ApplyToEachResultList
 A list of results of applying a transform op with ApplyEachOpTrait to a single payload operation, co-indexed with the results of the transform op. More...
 
class  TransformDialectData
 Base class for additional data owned by the Transform dialect. More...
 
class  TransformDialectExtension
 Base class for extensions of the Transform dialect that supports injecting operations into the Transform dialect at load time. More...
 
class  BuildOnly
 A wrapper for transform dialect extensions that forces them to be constructed in the build-only mode. More...
 
class  PDLMatchHooks
 PDL constraint callbacks that can be used by the PDL extension of the Transform dialect. More...
 

Typedefs

using Param = Attribute
 
using MappedValue = llvm::PointerUnion< Operation *, Param, Value >
 
using ApplyToEachResult = MappedValue
 A single result of applying a transform op with ApplyEachOpTrait to a single payload operation. More...
 
using SequenceBodyBuilderFn = ::llvm::function_ref< void(::mlir::OpBuilder &, ::mlir::Location, ::mlir::BlockArgument)>
 A builder function that populates the body of a SequenceOp. More...
 
using SequenceBodyBuilderArgsFn = ::llvm::function_ref< void(::mlir::OpBuilder &, ::mlir::Location, ::mlir::BlockArgument, ::mlir::ValueRange)>
 

Functions

DiagnosedSilenceableFailure tileToForallOpImpl (RewriterBase &rewriter, transform::TransformState &state, TransformOpInterface transformOp, Operation *target, ArrayRef< OpFoldResult > mixedNumThreads, ArrayRef< OpFoldResult > mixedTileSizes, std::optional< ArrayAttr > mapping, scf::SCFTilingResult &tilingResult)
 Implementation of tiling operations using scf.forall. More...
 
void registerDebugExtension (DialectRegistry &dialectRegistry)
 Registers the debug extension of the Transform dialect in the given registry. More...
 
ParseResult parseTransformMatchDims (OpAsmParser &parser, DenseI64ArrayAttr &rawDimList, UnitAttr &isInverted, UnitAttr &isAll)
 Parses a positional index specification for transform match operations. More...
 
void printTransformMatchDims (OpAsmPrinter &printer, Operation *op, DenseI64ArrayAttr rawDimList, UnitAttr isInverted, UnitAttr isAll)
 Prints a positional index specification for transform match operations. More...
 
LogicalResult verifyTransformMatchDimsOp (Operation *op, ArrayRef< int64_t > raw, bool inverted, bool all)
 Checks if the positional specification defined is valid and reports errors otherwise. More...
 
DiagnosedSilenceableFailure expandTargetSpecification (Location loc, bool isAll, bool isInverted, ArrayRef< int64_t > rawList, int64_t maxNumber, SmallVectorImpl< int64_t > &result)
 Populates result with the positional identifiers relative to maxNumber. More...
 
LogicalResult applyTransforms (Operation *payloadRoot, TransformOpInterface transform, const RaggedArray< MappedValue > &extraMapping={}, const TransformOptions &options=TransformOptions(), bool enforceToplevelTransformOp=true, function_ref< void(TransformState &)> stateInitializer=nullptr, function_ref< LogicalResult(TransformState &)> stateExporter=nullptr)
 Entry point to the Transform dialect infrastructure. More...
 
void consumesHandle (MutableArrayRef< OpOperand > handles, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 Populates effects with the memory effects indicating the operation on the given handle value: More...
 
void producesHandle (ResultRange handles, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 
void producesHandle (MutableArrayRef< BlockArgument > handles, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 
void onlyReadsHandle (MutableArrayRef< OpOperand > handles, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 
bool isHandleConsumed (Value handle, transform::TransformOpInterface transform)
 Checks whether the transform op consumes the given handle. More...
 
void modifiesPayload (SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 Populates effects with the memory effects indicating the access to payload IR resource. More...
 
void onlyReadsPayload (SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 
bool doesModifyPayload (transform::TransformOpInterface transform)
 Checks whether the transform op modifies the payload. More...
 
bool doesReadPayload (transform::TransformOpInterface transform)
 Checks whether the transform op reads the payload. More...
 
void getConsumedBlockArguments (Block &block, llvm::SmallDenseSet< unsigned > &consumedArguments)
 Populates consumedArguments with positions of block arguments that are consumed by the operations in the block. More...
 
void registerIRDLExtension (DialectRegistry &dialectRegistry)
 Registers the IRDL extension of the Transform dialect in the given registry. More...
 
void registerLoopExtension (DialectRegistry &dialectRegistry)
 Registers the loop extension of the Transform dialect in the given registry. More...
 
void registerPDLExtension (DialectRegistry &dialectRegistry)
 Registers the PDL extension of the Transform dialect in the given registry. More...
 
LogicalResult applyTransformNamedSequence (Operation *payload, Operation *transformRoot, ModuleOp transformModule, const TransformOptions &options)
 Standalone util to apply the named sequence transformRoot to payload IR. More...
 
LogicalResult applyTransformNamedSequence (RaggedArray< MappedValue > bindings, TransformOpInterface transformRoot, ModuleOp transformModule, const TransformOptions &options)
 
void printPackedOrDynamicIndexList (OpAsmPrinter &printer, Operation *op, Value packed, Type packedType, OperandRange values, TypeRange valueTypes, DenseI64ArrayAttr integers)
 Printer hook for custom directive in assemblyFormat. More...
 
void printPackedOrDynamicIndexList (OpAsmPrinter &printer, Operation *op, Value packed, OperandRange values, DenseI64ArrayAttr integers)
 
ParseResult parsePackedOrDynamicIndexList (OpAsmParser &parser, std::optional< OpAsmParser::UnresolvedOperand > &packed, Type &packedType, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &values, SmallVectorImpl< Type > *valueTypes, DenseI64ArrayAttr &integers)
 Parser hook for custom directive in assemblyFormat. More...
 
ParseResult parsePackedOrDynamicIndexList (OpAsmParser &parser, std::optional< OpAsmParser::UnresolvedOperand > &packed, SmallVectorImpl< OpAsmParser::UnresolvedOperand > &values, DenseI64ArrayAttr &integers)
 

Typedef Documentation

◆ ApplyToEachResult

A single result of applying a transform op with ApplyEachOpTrait to a single payload operation.

Definition at line 1394 of file TransformInterfaces.h.

◆ MappedValue

Definition at line 30 of file TransformInterfaces.h.

◆ Param

Definition at line 29 of file TransformInterfaces.h.

◆ SequenceBodyBuilderArgsFn

Definition at line 37 of file TransformOps.h.

◆ SequenceBodyBuilderFn

A builder function that populates the body of a SequenceOp.

Definition at line 35 of file TransformOps.h.

Function Documentation

◆ applyTransformNamedSequence() [1/2]

LogicalResult mlir::transform::applyTransformNamedSequence ( Operation payload,
Operation transformRoot,
ModuleOp  transformModule,
const TransformOptions options 
)

Standalone util to apply the named sequence transformRoot to payload IR.

This is done in 2 steps:

  1. If transformModule is provided and is not nested under transformRoot, it will be "linked into" the IR containing transformRoot to resolve undefined named sequences.
  2. The transforms specified in transformRoot are applied to payload, assuming the named sequence has a single argument handle that will be associated with payload on run.

Definition at line 191 of file TransformInterpreterUtils.cpp.

References options, and mlir::RaggedArray< T >::push_back().

Referenced by mlirTransformApplyNamedSequence().

◆ applyTransformNamedSequence() [2/2]

LogicalResult mlir::transform::applyTransformNamedSequence ( RaggedArray< MappedValue bindings,
TransformOpInterface  transformRoot,
ModuleOp  transformModule,
const TransformOptions options 
)

◆ applyTransforms()

LogicalResult mlir::transform::applyTransforms ( Operation payloadRoot,
TransformOpInterface  transform,
const RaggedArray< MappedValue > &  extraMapping = {},
const TransformOptions options = TransformOptions(),
bool  enforceToplevelTransformOp = true,
function_ref< void(TransformState &)>  stateInitializer = nullptr,
function_ref< LogicalResult(TransformState &)>  stateExporter = nullptr 
)

Entry point to the Transform dialect infrastructure.

Applies the transformation specified by transform to payload IR contained in payloadRoot. The transform operation may contain other operations that will be executed following the internal logic of the operation. It must have the PossibleTopLevelTransformOp trait and not have any operands. This function internally keeps track of the transformation state.

Definition at line 1997 of file TransformInterfaces.cpp.

References mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait().

Referenced by applyTransformNamedSequence().

◆ consumesHandle()

void mlir::transform::consumesHandle ( MutableArrayRef< OpOperand handles,
SmallVectorImpl< MemoryEffects::EffectInstance > &  effects 
)

Populates effects with the memory effects indicating the operation on the given handle value:

  • consumes = Read + Free,
  • produces = Allocate + Write,
  • onlyReads = Read.

Definition at line 1796 of file TransformInterfaces.cpp.

References mlir::SideEffects::Effect::Base< DerivedEffect, BaseEffect >::get(), and mlir::SideEffects::Resource::Base< TransformMappingResource >::get().

Referenced by mlir::transform::FunctionalStyleTransformOpTrait< OpTy >::getEffects().

◆ doesModifyPayload()

bool mlir::transform::doesModifyPayload ( transform::TransformOpInterface  transform)

Checks whether the transform op modifies the payload.

Definition at line 1868 of file TransformInterfaces.cpp.

◆ doesReadPayload()

bool mlir::transform::doesReadPayload ( transform::TransformOpInterface  transform)

Checks whether the transform op reads the payload.

Definition at line 1875 of file TransformInterfaces.cpp.

◆ expandTargetSpecification()

DiagnosedSilenceableFailure mlir::transform::expandTargetSpecification ( Location  loc,
bool  isAll,
bool  isInverted,
ArrayRef< int64_t >  rawList,
int64_t  maxNumber,
SmallVectorImpl< int64_t > &  result 
)

Populates result with the positional identifiers relative to maxNumber.

If isAll is set, the result will contain all numbers from 0 to maxNumber - 1 inclusive regardless of rawList. Otherwise, negative values from rawList are are interpreted as counting backwards from maxNumber, i.e., -1 is interpreted a maxNumber - 1, while positive numbers remain as is. If isInverted is set, populates result with those values from the 0 to maxNumber - 1 inclusive range that don't appear in rawList. If rawList contains values that are greater than or equal to maxNumber or less than -maxNumber, produces a silenceable error at the given location. maxNumber must be positive. If rawList contains duplicate numbers or numbers that become duplicate after negative value remapping, emits a silenceable error.

Definition at line 103 of file MatchInterfaces.cpp.

References mlir::emitSilenceableFailure(), and mlir::DiagnosedSilenceableFailure::success().

◆ getConsumedBlockArguments()

void mlir::transform::getConsumedBlockArguments ( Block block,
llvm::SmallDenseSet< unsigned > &  consumedArguments 
)

Populates consumedArguments with positions of block arguments that are consumed by the operations in the block.

◆ isHandleConsumed()

bool mlir::transform::isHandleConsumed ( Value  handle,
transform::TransformOpInterface  transform 
)

Checks whether the transform op consumes the given handle.

Definition at line 1817 of file TransformInterfaces.cpp.

Referenced by mlir::transform::TransformState::applyTransform(), and isValueUsePotentialConsumer().

◆ modifiesPayload()

void mlir::transform::modifiesPayload ( SmallVectorImpl< MemoryEffects::EffectInstance > &  effects)

Populates effects with the memory effects indicating the access to payload IR resource.

Definition at line 1857 of file TransformInterfaces.cpp.

References mlir::SideEffects::Effect::Base< DerivedEffect, BaseEffect >::get(), and mlir::SideEffects::Resource::Base< PayloadIRResource >::get().

Referenced by mlir::transform::FunctionalStyleTransformOpTrait< OpTy >::getEffects().

◆ onlyReadsHandle()

void mlir::transform::onlyReadsHandle ( MutableArrayRef< OpOperand handles,
SmallVectorImpl< MemoryEffects::EffectInstance > &  effects 
)

◆ onlyReadsPayload()

void mlir::transform::onlyReadsPayload ( SmallVectorImpl< MemoryEffects::EffectInstance > &  effects)

◆ parsePackedOrDynamicIndexList() [1/2]

ParseResult mlir::transform::parsePackedOrDynamicIndexList ( OpAsmParser parser,
std::optional< OpAsmParser::UnresolvedOperand > &  packed,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  values,
DenseI64ArrayAttr integers 
)
inline

Definition at line 57 of file Utils.h.

References parsePackedOrDynamicIndexList().

◆ parsePackedOrDynamicIndexList() [2/2]

ParseResult mlir::transform::parsePackedOrDynamicIndexList ( OpAsmParser parser,
std::optional< OpAsmParser::UnresolvedOperand > &  packed,
Type packedType,
SmallVectorImpl< OpAsmParser::UnresolvedOperand > &  values,
SmallVectorImpl< Type > *  valueTypes,
DenseI64ArrayAttr integers 
)

Parser hook for custom directive in assemblyFormat.

custom<PackedOrDynamicIndexList>($packed, type($packed), $values, type($values), $integers)

See printPackedOrDynamicIndexList for details.

Definition at line 33 of file Utils.cpp.

References mlir::AsmParser::getBuilder(), mlir::Builder::getDenseI64ArrayAttr(), mlir::AsmParser::parseColonType(), mlir::parseDynamicIndexList(), mlir::AsmParser::parseLParen(), mlir::OpAsmParser::parseOperand(), mlir::AsmParser::parseOptionalStar(), and mlir::AsmParser::parseRParen().

Referenced by parsePackedOrDynamicIndexList().

◆ parseTransformMatchDims()

ParseResult mlir::transform::parseTransformMatchDims ( OpAsmParser parser,
DenseI64ArrayAttr rawDimList,
UnitAttr &  isInverted,
UnitAttr &  isAll 
)

Parses a positional index specification for transform match operations.

The following forms are accepted:

  • all: sets isAll and returns;
  • comma-separated-integer-list: populates rawDimList with the values;
  • except ( comma-separated-integer-list ): populates rawDimList with the values and sets isInverted.

Definition at line 23 of file MatchInterfaces.cpp.

References mlir::AsmParser::getBuilder(), mlir::Builder::getDenseI64ArrayAttr(), mlir::Builder::getUnitAttr(), kDimAllKeyword, kDimExceptKeyword, mlir::AsmParser::parseCommaSeparatedList(), mlir::AsmParser::parseInteger(), mlir::AsmParser::parseLParen(), mlir::AsmParser::parseOptionalKeyword(), and mlir::AsmParser::parseRParen().

◆ printPackedOrDynamicIndexList() [1/2]

void mlir::transform::printPackedOrDynamicIndexList ( OpAsmPrinter printer,
Operation op,
Value  packed,
OperandRange  values,
DenseI64ArrayAttr  integers 
)
inline

Definition at line 40 of file Utils.h.

◆ printPackedOrDynamicIndexList() [2/2]

void mlir::transform::printPackedOrDynamicIndexList ( OpAsmPrinter printer,
Operation op,
Value  packed,
Type  packedType,
OperandRange  values,
TypeRange  valueTypes,
DenseI64ArrayAttr  integers 
)

Printer hook for custom directive in assemblyFormat.

custom<PackedOrDynamicIndexList>($packed, type($packed), $values, type($values), $integers)

where values are variadic Index values, integers is an I64ArrayAttr and packed is a single transform dialect handle who's mapped payload ops have a single Index result and represent the index list. Either packed or the other two parameters may be specified.

This allows idiomatic printing of mixed value and integer attributes in a list or with a single handle. E.g., [arg0 : !transform.any_op, 7, 42, arg42 : !transform.param<i64>] or just h : !transform.any_op.

Definition at line 17 of file Utils.cpp.

◆ printTransformMatchDims()

void mlir::transform::printTransformMatchDims ( OpAsmPrinter printer,
Operation op,
DenseI64ArrayAttr  rawDimList,
UnitAttr  isInverted,
UnitAttr  isAll 
)

Prints a positional index specification for transform match operations.

Definition at line 61 of file MatchInterfaces.cpp.

◆ producesHandle() [1/2]

void mlir::transform::producesHandle ( MutableArrayRef< BlockArgument handles,
SmallVectorImpl< MemoryEffects::EffectInstance > &  effects 
)

◆ producesHandle() [2/2]

void mlir::transform::producesHandle ( ResultRange  handles,
SmallVectorImpl< MemoryEffects::EffectInstance > &  effects 
)

◆ registerDebugExtension()

void mlir::transform::registerDebugExtension ( DialectRegistry dialectRegistry)

Registers the debug extension of the Transform dialect in the given registry.

Definition at line 34 of file DebugExtension.cpp.

References mlir::DialectRegistry::addExtensions().

Referenced by mlir::registerAllExtensions().

◆ registerIRDLExtension()

void mlir::transform::registerIRDLExtension ( DialectRegistry dialectRegistry)

Registers the IRDL extension of the Transform dialect in the given registry.

Definition at line 34 of file IRDLExtension.cpp.

References mlir::DialectRegistry::addExtensions().

Referenced by mlir::registerAllExtensions().

◆ registerLoopExtension()

void mlir::transform::registerLoopExtension ( DialectRegistry dialectRegistry)

Registers the loop extension of the Transform dialect in the given registry.

Definition at line 34 of file LoopExtension.cpp.

References mlir::DialectRegistry::addExtensions().

Referenced by mlir::registerAllExtensions().

◆ registerPDLExtension()

void mlir::transform::registerPDLExtension ( DialectRegistry dialectRegistry)

Registers the PDL extension of the Transform dialect in the given registry.

Definition at line 69 of file PDLExtension.cpp.

References mlir::DialectRegistry::addExtensions().

Referenced by mlir::registerAllExtensions().

◆ tileToForallOpImpl()

DiagnosedSilenceableFailure mlir::transform::tileToForallOpImpl ( RewriterBase rewriter,
transform::TransformState state,
TransformOpInterface  transformOp,
Operation target,
ArrayRef< OpFoldResult mixedNumThreads,
ArrayRef< OpFoldResult mixedTileSizes,
std::optional< ArrayAttr >  mapping,
scf::SCFTilingResult tilingResult 
)

Implementation of tiling operations using scf.forall.

Definition at line 3255 of file LinalgTransformOps.cpp.

◆ verifyTransformMatchDimsOp()

LogicalResult mlir::transform::verifyTransformMatchDimsOp ( Operation op,
ArrayRef< int64_t >  raw,
bool  inverted,
bool  all 
)

Checks if the positional specification defined is valid and reports errors otherwise.

Definition at line 78 of file MatchInterfaces.cpp.