-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mlir][IR] Change MutableOperandRange::operator[]
to return an OpOperand &
#66515
Merged
matthias-springer
merged 1 commit into
llvm:main
from
matthias-springer:mutable_operand_range_op_operands
Sep 18, 2023
Merged
[mlir][IR] Change MutableOperandRange::operator[]
to return an OpOperand &
#66515
matthias-springer
merged 1 commit into
llvm:main
from
matthias-springer:mutable_operand_range_op_operands
Sep 18, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matthias-springer
requested review from
joker-eph,
nicolasvasilache and
River707
September 15, 2023 14:11
llvmbot
added
mlir:core
MLIR Core Infrastructure
mlir:linalg
mlir
mlir:tensor
mlir:bufferization
Bufferization infrastructure
mlir:scf
labels
Sep 15, 2023
@llvm/pr-subscribers-mlir-tensor @llvm/pr-subscribers-mlir Changes`operator[]` returns `OpOperand &` instead of `Value`.
Note: The TableGen code generator could be changed to return
|
joker-eph
reviewed
Sep 17, 2023
joker-eph
changed the title
[mlir][IR] MutableOperandRange:
[mlir][IR] Change Sep 17, 2023
operator[]
returns OpOperand &
MutableOperandRange::operator[]
to return an OpOperand &
joker-eph
approved these changes
Sep 17, 2023
`operator[]` returns `OpOperand &` instead of `Value`. * This allows users to get OpOperands by name instead of "magic" number. E.g., `extractSliceOp->getOpOperand(0)` can be written as `extractSliceOp.getSourceMutable()[0]`. * `OperandRange` provides a read-only API to operands: `operator[]` returns `Value`. `MutableOperandRange` now provides a mutable API: `operator[]` returns `OpOperand &`, which can be used to set operands. Note: The TableGen code generator could be changed to return `OpOperand &` (instead of `MutableOperandRange`) for non-variadic and non-optional arguments in a subsequent change. Then the `[0]` part in the above example would no longer be necessary. BEGIN_PUBLIC No public commit message needed for presubmit. END_PUBLIC
matthias-springer
force-pushed
the
mutable_operand_range_op_operands
branch
from
September 18, 2023 07:34
cc8180c
to
52450fe
Compare
matthias-springer
added a commit
to matthias-springer/llvm-project
that referenced
this pull request
Sep 18, 2023
In line with llvm#66515, change `MutableArrayRange::begin`/`end` to enumerate `OpOperand &` instead of `Value`. Also a remove `ForOp::getIterOpOperands`/`setIterArg`, which are now redundant. Note: `MutableOperandRange` cannot be made a derived class of `indexed_accessor_range_base` (like `OperandRange`), because `MutableOperandRange::assign` can change the number of operands in the range.
matthias-springer
added a commit
to matthias-springer/llvm-project
that referenced
this pull request
Sep 18, 2023
In line with llvm#66515, change `MutableArrayRange::begin`/`end` to enumerate `OpOperand &` instead of `Value`. Also a remove `ForOp::getIterOpOperands`/`setIterArg`, which are now redundant. Note: `MutableOperandRange` cannot be made a derived class of `indexed_accessor_range_base` (like `OperandRange`), because `MutableOperandRange::assign` can change the number of operands in the range. BEGIN_PUBLIC No public commit message needed for presubmit. END_PUBLIC
matthias-springer
added a commit
that referenced
this pull request
Sep 19, 2023
) In line with #66515, change `MutableArrayRange::begin`/`end` to enumerate `OpOperand &` instead of `Value`. Also remove `ForOp::getIterOpOperands`/`setIterArg`, which are now redundant. Note: `MutableOperandRange` cannot be made a derived class of `indexed_accessor_range_base` (like `OperandRange`), because `MutableOperandRange::assign` can change the number of operands in the range.
ZijunZhaoCCK
pushed a commit
to ZijunZhaoCCK/llvm-project
that referenced
this pull request
Sep 19, 2023
…perand &` (llvm#66515) `operator[]` returns `OpOperand &` instead of `Value`. * This allows users to get OpOperands by name instead of "magic" number. E.g., `extractSliceOp->getOpOperand(0)` can be written as `extractSliceOp.getSourceMutable()[0]`. * `OperandRange` provides a read-only API to operands: `operator[]` returns `Value`. `MutableOperandRange` now provides a mutable API: `operator[]` returns `OpOperand &`, which can be used to set operands. Note: The TableGen code generator could be changed to return `OpOperand &` (instead of `MutableOperandRange`) for non-variadic and non-optional arguments in a subsequent change. Then the `[0]` part in the above example would no longer be necessary.
ZijunZhaoCCK
pushed a commit
to ZijunZhaoCCK/llvm-project
that referenced
this pull request
Sep 19, 2023
…m#66622) In line with llvm#66515, change `MutableArrayRange::begin`/`end` to enumerate `OpOperand &` instead of `Value`. Also remove `ForOp::getIterOpOperands`/`setIterArg`, which are now redundant. Note: `MutableOperandRange` cannot be made a derived class of `indexed_accessor_range_base` (like `OperandRange`), because `MutableOperandRange::assign` can change the number of operands in the range.
matthias-springer
added a commit
to matthias-springer/llvm-project
that referenced
this pull request
Sep 21, 2023
* "init" operands are specified with `MutableOperandRange` (which gives access to the underlying `OpOperand *`). No more magic numbers. * Remove most interface methods and make them helper functions. Only `getInitsMutable` should be implemented. * Provide separate helper functions for accessing mutable/immutable operands (`OpOperand`/`Value`, in line with llvm#66515): `getInitsMutable` and `getInits` (same naming convention as auto-generated op accessors). `getInputOperands` was not renamed because this function cannot return a `MutableOperandRange` (because the operands are not necessarily consecutive). `OpOperandVector` is no longer needed. * The new `getDpsInits`/`getDpsInitsMutable` is more efficient than the old `getDpsInitOperands` because no `SmallVector` is created. The new functions return a range of operands. * Fix a bug in `getDpsInputOperands`: out-of-bounds operands were potentially returned. BEGIN_PUBLIC No public commit message needed for presubmit. END_PUBLIC
matthias-springer
added a commit
that referenced
this pull request
Sep 21, 2023
* "init" operands are specified with `MutableOperandRange` (which gives access to the underlying `OpOperand *`). No more magic numbers. * Remove most interface methods and make them helper functions. Only `getInitsMutable` should be implemented. * Provide separate helper functions for accessing mutable/immutable operands (`OpOperand`/`Value`, in line with #66515): `getInitsMutable` and `getInits` (same naming convention as auto-generated op accessors). `getInputOperands` was not renamed because this function cannot return a `MutableOperandRange` (because the operands are not necessarily consecutive). `OpOperandVector` is no longer needed. * The new `getDpsInits`/`getDpsInitsMutable` is more efficient than the old `getDpsInitOperands` because no `SmallVector` is created. The new functions return a range of operands. * Fix a bug in `getDpsInputOperands`: out-of-bounds operands were potentially returned.
zahiraam
pushed a commit
to tahonermann/llvm-project
that referenced
this pull request
Oct 24, 2023
…perand &` (llvm#66515) `operator[]` returns `OpOperand &` instead of `Value`. * This allows users to get OpOperands by name instead of "magic" number. E.g., `extractSliceOp->getOpOperand(0)` can be written as `extractSliceOp.getSourceMutable()[0]`. * `OperandRange` provides a read-only API to operands: `operator[]` returns `Value`. `MutableOperandRange` now provides a mutable API: `operator[]` returns `OpOperand &`, which can be used to set operands. Note: The TableGen code generator could be changed to return `OpOperand &` (instead of `MutableOperandRange`) for non-variadic and non-optional arguments in a subsequent change. Then the `[0]` part in the above example would no longer be necessary.
zahiraam
pushed a commit
to tahonermann/llvm-project
that referenced
this pull request
Oct 24, 2023
…perand &` (llvm#66515) `operator[]` returns `OpOperand &` instead of `Value`. * This allows users to get OpOperands by name instead of "magic" number. E.g., `extractSliceOp->getOpOperand(0)` can be written as `extractSliceOp.getSourceMutable()[0]`. * `OperandRange` provides a read-only API to operands: `operator[]` returns `Value`. `MutableOperandRange` now provides a mutable API: `operator[]` returns `OpOperand &`, which can be used to set operands. Note: The TableGen code generator could be changed to return `OpOperand &` (instead of `MutableOperandRange`) for non-variadic and non-optional arguments in a subsequent change. Then the `[0]` part in the above example would no longer be necessary.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
mlir:bufferization
Bufferization infrastructure
mlir:core
MLIR Core Infrastructure
mlir:linalg
mlir:scf
mlir:tensor
mlir
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
operator[]
returnsOpOperand &
instead ofValue
.extractSliceOp->getOpOperand(0)
can be written asextractSliceOp.getSourceMutable()[0]
.OperandRange
provides a read-only API to operands:operator[]
returnsValue
.MutableOperandRange
now provides a mutable API:operator[]
returnsOpOperand &
, which can be used to set operands.Note: The TableGen code generator could be changed to return
OpOperand &
(instead ofMutableOperandRange
) for non-variadic and non-optional arguments in a subsequent change. Then the[0]
part in the above example would no longer be necessary.