Gates caching in group_index_select kernel to only take place for fp16 if batch size is small#158
Merged
aryaman-gupta merged 2 commits intoMay 21, 2026
Conversation
… + workload size Compute enable_cache_and_contig_for_bwd in the forward and pass it through saved_data to the backward. The flag is on for fp16/bf16 unconditionally (software CAS-loop atomicAdd makes the cache+contig wins large), and for fp32 only when num_total_indices >= the lower sort threshold (cache+contig per-warp overhead is otherwise not offset by the savings). The gating intentionally uses only the lower sort threshold, not the upper one: when the workload is too large for sort to be worthwhile, cache+contig still help because the kernel runtime dominates the per-warp overhead.
5844b46
into
abokovoi/group-index-sort-and-cache-opt
6 checks passed
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.
No description provided.