-
Notifications
You must be signed in to change notification settings - Fork 359
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
[feat] Add dependency awareness to torch-trt partitioning #1304
[feat] Add dependency awareness to torch-trt partitioning #1304
Conversation
I think this can be handled more simply in future by directly partitioning on the dependency graph. This would require updating the min_block_size logic, but would remove the need to merge segments after the initial partition. |
@mfeliz-cruise we are currently working on a major restructuring of the partitioning phase to hopefully bring it closer to other design patterns in the project and make it easier to debug the state and develop new features (#1263). Could you try rebasing this work on that branch and point the PR to merge into |
Looks like now there are still some errors on that branch. |
I'll hold off for now until it stabilizes. |
Adds a heuristic to torch-trt partitioning's segmentation to avoid materializing segments until we hit a dependency of that segment. This can significantly reduce the number of segments/engines in cases where the linear traversal of torchscipt nodes would otherwise produce alternating torch and TRT segments which are not dependent on each-other Fixes # (issue) Please delete options that are not relevant and/or add your own. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - This change requires a documentation update - [ ] My code follows the style guidelines of this project (You can use the linters) - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas and hacks - [ ] I have made corresponding changes to the documentation - [ ] I have added tests to verify my fix or my feature - [ ] New and existing unit tests pass locally with my changes - [ ] I have added the relevant labels to my PR in so that relevant reviewers are notified
1818813
to
3a33b6e
Compare
I've rebased and should be ready for review. |
Hello @mfeliz-cruise |
Sure @peri044, do you have a standard place you put this kind of documentation or should I just expand the PR description? |
We keep documentation for contributors on the implementation of partitioning here: https://pytorch.org/TensorRT/contributors/partitioning.html#partitioning |
I've taken a first pass at documenting this in docsrc/contributors/partitioning.rst |
|
|
Hello @mfeliz-cruise , From my understanding this is written for in-place ops. %2 = aten::cat(%1) |
It would be a case like this #1018 where we have an op that modifies its input without producing the modified value: Here |
Adds a heuristic to torch-trt partitioning's segmentation to avoid materializing segments until we hit a dependency of that segment. This can significantly reduce the number of segments/engines in cases where the linear traversal of torchscipt nodes would otherwise produce alternating torch and TRT segments which are not dependent on each-other
Fixes # (issue)
Please delete options that are not relevant and/or add your own.
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to not work as expected)
This change requires a documentation update
My code follows the style guidelines of this project (You can use the linters)
I have performed a self-review of my own code
I have commented my code, particularly in hard-to-understand areas and hacks
I have made corresponding changes to the documentation
I have added tests to verify my fix or my feature
New and existing unit tests pass locally with my changes
I have added the relevant labels to my PR in so that relevant reviewers are notified