MLIR  22.0.0git
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
mlir::scf::SCFTilingOptions Struct Reference

Options to use to control tiling. More...

#include "mlir/Dialect/SCF/Transforms/TileUsingInterface.h"

Classes

struct  CustomLoopHeaderInfo
 

Public Types

enum class  LoopType { ForOp , ForallOp , CustomOp }
 Specify which loop construct to use for tile and fuse. More...
 
using GenerateLoopHeaderFn = std::function< FailureOr< CustomLoopHeaderInfo >(RewriterBase &rewriter, Location loc, ArrayRef< Range > loopRanges, ArrayRef< OpFoldResult > givenTileSizes, ValueRange destinationTensors)>
 
using GenerateLoopTerminatorFn = std::function< LogicalResult(RewriterBase &rewriter, Location loc, ValueRange tiledResults, ArrayRef< SmallVector< OpFoldResult > > resultOffsets, ArrayRef< SmallVector< OpFoldResult > > resultSizes, ValueRange destinationTensors)>
 

Public Member Functions

SCFTilingOptionssetLoopType (LoopType type)
 
SCFTilingOptionssetTileSizeComputationFunction (SCFTileSizeComputationFunction fun)
 
SCFTilingOptionssetTileSizes (ArrayRef< OpFoldResult > tileSizes)
 Convenience function to set the tileSizeComputationFunction to a function that computes tile sizes at the point they are needed. More...
 
SCFTilingOptionssetInterchange (ArrayRef< int64_t > interchange)
 
SCFTilingOptionssetNumThreadsComputationFunction (SCFTileSizeComputationFunction fun)
 
SCFTilingOptionssetNumThreads (ArrayRef< OpFoldResult > numThreads)
 Convenience function to set the numThreadsComputationFunction to a function that computes num threads at the point they are needed. More...
 
SCFTilingOptionssetMapping (ArrayRef< Attribute > mapping)
 
SCFTilingOptionssetReductionTilingStrategy (ReductionTilingStrategy strategy)
 
SCFTilingOptionssetReductionDims (ArrayRef< unsigned > dims)
 
SCFTilingOptionssetCustomLoopGenerationFns (GenerateLoopHeaderFn headerFn, GenerateLoopTerminatorFn terminatorFn)
 

Public Attributes

LoopType loopType = LoopType::ForOp
 
SCFTileSizeComputationFunction tileSizeComputationFunction = nullptr
 Computation function that returns the tile sizes to use for each loop. More...
 
SmallVector< int64_t > interchangeVector = {}
 The interchange vector to reorder the tiled loops. More...
 
SCFTileSizeComputationFunction numThreadsComputationFunction = nullptr
 Computation function that returns the number of threads to use for each loop. More...
 
SmallVector< AttributemappingVector = {}
 Specify mapping of loops to devices. More...
 
ReductionTilingStrategy reductionStrategy
 Specify how reduction dimensions should be tiled. More...
 
SetVector< unsigned > reductionDims
 Specify the reduction dimensions to be tiled. More...
 
GenerateLoopHeaderFn generateLoopHeaderFn = nullptr
 
GenerateLoopTerminatorFn generateLoopTerminatorFn = nullptr
 

Detailed Description

Options to use to control tiling.

Definition at line 35 of file TileUsingInterface.h.

Member Typedef Documentation

◆ GenerateLoopHeaderFn

using mlir::scf::SCFTilingOptions::GenerateLoopHeaderFn = std::function<FailureOr<CustomLoopHeaderInfo>( RewriterBase &rewriter, Location loc, ArrayRef<Range> loopRanges, ArrayRef<OpFoldResult> givenTileSizes, ValueRange destinationTensors)>

Definition at line 181 of file TileUsingInterface.h.

◆ GenerateLoopTerminatorFn

using mlir::scf::SCFTilingOptions::GenerateLoopTerminatorFn = std::function<LogicalResult( RewriterBase &rewriter, Location loc, ValueRange tiledResults, ArrayRef<SmallVector<OpFoldResult> > resultOffsets, ArrayRef<SmallVector<OpFoldResult> > resultSizes, ValueRange destinationTensors)>

Definition at line 195 of file TileUsingInterface.h.

Member Enumeration Documentation

◆ LoopType

Specify which loop construct to use for tile and fuse.

Enumerator
ForOp 
ForallOp 
CustomOp 

Definition at line 37 of file TileUsingInterface.h.

Member Function Documentation

◆ setCustomLoopGenerationFns()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setCustomLoopGenerationFns ( GenerateLoopHeaderFn  headerFn,
GenerateLoopTerminatorFn  terminatorFn 
)
inline

Definition at line 208 of file TileUsingInterface.h.

References generateLoopHeaderFn, and generateLoopTerminatorFn.

◆ setInterchange()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setInterchange ( ArrayRef< int64_t >  interchange)
inline

Definition at line 63 of file TileUsingInterface.h.

References interchangeVector.

◆ setLoopType()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setLoopType ( LoopType  type)
inline

Definition at line 39 of file TileUsingInterface.h.

