revert _prepare_4d_causal_attention_mask_with_cache_position for gpt2#41806
Closed
jiqing-feng wants to merge 1 commit intohuggingface:mainfrom
Closed
revert _prepare_4d_causal_attention_mask_with_cache_position for gpt2#41806jiqing-feng wants to merge 1 commit intohuggingface:mainfrom
_prepare_4d_causal_attention_mask_with_cache_position for gpt2#41806jiqing-feng wants to merge 1 commit intohuggingface:mainfrom
Conversation
Contributor
|
[For maintainers] Suggested jobs to run (before merge) run-slow: gpt2 |
Contributor
Author
|
run-slow: gpt2 |
vasqu
reviewed
Oct 23, 2025
Contributor
vasqu
left a comment
There was a problem hiding this comment.
It's the same issue as in #41639 (vmap in causal masking), I already discussed with @Cyrilvallez that we will add a non-vmap path to the mask creations. This will revert the perf regressions, so I'd like you to wait for the PR instead as we don't want to introduce old functions (we want to deprecate) back into the code.
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Contributor
Author
|
OK, please let me know when the PR is ready. Thanks! |
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.
Hi @zucchini-nlp
The PR #39754 deleted
_prepare_4d_causal_attention_mask_with_cache_positionon gpt2, which caused 40% performance regression on CPU. You can reproduce it bynumactl -C 0-7 --membind 0 python test.pyRevert
_prepare_4d_causal_attention_mask_with_cache_positioncan fix the regression.