[all-commits] [llvm/llvm-project] 842b68: Defines new PDLInterp operations needed for multi-...
Stanislav Funiak via All-commits
all-commits at lists.llvm.org
Fri Nov 26 04:30:21 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 842b6861c01cc6961f170d58332ecf0fb0232441
https://github.com/llvm/llvm-project/commit/842b6861c01cc6961f170d58332ecf0fb0232441
Author: Stanislav Funiak <stano at cerebras.net>
Date: 2021-11-26 (Fri, 26 Nov 2021)
Changed paths:
M mlir/include/mlir/Dialect/PDLInterp/IR/PDLInterpOps.td
M mlir/lib/Dialect/PDLInterp/IR/PDLInterp.cpp
M mlir/test/Dialect/PDLInterp/ops.mlir
Log Message:
-----------
Defines new PDLInterp operations needed for multi-root matching in PDL.
This is commit 1 of 4 for the multi-root matching in PDL, discussed in https://llvm.discourse.group/t/rfc-multi-root-pdl-patterns-for-kernel-matching/4148 (topic flagged for review).
These operations are:
* pdl.get_accepting_ops: Returns a list of operations accepting the given value or a range of values at the specified position. Thus if there are two operations `%op1 = "foo"(%val)` and `%op2 = "bar"(%val)` accepting a value at position 0, `%ops = pdl_interp.get_accepting_ops of %val : !pdl.value at 0` will return both of them. This allows us to traverse upwards from a value to operations accepting the value.
* pdl.choose_op: Iteratively chooses one operation from a range of operations. Therefore, writing `%op = pdl_interp.choose_op from %ops` in the example above will select either `%op1`or `%op2`.
Testing: Added the corresponding test cases to mlir/test/Dialect/PDLInterp/ops.mlir.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D108543
More information about the All-commits
mailing list