References loopType.

◆ setMapping()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setMapping ( ArrayRef< Attribute mapping)
inline

Definition at line 97 of file TileUsingInterface.h.

References mappingVector.

◆ setNumThreads()

scf::SCFTilingOptions & scf::SCFTilingOptions::setNumThreads ( ArrayRef< OpFoldResult numThreads)

Convenience function to set the numThreadsComputationFunction to a function that computes num threads at the point they are needed.

Definition at line 48 of file TileUsingInterface.cpp.

◆ setNumThreadsComputationFunction()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setNumThreadsComputationFunction ( SCFTileSizeComputationFunction  fun)
inline

Definition at line 84 of file TileUsingInterface.h.

References numThreadsComputationFunction.

◆ setReductionDims()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setReductionDims ( ArrayRef< unsigned >  dims)
inline

Definition at line 119 of file TileUsingInterface.h.

References reductionDims.

◆ setReductionTilingStrategy()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setReductionTilingStrategy ( ReductionTilingStrategy  strategy)
inline

Definition at line 110 of file TileUsingInterface.h.

References reductionStrategy.

◆ setTileSizeComputationFunction()

SCFTilingOptions& mlir::scf::SCFTilingOptions::setTileSizeComputationFunction ( SCFTileSizeComputationFunction  fun)
inline

Definition at line 52 of file TileUsingInterface.h.

References tileSizeComputationFunction.

◆ setTileSizes()

scf::SCFTilingOptions & scf::SCFTilingOptions::setTileSizes ( ArrayRef< OpFoldResult tileSizes)

Convenience function to set the tileSizeComputationFunction to a function that computes tile sizes at the point they are needed.

Allows proper interaction with folding.

Definition at line 38 of file TileUsingInterface.cpp.

References tileSizeComputationFunction.

Member Data Documentation

◆ generateLoopHeaderFn

GenerateLoopHeaderFn mlir::scf::SCFTilingOptions::generateLoopHeaderFn = nullptr

Definition at line 202 of file TileUsingInterface.h.

Referenced by setCustomLoopGenerationFns().

◆ generateLoopTerminatorFn

GenerateLoopTerminatorFn mlir::scf::SCFTilingOptions::generateLoopTerminatorFn = nullptr

Definition at line 204 of file TileUsingInterface.h.

Referenced by setCustomLoopGenerationFns().

◆ interchangeVector

SmallVector<int64_t> mlir::scf::SCFTilingOptions::interchangeVector = {}

The interchange vector to reorder the tiled loops.

Definition at line 62 of file TileUsingInterface.h.

Referenced by setInterchange().

◆ loopType

LoopType mlir::scf::SCFTilingOptions::loopType = LoopType::ForOp

Definition at line 38 of file TileUsingInterface.h.

Referenced by setLoopType().

◆ mappingVector

SmallVector<Attribute> mlir::scf::SCFTilingOptions::mappingVector = {}

Specify mapping of loops to devices.

This is only respected when the loop constructs support such a mapping (like scf.forall). Will be ignored when using loop constructs that dont support such a mapping (like scf.for)

Definition at line 96 of file TileUsingInterface.h.

Referenced by setMapping().

◆ numThreadsComputationFunction

SCFTileSizeComputationFunction mlir::scf::SCFTilingOptions::numThreadsComputationFunction = nullptr

Computation function that returns the number of threads to use for each loop.

Returning a num threads of zero implies no tiling for that loop. If the size of the returned vector is smaller than the number of loops, the inner loops are not tiled. If the size of the returned vector is larger, then the vector is truncated to number of loops. Note: This option is only supported with loopType set to LoopType::ForallOp. If the tile size function is not specified while the num threads computation is, then the tile size is determined automatically to map at most one tile per thread.

Definition at line 81 of file TileUsingInterface.h.

Referenced by setNumThreadsComputationFunction().

◆ reductionDims

SetVector<unsigned> mlir::scf::SCFTilingOptions::reductionDims

Specify the reduction dimensions to be tiled.

Note that this needs to be specified. If left unspecified, then none of the reduction dimensions are tiled.

Definition at line 118 of file TileUsingInterface.h.

Referenced by setReductionDims().

◆ reductionStrategy

ReductionTilingStrategy mlir::scf::SCFTilingOptions::reductionStrategy
Initial value:

Specify how reduction dimensions should be tiled.

Definition at line 107 of file TileUsingInterface.h.

Referenced by setReductionTilingStrategy().

◆ tileSizeComputationFunction

SCFTileSizeComputationFunction mlir::scf::SCFTilingOptions::tileSizeComputationFunction = nullptr

Computation function that returns the tile sizes to use for each loop.

Returning a tile size of zero implies no tiling for that loop. If the size of the returned vector is smaller than the number of loops, the inner loops are not tiled. If the size of the returned vector is larger, then the vector is truncated to number of loops.

Definition at line 49 of file TileUsingInterface.h.

Referenced by setTileSizeComputationFunction(), and setTileSizes().


The documentation for this struct was generated from the following files: