Add the option to use Boolean attention mask#1154
Closed
yangulei wants to merge 4 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new runtime feature flag to optionally represent attention masks as boolean tensors (instead of additive 0/-inf bias tensors), and updates the HPU attention code paths to correctly apply boolean masks during attention score computation.
Changes:
- Add
use_boolean_maskfeature flag (env varVLLM_USE_BOOLEAN_MASK) to runtime config. - Update attention-bias/mask construction in the HPU model runner to emit either boolean masks or additive
-infbiases depending on the flag. - Update HPU attention ops to apply boolean masks via
masked_fillinstead of adding an additive bias tensor.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
vllm_gaudi/v1/worker/hpu_model_runner.py |
Adds use_boolean_mask wiring and conditionally builds boolean vs additive attention masks/biases across multiple mask construction helpers. |
vllm_gaudi/extension/ops.py |
Applies boolean attention masks via masked_fill in prompt attention and paged-attention softmax paths. |
vllm_gaudi/extension/features.py |
Introduces use_boolean_mask config value driven by VLLM_USE_BOOLEAN_MASK. |
1b6d7af to
fee2317
Compare
✅ CI PassedAll checks passed successfully against the following vllm commit: |
Collaborator
|
@yangulei please include this new flag in documentation |
Collaborator
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Collaborator
Author
Signed-off-by: Youlei Yang <youlei.yang@intel.com>
Signed-off-by: Youlei Yang <youlei.yang@intel.com>
Signed-off-by: Youlei Yang <youlei.yang@intel.com>
Collaborator
Author
|
Close as no obvious perf gain and have accuracy issue when using with INC fp8. |
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.