summaryrefslogtreecommitdiffstats
path: root/mlir/test/lib/Transforms
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-12-23 15:54:55 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-23 16:48:22 -0800
commit21610e6651682a21a7ea8b81d65fa7271447fa31 (patch)
treedb04520512221d0dac03657839dc99c6eaab0424 /mlir/test/lib/Transforms
parente62a69561fb9d7b1013d2853da68d79a7907fead (diff)
downloadbcm5719-llvm-21610e6651682a21a7ea8b81d65fa7271447fa31.tar.gz
bcm5719-llvm-21610e6651682a21a7ea8b81d65fa7271447fa31.zip
Refactor the way that pass options are specified.
This change refactors pass options to be more similar to how statistics are modeled. More specifically, the options are specified directly on the pass instead of in a separate options class. (Note that the behavior and specification for pass pipelines remains the same.) This brings about several benefits: * The specification of options is much simpler * The round-trip format of a pass can be generated automatically * This gives a somewhat deeper integration with "configuring" a pass, which we could potentially expose to users in the future. PiperOrigin-RevId: 286953824
Diffstat (limited to 'mlir/test/lib/Transforms')
-rw-r--r--mlir/test/lib/Transforms/TestLoopParametricTiling.cpp24
1 files changed, 9 insertions, 15 deletions
diff --git a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp
index 7b0cdcade4d..e793ee54cda 100644
--- a/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp
+++ b/mlir/test/lib/Transforms/TestLoopParametricTiling.cpp
@@ -25,18 +25,10 @@ namespace {
class SimpleParametricLoopTilingPass
: public FunctionPass<SimpleParametricLoopTilingPass> {
public:
- struct Options : public PassOptions<Options> {
- List<int> clOuterLoopSizes{
- *this, "test-outer-loop-sizes", llvm::cl::MiscFlags::CommaSeparated,
- llvm::cl::desc(
- "fixed number of iterations that the outer loops should have")};
- };
-
- explicit SimpleParametricLoopTilingPass(ArrayRef<int64_t> outerLoopSizes)
- : sizes(outerLoopSizes.begin(), outerLoopSizes.end()) {}
- explicit SimpleParametricLoopTilingPass(const Options &options) {
- sizes.assign(options.clOuterLoopSizes.begin(),
- options.clOuterLoopSizes.end());
+ SimpleParametricLoopTilingPass() = default;
+ SimpleParametricLoopTilingPass(const SimpleParametricLoopTilingPass &) {}
+ explicit SimpleParametricLoopTilingPass(ArrayRef<int64_t> outerLoopSizes) {
+ sizes = outerLoopSizes;
}
void runOnFunction() override {
@@ -49,7 +41,10 @@ public:
});
}
- SmallVector<int64_t, 4> sizes;
+ ListOption<int64_t> sizes{
+ *this, "test-outer-loop-sizes", llvm::cl::MiscFlags::CommaSeparated,
+ llvm::cl::desc(
+ "fixed number of iterations that the outer loops should have")};
};
} // end namespace
@@ -58,8 +53,7 @@ mlir::createSimpleParametricTilingPass(ArrayRef<int64_t> outerLoopSizes) {
return std::make_unique<SimpleParametricLoopTilingPass>(outerLoopSizes);
}
-static PassRegistration<SimpleParametricLoopTilingPass,
- SimpleParametricLoopTilingPass::Options>
+static PassRegistration<SimpleParametricLoopTilingPass>
reg("test-extract-fixed-outer-loops",
"test application of parametric tiling to the outer loops so that the "
"ranges of outer loops become static");
OpenPOWER on IntegriCloud