Remove legacy get_max_thread_blocks helper from cuda_utilities#5897
Closed
q10 wants to merge 2 commits into
Closed
Remove legacy get_max_thread_blocks helper from cuda_utilities#5897q10 wants to merge 2 commits into
q10 wants to merge 2 commits into
Conversation
…max_thread_blocks helpers (pytorch#5853) Summary: X-link: facebookresearch/FBGEMM#2775 Final diff in the threshold-guard helper introduction stack. Migrates the two host-side cap sites in `codegen/training/backward/embedding_backward_split_template.cu` from the legacy `std::min(blocks_uncapped, get_max_thread_blocks_(...))` form to the new threshold-guarded helper `fbgemm_gpu::utils::cuda::determine_grid_blocks_from_blocks(..., BlockCapPolicy::Always)`. With this migration the last legacy callers are gone, so this diff also cleans up: - Removes `fbgemm_gpu::utils::cuda::get_max_thread_blocks(stream)` from `include/fbgemm_gpu/utils/cuda_utilities.cuh`. - Removes the file-local `get_max_thread_blocks_()` and `MAX_THREAD_BLOCKS_FACTOR` from `include/fbgemm_gpu/embedding_backward_template_helpers.cuh`. - Adds `#include "fbgemm_gpu/utils/cuda_utilities.cuh"` to `embedding_backward_template_helpers.cuh` for the new helper. Behavior-preserving on the TBE backward variants: the policy `Always` matches the prior unconditional ROCm cap exactly. Reviewed By: spcyppt Differential Revision: D106453408
Summary: Now that the TBE backward template (the last caller) has migrated to `cap_grid_dim_x`, remove the legacy `fbgemm_gpu::utils::cuda::get_max_thread_blocks(stream)` helper from `include/fbgemm_gpu/utils/cuda_utilities.cuh` and inline its sole remaining use inside `cap_grid_dim_x`. Behavior-preserving: the inlined body computes `MAX_THREAD_BLOCKS_FACTOR * #SMs` exactly as before. Reviewed By: spcyppt Differential Revision: D107317501
Contributor
|
@q10 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107317501. |
Contributor
|
This pull request has been merged in 57f3a8b. |
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.
Summary:
Now that the TBE backward template (the last caller) has migrated to
cap_grid_dim_x, remove the legacyfbgemm_gpu::utils::cuda::get_max_thread_blocks(stream)helper frominclude/fbgemm_gpu/utils/cuda_utilities.cuhand inline its soleremaining use inside
cap_grid_dim_x.Behavior-preserving: the inlined body computes
MAX_THREAD_BLOCKS_FACTOR * #SMsexactly as before.Reviewed By: spcyppt
Differential Revision: D107317501