[all-commits] [llvm/llvm-project] 3c7522: [mlir:PDLInterp] Refactor the implementation of re...
River Riddle via All-commits
all-commits at lists.llvm.org
Sun May 1 12:47:00 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3c752289912895e067eb173485cadce6c618d6d4
https://github.com/llvm/llvm-project/commit/3c752289912895e067eb173485cadce6c618d6d4
Author: River Riddle <riddleriver at gmail.com>
Date: 2022-05-01 (Sun, 01 May 2022)
Changed paths:
M mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
M mlir/lib/Conversion/PDLToPDLInterp/PDLToPDLInterp.cpp
M mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp
M mlir/lib/Rewrite/ByteCode.cpp
M mlir/test/Conversion/PDLToPDLInterp/pdl-to-pdl-interp-rewriter.mlir
A mlir/test/Dialect/PDLInterp/invalid.mlir
M mlir/test/Dialect/PDLInterp/ops.mlir
M mlir/test/Rewrite/pdl-bytecode.mlir
Log Message:
-----------
[mlir:PDLInterp] Refactor the implementation of result type inferrence
The current implementation uses a discrete "pdl_interp.inferred_types"
operation, which acts as a "fake" handle to a type range. This op is
used as a signal to pdl_interp.create_operation that types should be
inferred. This is terribly awkward and clunky though:
* This op doesn't have a byte code representation, and its conversion
to bytecode kind of assumes that it is only used in a certain way. The
current lowering is also broken and seemingly untested.
* Given that this is a different operation, it gives off the assumption
that it can be used multiple times, or that after the first use
the value contains the inferred types. This isn't the case though,
the resultant type range can never actually be used as a type range.
This commit refactors the representation by removing the discrete
InferredTypesOp, and instead adds a UnitAttr to
pdl_interp.CreateOperation that signals when the created operations
should infer their types. This leads to a much much cleaner abstraction,
a more optimal bytecode lowering, and also allows for better error
handling and diagnostics when a created operation doesn't actually
support type inferrence.
Differential Revision: https://reviews.llvm.org/D124587
More information about the All-commits
mailing list