MLIR  18.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  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  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...
 
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 single-operand single-result operations that use their operand without consuming and without modifying the Payload IR to produce a new handle. 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  PDLMatchHooks
 PDL constraint callbacks that can be used by the PDL extension of the Transform dialect. More...
 
class  TransformInterpreterPassBase
 Base class for transform dialect interpreter passes that can consume and dump transform dialect scripts in separate files. 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, linalg::ForallTilingResult &tilingResult)
 Implementation of tiling operations using scf.forall. More...
 
LogicalResult applyTransforms (Operation *payloadRoot, TransformOpInterface transform, const RaggedArray< MappedValue > &extraMapping={}, const TransformOptions &options=TransformOptions(), bool enforceToplevelTransformOp=true)
 Entry point to the Transform dialect infrastructure. More...
 
void consumesHandle (ValueRange handles, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 Populates effects with the memory effects indicating the operation on the given handle value: More...
 
void producesHandle (ValueRange handles, SmallVectorImpl< MemoryEffects::EffectInstance > &effects)
 
void onlyReadsHandle (ValueRange 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 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...
 
void printPackedOrDynamicIndexList (OpAsmPrinter &printer, Operation *op, Value packed, Type packedType, OperandRange values, TypeRange valueTypes, DenseI64ArrayAttr integers)
 Printer hook for custom directive in assemblyFormat. More...
 
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...
 

Typedef Documentation

◆ ApplyToEachResult

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

Definition at line 1347 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()

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 185 of file TransformInterpreterUtils.cpp.

References applyTransforms(), DBGS, mlir::Operation::emitError(), mlir::failed(), mlir::SymbolTable::getNearestSymbolTable(), mlir::transform::detail::mergeSymbolsInto(), and options.

◆ applyTransforms()

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

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 1964 of file TransformInterfaces.cpp.

References mlir::failed(), mlir::failure(), and mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait().

Referenced by applyTransformNamedSequence(), and mlir::transform::detail::interpreterBaseRunOnOperationImpl().

◆ consumesHandle()

void mlir::transform::consumesHandle ( ValueRange  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 1774 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 1835 of file TransformInterfaces.cpp.

◆ doesReadPayload()

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

Checks whether the transform op reads the payload.

Definition at line 1842 of file TransformInterfaces.cpp.

◆ 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 1795 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 1824 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 ( ValueRange  handles,
SmallVectorImpl< MemoryEffects::EffectInstance > &  effects 
)

◆ onlyReadsPayload()

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

◆ parsePackedOrDynamicIndexList()

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 29 of file Utils.cpp.

References mlir::LogicalResult::failed(), mlir::failure(), mlir::AsmParser::getBuilder(), mlir::Builder::getDenseI64ArrayAttr(), mlir::AsmParser::parseColonType(), mlir::parseDynamicIndexList(), mlir::AsmParser::parseLParen(), mlir::OpAsmParser::parseOperand(), mlir::AsmParser::parseOptionalStar(), mlir::AsmParser::parseRParen(), mlir::LogicalResult::succeeded(), and mlir::success().

◆ printPackedOrDynamicIndexList()

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.

◆ producesHandle()

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

◆ registerLoopExtension()

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

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

Definition at line 32 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 67 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,
linalg::ForallTilingResult tilingResult 
)

Implementation of tiling operations using scf.forall.

Definition at line 2823 of file LinalgTransformOps.cpp.