[cuda] Limit grid size for torch.cat kernel on aligned16 contig tensors#103233
Closed
valentinandrei wants to merge 1 commit intopytorch:mainfrom
Closed
[cuda] Limit grid size for torch.cat kernel on aligned16 contig tensors#103233valentinandrei wants to merge 1 commit intopytorch:mainfrom
valentinandrei wants to merge 1 commit intopytorch:mainfrom
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/103233
Note: Links to docs will display an error until the docs builds have been completed. ✅ 1 Unrelated FailureAs of commit dcac7e1: UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Contributor
Author
|
cc: @malfet |
malfet
approved these changes
Jun 8, 2023
Contributor
|
@pytorchbot merge -ic |
|
|
Contributor
|
@pytorchbot merge -i |
Collaborator
Merge startedYour change will be merged while ignoring the following 1 checks: pull / linux-focal-py3.8-gcc7 / test (distributed, 1, 2, linux.2xlarge, unstable) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
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.
When torch.cat gets called on a list of contiguous tensors that are aligned on a 16B boundary in memory, the number of thread blocks used is directly proportional with the maximum size of the tensors in the list. If one or more tensors are very large while the others are small, a high number of thread blocks results in useless redundant loads of the input metadata. This PR limits the grid size and improves the performance of cat when used on list of tensors with large variations in size.
Used the same test program from #102815 but added new cases with list of tensors with varying sizes.