-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[microNPU] Add support for TFLite concatenate #9589
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
Conversation
| ), | ||
| output_pointer, | ||
| replace_pointer, | ||
| is_allocator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_allocator is missing in the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| ), | ||
| output_pointer, | ||
| replace_pointer, | ||
| is_allocator, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_allocator is missing in the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| None, | ||
| True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring for the last two return values is missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
5c3d5c3 to
8aab6ff
Compare
|
@NicolaLancellotti thanks for the review! :) |
lhutton1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ekalda, LGTM! Feel free to ignore or follow up the comments
| concat_buffer = replace_info.buffer | ||
| new_indices = list(stmt.indices) | ||
| new_indices[replace_info.axis] += replace_info.offset | ||
| # DODGY STORE NODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a comment would be good here to describe why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That comment is courtesy of @mbaret so I'm not exactly sure what makes this store node dodgy, but I updated that comment anyway :)
|
|
||
| def is_valid(self): | ||
| """Checks whether Concatenate has compatible attributes with the hardware""" | ||
| if not check_valid_dtypes(self.input_tensors, supported_dtypes=[np.int8]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we can't support any other data type for concatenate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint8 should be supported as well, but I didn't enable it since we don't test it... It would be trivial to enable it in the future if we need to support TFLite 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, thanks for clarifying :)
8aab6ff to
df852a7
Compare
manupak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Seems not a trivial implementation. :). Lets do a rebase -- so that we could get this in...
| ) | ||
|
|
||
| # Assumes only two runtime.Modules are created -- i.e. single offload module | ||
| imported_modules = compiled_models[0].executor_factory.lib.imported_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs changing after target hooks but you ll find it anyway after a rebase :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have resolved all the conflicts (for now) and all the tests pass (except the mean tests which we will fix)!
539e21c to
1f779ce
Compare
* Add legalization pass and is_valid checks for concatenate * Add TIR pass for removing concatenates and replacing them with direct writes to the final buffer * Add tests Co-authored-by: Matthew Barrett <Matthew.Barrett@arm.com>
Change-Id: Ifddd103ba2aed5aa37200e66040cc6f5ad3cf9bb
1f779ce to
7fc9668
Compare
|
Thanks! @ekalda @lhutton1 @NicolaLancellotti @mbaret . This is merged now! |
* Add legalization pass and is_valid checks for concatenate * Add TIR pass for removing concatenates and replacing them with direct writes to the final buffer * Add tests Co-authored-by: Matthew Barrett <Matthew.Barrett@arm.com>
* Add legalization pass and is_valid checks for concatenate * Add TIR pass for removing concatenates and replacing them with direct writes to the final buffer * Add tests Co-authored-by: Matthew Barrett <Matthew.Barrett@arm.com>
* Add legalization pass and is_valid checks for concatenate * Add TIR pass for removing concatenates and replacing them with direct writes to the final buffer * Add tests Co-authored-by: Matthew Barrett <Matthew.Barrett@arm.com>
* Add legalization pass and is_valid checks for concatenate * Add TIR pass for removing concatenates and replacing them with direct writes to the final buffer * Add tests Co-authored-by: Matthew Barrett <Matthew.Barrett@arm.com>
* Add legalization pass and is_valid checks for concatenate * Add TIR pass for removing concatenates and replacing them with direct writes to the final buffer * Add tests Co-authored-by: Matthew Barrett <Matthew.Barrett@arm.com>
writes to the final buffer
Co-authored-by: Matthew Barrett Matthew.Barrett@arm.com