-
Notifications
You must be signed in to change notification settings - Fork 568
Compute info_B_num_bits
from T to make it a constant
#3748
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
Closed
Closed
Conversation
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
This pull request was exported from Phabricator. Differential Revision: D69387123 |
✅ Deploy Preview for pytorch-fbgemm-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
bc14ff6
to
46d9ccd
Compare
spcyppt
added a commit
to spcyppt/FBGEMM
that referenced
this pull request
Mar 1, 2025
Summary: X-link: facebookresearch/FBGEMM#829 ` b_t_map` contains information of batch (`b`) and feature (`t`). `info_B_num_bits` tells how many bits are used to cover batch information and is currently computed each iteration given the batch size. The `info_B_num_bits` calculation is problematic when `max_B_` is symbolic, causing issues with eagerAOT mode. If `max_B_` is symbolic, `info_B_num_bits` is not recomputed and uses the default value which can fail or if there is not enough bits for B. To resolve the issues, we can make `info_B_num_bits` constant. Current implementation adjusts `info_B_num_bits` based on the batch size, causing it to change every iteration. Fixing the values may cause the aforementioned issue of having insufficient bits for B. This diff implements `get_info_B_num_bits_from_T` to make `info_B_num_bits` constant. We first calculate how many bits required to cover `T` information, as number of features are known at TBE initialization and will remain the same throughout the run. The rest of the bits will be for `B` information. Since `info_T_num_bits` remains the same, `info_B_num_bits` remains the same. If there's not enough bits for B, it will fail. In V1 interface, since we hit the limit for the maximum number of arguments, we keep the interface the same. In V2 interface (next diff), we compute `info_B_num_bits` and `info_B_mask` once, store them as module parameters, and pass them to lookup and corresponding Autograd and backend functions. Reviewed By: sryap Differential Revision: D69387123
spcyppt
added a commit
to spcyppt/FBGEMM
that referenced
this pull request
Mar 1, 2025
Summary: X-link: facebookresearch/FBGEMM#829 ` b_t_map` contains information of batch (`b`) and feature (`t`). `info_B_num_bits` tells how many bits are used to cover batch information and is currently computed each iteration given the batch size. The `info_B_num_bits` calculation is problematic when `max_B_` is symbolic, causing issues with eagerAOT mode. If `max_B_` is symbolic, `info_B_num_bits` is not recomputed and uses the default value which can fail or if there is not enough bits for B. To resolve the issues, we can make `info_B_num_bits` constant. Current implementation adjusts `info_B_num_bits` based on the batch size, causing it to change every iteration. Fixing the values may cause the aforementioned issue of having insufficient bits for B. This diff implements `get_info_B_num_bits_from_T` to make `info_B_num_bits` constant. We first calculate how many bits required to cover `T` information, as number of features are known at TBE initialization and will remain the same throughout the run. The rest of the bits will be for `B` information. Since `info_T_num_bits` remains the same, `info_B_num_bits` remains the same. If there's not enough bits for B, it will fail. In V1 interface, since we hit the limit for the maximum number of arguments, we keep the interface the same. In V2 interface (next diff), we compute `info_B_num_bits` and `info_B_mask` once, store them as module parameters, and pass them to lookup and corresponding Autograd and backend functions. Reviewed By: sryap Differential Revision: D69387123
46d9ccd
to
81cb119
Compare
This pull request was exported from Phabricator. Differential Revision: D69387123 |
spcyppt
added a commit
to spcyppt/FBGEMM
that referenced
this pull request
Mar 1, 2025
Summary: Pull Request resolved: pytorch#3748 X-link: facebookresearch/FBGEMM#829 ` b_t_map` contains information of batch (`b`) and feature (`t`). `info_B_num_bits` tells how many bits are used to cover batch information and is currently computed each iteration given the batch size. The `info_B_num_bits` calculation is problematic when `max_B_` is symbolic, causing issues with eagerAOT mode. If `max_B_` is symbolic, `info_B_num_bits` is not recomputed and uses the default value which can fail or if there is not enough bits for B. To resolve the issues, we can make `info_B_num_bits` constant. Current implementation adjusts `info_B_num_bits` based on the batch size, causing it to change every iteration. Fixing the values may cause the aforementioned issue of having insufficient bits for B. This diff implements `get_info_B_num_bits_from_T` to make `info_B_num_bits` constant. We first calculate how many bits required to cover `T` information, as number of features are known at TBE initialization and will remain the same throughout the run. The rest of the bits will be for `B` information. Since `info_T_num_bits` remains the same, `info_B_num_bits` remains the same. If there's not enough bits for B, it will fail. In V1 interface, since we hit the limit for the maximum number of arguments, we keep the interface the same. In V2 interface (next diff), we compute `info_B_num_bits` and `info_B_mask` once, store them as module parameters, and pass them to lookup and corresponding Autograd and backend functions. Reviewed By: sryap Differential Revision: D69387123
81cb119
to
f67490d
Compare
Summary: Pull Request resolved: pytorch#3748 X-link: facebookresearch/FBGEMM#829 ` b_t_map` contains information of batch (`b`) and feature (`t`). `info_B_num_bits` tells how many bits are used to cover batch information and is currently computed each iteration given the batch size. The `info_B_num_bits` calculation is problematic when `max_B_` is symbolic, causing issues with eagerAOT mode. If `max_B_` is symbolic, `info_B_num_bits` is not recomputed and uses the default value which can fail or if there is not enough bits for B. To resolve the issues, we can make `info_B_num_bits` constant. Current implementation adjusts `info_B_num_bits` based on the batch size, causing it to change every iteration. Fixing the values may cause the aforementioned issue of having insufficient bits for B. This diff implements `get_info_B_num_bits_from_T` to make `info_B_num_bits` constant. We first calculate how many bits required to cover `T` information, as number of features are known at TBE initialization and will remain the same throughout the run. The rest of the bits will be for `B` information. Since `info_T_num_bits` remains the same, `info_B_num_bits` remains the same. If there's not enough bits for B, it will fail. In V1 interface, since we hit the limit for the maximum number of arguments, we keep the interface the same. In V2 interface (next diff), we compute `info_B_num_bits` and `info_B_mask` once, store them as module parameters, and pass them to lookup and corresponding Autograd and backend functions. Reviewed By: sryap Differential Revision: D69387123
This pull request was exported from Phabricator. Differential Revision: D69387123 |
f67490d
to
ae3f7cd
Compare
spcyppt
added a commit
to spcyppt/FBGEMM
that referenced
this pull request
Mar 3, 2025
Summary: X-link: facebookresearch/FBGEMM#829 ` b_t_map` contains information of batch (`b`) and feature (`t`). `info_B_num_bits` tells how many bits are used to cover batch information and is currently computed each iteration given the batch size. The `info_B_num_bits` calculation is problematic when `max_B_` is symbolic, causing issues with eagerAOT mode. If `max_B_` is symbolic, `info_B_num_bits` is not recomputed and uses the default value which can fail or if there is not enough bits for B. To resolve the issues, we can make `info_B_num_bits` constant. Current implementation adjusts `info_B_num_bits` based on the batch size, causing it to change every iteration. Fixing the values may cause the aforementioned issue of having insufficient bits for B. This diff implements `get_info_B_num_bits_from_T` to make `info_B_num_bits` constant. We first calculate how many bits required to cover `T` information, as number of features are known at TBE initialization and will remain the same throughout the run. The rest of the bits will be for `B` information. Since `info_T_num_bits` remains the same, `info_B_num_bits` remains the same. If there's not enough bits for B, it will fail. In V1 interface, since we hit the limit for the maximum number of arguments, we keep the interface the same. In V2 interface (next diff), we compute `info_B_num_bits` and `info_B_mask` once, store them as module parameters, and pass them to lookup and corresponding Autograd and backend functions. Reviewed By: sryap Differential Revision: D69387123
This pull request has been merged in fc9863e. |
q10
pushed a commit
to q10/FBGEMM
that referenced
this pull request
Apr 10, 2025
Summary: X-link: pytorch#3748 Pull Request resolved: facebookresearch/FBGEMM#829 ` b_t_map` contains information of batch (`b`) and feature (`t`). `info_B_num_bits` tells how many bits are used to cover batch information and is currently computed each iteration given the batch size. The `info_B_num_bits` calculation is problematic when `max_B_` is symbolic, causing issues with eagerAOT mode. If `max_B_` is symbolic, `info_B_num_bits` is not recomputed and uses the default value which can fail or if there is not enough bits for B. To resolve the issues, we can make `info_B_num_bits` constant. Current implementation adjusts `info_B_num_bits` based on the batch size, causing it to change every iteration. Fixing the values may cause the aforementioned issue of having insufficient bits for B. This diff implements `get_info_B_num_bits_from_T` to make `info_B_num_bits` constant. We first calculate how many bits required to cover `T` information, as number of features are known at TBE initialization and will remain the same throughout the run. The rest of the bits will be for `B` information. Since `info_T_num_bits` remains the same, `info_B_num_bits` remains the same. If there's not enough bits for B, it will fail. In V1 interface, since we hit the limit for the maximum number of arguments, we keep the interface the same. In V2 interface (next diff), we compute `info_B_num_bits` and `info_B_mask` once, store them as module parameters, and pass them to lookup and corresponding Autograd and backend functions. Reviewed By: sryap Differential Revision: D69387123 fbshipit-source-id: 3ddc1a3e3822525db907a58d66fedc4148e7bc7a
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.
Summary:
X-link: https://github.com/facebookresearch/FBGEMM/pull/829
b_t_map
contains information of batch (b
) and feature (t
).info_B_num_bits
tells how many bits are used to cover batch information and is currently computed each iteration given the batch size.The
info_B_num_bits
calculation is problematic whenmax_B_
is symbolic, causing issues with eagerAOT mode. Ifmax_B_
is symbolic,info_B_num_bits
is not recomputed and uses the default value which can fail or if there is not enough bits for B.To resolve the issues, we can make
info_B_num_bits
constant. Current implementation adjustsinfo_B_num_bits
based on the batch size, causing it to change every iteration. Fixing the values may cause the aforementioned issue of having insufficient bits for B.This diff implements
get_info_B_num_bits_from_T
to makeinfo_B_num_bits
constant. We first calculate how many bits required to coverT
information, as number of features are known at TBE initialization and will remain the same throughout the run. The rest of the bits will be forB
information. Sinceinfo_T_num_bits
remains the same,info_B_num_bits
remains the same. If there's not enough bits for B, it will fail.In V1 interface, since we hit the limit for the maximum number of arguments, we keep the interface the same.
In V2 interface (next diff), we compute
info_B_num_bits
andinfo_B_mask
once, store them as module parameters, and pass them to lookup and corresponding Autograd and backend functions.Reviewed By: sryap
Differential Revision: D69387123