forked from OSchip/llvm-project
[mlir] NFC: small fixes to LinalgTilingOptions API
This commit changes to use plain values instead of references. We need to copy it anyway. References forbid using temporary values generated from expressions. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D90277
This commit is contained in:
parent
47369e194a
commit
b1b0ddbb67
|
@ -331,16 +331,19 @@ enum class LinalgTilingLoopType {
|
|||
AffineLoops = 1,
|
||||
ParallelLoops = 2,
|
||||
};
|
||||
|
||||
using TileSizeComputationFunction =
|
||||
std::function<SmallVector<Value, 4>(OpBuilder &, Operation *)>;
|
||||
|
||||
struct LinalgTilingOptions {
|
||||
/// Computation function that returns the tile sizes for each operation.
|
||||
/// Delayed construction of constant tile sizes should occur to interoperate
|
||||
/// with folding.
|
||||
TileSizeComputationFunction tileSizeComputationFunction = nullptr;
|
||||
|
||||
LinalgTilingOptions &
|
||||
setTileSizeComputationFunction(TileSizeComputationFunction &fun) {
|
||||
tileSizeComputationFunction = fun;
|
||||
setTileSizeComputationFunction(TileSizeComputationFunction fun) {
|
||||
tileSizeComputationFunction = std::move(fun);
|
||||
return *this;
|
||||
}
|
||||
/// Set the `tileSizeComputationFunction` to return the values `ts`. The
|
||||
|
@ -356,13 +359,16 @@ struct LinalgTilingOptions {
|
|||
LinalgTilingOptions &setTileSizes(ArrayRef<int64_t> ts);
|
||||
|
||||
/// The interchange vector to reorder the tiled loops.
|
||||
SmallVector<unsigned, 4> interchangeVector{};
|
||||
SmallVector<unsigned, 4> interchangeVector = {};
|
||||
|
||||
LinalgTilingOptions &setInterchange(ArrayRef<unsigned> interchange) {
|
||||
interchangeVector.assign(interchange.begin(), interchange.end());
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// The type of tile loops to generate.
|
||||
LinalgTilingLoopType loopType{LinalgTilingLoopType::Loops};
|
||||
LinalgTilingLoopType loopType = LinalgTilingLoopType::Loops;
|
||||
|
||||
LinalgTilingOptions &setLoopType(LinalgTilingLoopType lt) {
|
||||
loopType = lt;
|
||||
return *this;
|
||||
|
@ -371,9 +377,10 @@ struct LinalgTilingOptions {
|
|||
/// When specified, specifies distribution of generated tile loops to
|
||||
/// processors.
|
||||
Optional<LinalgLoopDistributionOptions> distribution = None;
|
||||
|
||||
LinalgTilingOptions &
|
||||
setDistributionOptions(LinalgLoopDistributionOptions &distributionOptions) {
|
||||
distribution = distributionOptions;
|
||||
setDistributionOptions(LinalgLoopDistributionOptions distributionOptions) {
|
||||
distribution = std::move(distributionOptions);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue