forked from pytorch/FBGEMM
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use unique cache locations in backward for pipeline prefetching (pyto…
…rch#2151) Summary: Pull Request resolved: pytorch#2151 When pipeline prefetching is enabled (`prefetch_pipeline=True`) for `EmbeddingLocation.MANAGED_CACHING`, TBE has to update `lxu_cache_locations` to ensure cache consistency. Prior to this diff, TBE performs the full cache lookup when updating `lxu_cache_locations` (i.e., looking up all indices although they are duplicated). The time complexity of such the lookup grows with the number of indices. Thus, the lookup can be expensive when the number of indices is large. This diff addresses this problem by looking up only the unique indices (which is normally much smaller than the full indices). The number of unique indices tends to stay more or less the same even when the total number of indices grows. Thus, looking up only unique indices can reduce cost of cache lookup effectively. The unique `lxu_cache_locations` are fed directly to TBE backward to consume. Thus, there is no decompression cost. Reviewed By: ehsanardestani, jianyuh Differential Revision: D51339208 fbshipit-source-id: be117db4a4a516341a99210e4c4e32dd9526588c
- Loading branch information
1 parent
ca1da75
commit 035ed1f
Showing
7 changed files
with
222 additions
and
29 deletions.
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.