Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
3933f18a
Unverified
Commit
3933f18a
authored
Oct 31, 2025
by
Isotr0py
Committed by
GitHub
Oct 31, 2025
Browse files
[Bugfix] Avoid too small block m/n for FlexAttention kernel option (#27853)
Signed-off-by:
Isotr0py
<
mozf@mail2.sysu.edu.cn
>
parent
e5ef4dfc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
vllm/v1/attention/backends/flex_attention.py
vllm/v1/attention/backends/flex_attention.py
+5
-0
No files found.
vllm/v1/attention/backends/flex_attention.py
View file @
3933f18a
...
@@ -896,6 +896,8 @@ def get_kernel_options(
...
@@ -896,6 +896,8 @@ def get_kernel_options(
return
kernel_options
return
kernel_options
else
:
else
:
preferred_block
=
32
if
query
.
dtype
==
torch
.
float32
else
64
preferred_block
=
32
if
query
.
dtype
==
torch
.
float32
else
64
block_lower_bound
=
16
block_m_candidate
=
ensure_divisible
(
preferred_block
,
block_m
)
block_m_candidate
=
ensure_divisible
(
preferred_block
,
block_m
)
block_n_candidate
=
ensure_divisible
(
preferred_block
,
block_n
)
block_n_candidate
=
ensure_divisible
(
preferred_block
,
block_n
)
...
@@ -910,6 +912,9 @@ def get_kernel_options(
...
@@ -910,6 +912,9 @@ def get_kernel_options(
max
(
1
,
block_n_candidate
//
2
),
block_n
max
(
1
,
block_n_candidate
//
2
),
block_n
)
)
block_m_candidate
=
max
(
block_m_candidate
,
block_lower_bound
)
block_n_candidate
=
max
(
block_n_candidate
,
block_lower_bound
)
kernel_options
[
"BLOCK_M"
]
=
block_m_candidate
kernel_options
[
"BLOCK_M"
]
=
block_m_candidate
kernel_options
[
"BLOCK_N"
]
=
block_n_candidate
kernel_options
[
"BLOCK_N"
]
=
block_n_candidate
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment