Implement the ReductionNode and ReductionTree data structures for the purpose of creating a framework to track the reductions within each pass in the MLIR Reduce tool.
This is a flexible framework that offers a general structure for the reduction implementation while allowing for different transformations to be integrated depending on the reduction pass objective.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Reducer/ReductionNode.h | ||
---|---|---|
19 | (please fix the clang-tidy warning) | |
21 | Is this needed in this header? | |
25 | Same as above: is this include needed here? | |
53 | Seems like this could return a const & to the member vector, and I think we wouldn't need the getVariant API (because getVariants()[i]would just work) | |
63 | Could/should this be a vector of unique_ptr? | |
mlir/include/mlir/Reducer/ReductionTree.h | ||
47 | Can this be a unique_ptr? | |
51 | (nit: fix clang-tidy naming) | |
mlir/tools/mlir-reduce/ReductionNode.cpp | ||
93 | Nit: replace at with subscript operator[] | |
mlir/tools/mlir-reduce/ReductionTree.cpp | ||
41 | You don't take ownership of the callback, so seems like a case to use llvm::function_ref instead of std::function | |
53 | Side-note: I'm still unsure why the "tester" is the right place to keep track of the most reduced module) |
mlir/include/mlir/Reducer/ReductionTree.h | ||
---|---|---|
33 | As discussed offline, lets explore making this a module pass parameterized on a reducer class which has a generateVariants method and then can use pass manager. |
Apply requested changes
- Delete getVariant method
- Modify getVariants return type
- Formatting changes
- Replace std::function with llvm::function_ref
Will make the unique_ptr changes in the following update along with making the reduction tree a module pass and use the pass manager.
mlir/tools/mlir-reduce/ReductionTree.cpp | ||
---|---|---|
53 | Currently, the tester is the only object that gets passed from one pass to another in the reduction pipeline. The 'mostReduced' refers to the most reduced test case up to that point: it is used as the starting point in a pass and it is updated at the end of a pass if the reduction was effective. I agree it is somewhat counter intuitive so I am currently trying to refactor this. |