Repository navigation
Tensorlist refactor to remove shape input and support empty reserve behavior - #3941
Merged
Merged
Conversation
rsuderman
force-pushed
the
test_343373511
branch
2 times, most recently
from
November 20, 2020 20:37
614ea47 to
e59df90
Compare
rsuderman
force-pushed
the
test_343373511
branch
2 times, most recently
from
November 20, 2020 21:48
84cf03c to
26607fa
Compare
silvasean
approved these changes
Nov 21, 2020
| TEST_F(TensorListModulesTest, ConcatAppendsEmpty) { | ||
| // Allocate the buffer we'll be passing through. | ||
| std::vector<float> input = {42.0f}; | ||
| absl::InlinedVector<int32_t, 4> input_shape = {1}; |
Contributor
There was a problem hiding this comment.
Thanks for this cleanup!
| // CHECK-LABEL: func @concat | ||
| func @concat(%arg0: tensor<?xf32>, %element_shape: tensor<0xi32>, %lead: tensor<i64>) -> (tensor<?xf32>, tensor<0xi64>) { | ||
| // CHECK-DAG: [[LIST0:%.+]] = "tf_tensorlist.FromTensor"(%arg0, %arg1) | ||
| func @concat(%arg0: tensor<5xf32>, %element_shape: tensor<0xi32>, %lead: tensor<i64>) -> (tensor<5xf32>, tensor<0xi64>) { |
Contributor
There was a problem hiding this comment.
why change ?xf32 to 5xf32?
Collaborator
Author
There was a problem hiding this comment.
It let me run both passes in sequence for testing. I will revert back to dynamic.
| patterns.insert< | ||
| HALOpConversion<tf_tensorlist::Reserve, IREE::TensorList::Reserve>>( | ||
| context, typeConverter); | ||
| // patterns.insert< |
Contributor
There was a problem hiding this comment.
remove commented out code.
| .getResult(); | ||
|
|
||
| Value operand1; | ||
| getBufferView(stackOp, stackOp.getOperand(1), newOperands[1], rewriter, |
Contributor
There was a problem hiding this comment.
Value operand1 = getBufferView(...)? You don't seem to be checking the LogicalResult. You can just return nullptr in case of failure (and actually check it)
Shape is a redundant parameter and can be tracked within the tensorlist structure. Storing on the structure avoids handing the data around needlessly. PiperOrigin-RevId: 343373511
rsuderman
force-pushed
the
test_343373511
branch
from
November 30, 2020 22:11
26607fa to
b4de357
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Tensorlist needed a refactor on inputs. To handle support incomplete / unfilled entries for reserve
we need to track tensor information on the tensorlist (shape, element type) and support allocation
when not provided a hal buffer. This was solved by adding type information to the reserve op,
adding allocator attributes to concat and stack.
This included removing unneeded operators from the stack/concat operators.