You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want to expose those functions to the MLIR python bindings, so we can use it in the tuner instead of rewriting the logic in python.
Root Op Matching
The other part of the op_matchers.py logic is for picking out the "root op" from the dispatch. We want this logic to be exposed in the IREE python bindings, and then we can remove the python logic in the tuner. See iree-org/iree#20292 for more details.
Tuner Work
Once we have exposed the necessary utils in the bindings, we should ideally remove the op_matchers.py file altogether. The op_matchers.py file primarily defines a set of matcher classes for the types of ops we care about (mainly some named ops and contraction ops). We should delete these classes, and replace the uses of them with a few simple calls to the relevant python bindings. For example, the section here:
assertcontraction_opisnotNone, f"contraction op not found"
contraction_dims=matcher.contraction_dimensions
Can be replaced by a call to the binding for the exposed root op matching, followed by calls to linalg::isaContractionOpInterface, and linalg::inferContractionDims bindings.
The text was updated successfully, but these errors were encountered:
As we want to add more and more op support in the tuner, we need a more maintainable solution for matching ops and extracting relevant problem size information in the tuner. Currently, this logic lives in https://github.com/nod-ai/shark-ai/blob/main/tuner/tuner/op_matchers.py.
ContractionOpInterface
We should offload this logic to the python bindings in IREE, and directly use the python bindings in the tuner. Most of the logic in op_matchers.py is there to match and extract information about ContractionOpInterface ops, but this logic already exists in upstream MLIR:
https://github.com/llvm/llvm-project/blob/d85a81b4e4cfc0fdc7c259d64f847e7bbeee56d2/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.h#L41-L71
We want to expose those functions to the MLIR python bindings, so we can use it in the tuner instead of rewriting the logic in python.
Root Op Matching
The other part of the op_matchers.py logic is for picking out the "root op" from the dispatch. We want this logic to be exposed in the IREE python bindings, and then we can remove the python logic in the tuner. See iree-org/iree#20292 for more details.
Tuner Work
Once we have exposed the necessary utils in the bindings, we should ideally remove the op_matchers.py file altogether. The op_matchers.py file primarily defines a set of matcher classes for the types of ops we care about (mainly some named ops and contraction ops). We should delete these classes, and replace the uses of them with a few simple calls to the relevant python bindings. For example, the section here:
shark-ai/tuner/tuner/dispatch_parser.py
Lines 61 to 63 in 71a3637
Can be replaced by a call to the binding for the exposed root op matching, followed by calls to
linalg::isaContractionOpInterface
, andlinalg::inferContractionDims
bindings.The text was updated successfully, but these errors were encountered: