forked from pytorch/torchrec
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embedding grouper distinguish between prefetched vs non-prefetched ta…
…ble (pytorch#1859) Summary: Pull Request resolved: pytorch#1859 Fuse cached vs non-cached table together will generally have two problem for memory efficiency: 1. TBE cache will use If `prefetch_pipeline` is as fused parameter, training pipeline will try to call `prefetch()` in a separate stream one batch ahead of time. This process, is unfortunately consuming lots of extra memory. Practically it consumes 8~9x the size of input tensor at peak. Therefore, we wish to minimize the input tensor size to `prefetch()` call as much as possible. To achieve that, we don't want to mix tables that require prefetch and doesn't to be grouped to the same TBE. This diff will not change behavior for any jobs without cached embedding offloading. For embedding-offloaded jobs, this diff will slightly decrease the performance of TBE lookup as it result in more TBEs (and subsequently more kernels in forward and backward). but greatly increase the memory efficiency: 1. If prefetch is off, all table (regardless of cache status or dimension) will be grouped together 2. If prefetch is on, 1. Cached vs noncached tables will be separated, even if they have the same dimension 2. For two cached tables, if they have different dimension they shall be separated, otherwise they'll be grouped 3. For two noncached tables, they'll be grouped regardless of dimension Reviewed By: henrylhtsang Differential Revision: D55901328 fbshipit-source-id: 3ad3c26721a5a208177e060c2777087ca1273bb7
- Loading branch information
1 parent
3fbd547
commit 819ecf3
Showing
4 changed files
with
59 additions
and
55 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