Skip to content

hybrid_w4a16: Tune qwen3-vl-4b TTFT shapes for gfx1150 with 2 448x448 image and 256 text token input #1012

Merged
mgehre-amd merged 3 commits into
gfx11from
qingxu/qwen3-vl-optimize2
Jun 29, 2026
Merged

hybrid_w4a16: Tune qwen3-vl-4b TTFT shapes for gfx1150 with 2 448x448 image and 256 text token input #1012
mgehre-amd merged 3 commits into
gfx11from
qingxu/qwen3-vl-optimize2

Conversation

@qingxuamd

Copy link
Copy Markdown

Specifically optimize the kernel tile according to qwen3-vl-4b and input shape, without this PR, TTFT=1231 ms, with this PR, TTFT = 980 ms.

Comment thread vllm/model_executor/kernels/linear/mixed_precision/hybrid_w4a16.py
@qingxuamd qingxuamd force-pushed the qingxu/qwen3-vl-optimize2 branch from 1828d6d to 504cc57 Compare June 24, 2026 08:25
@qingxuamd qingxuamd requested a review from dllehr-amd as a code owner June 24, 2026 08:25
Comment thread vllm/v1/attention/ops/triton_unified_attention.py
@qingxuamd qingxuamd force-pushed the qingxu/qwen3-vl-optimize2 branch from 504cc57 to 5f2e7ac Compare June 25, 2026 09:56
@mgehre-amd mgehre-amd changed the title optimization qwen3-vl-4b TTFT for gfx1150 with 2 448x448 image and 256 text token input hybrid_w4a16: Tune qwen3-vl-4b TTFT shapes for gfx1150 with 2 448x448 image and 256 text token input Jun 26, 2026
This optimization is for gfx1150.
The model of Qwen3-VL-4B-Instruct-AWQ-4bit-lm_head_int8, for
triton_w4a16_skinny_fmt_kernel, it cost more then 60% latency
in prefill. The required input = 2 448x448 img + 256 token,
then, tok num ~=660 tok.

M: ~660 (2x448x448 + 256 token  prefill)
N,K(hot shape):
660 x 19456 x 2560
660 x 2560 x 9728
660 x 6144 x 2560
660 x 2560 x 4096
warps, currently 8 is best num

so:
BLOCK_M=64
BLOCK_N=256
BLOCK_K=64
num_warps=8

GEMM:M=660,N/K as above
kernel tile:64,256,64,8

Signed-off-by: Xu Qing <qing.xu2@amd.com>
@qingxuamd qingxuamd force-pushed the qingxu/qwen3-vl-optimize2 branch from 5f2e7ac to 169f9c0 Compare June 26, 2026 10:21
Add two missing blank lines between module-level functions as required
by ruff-format (E302).

Signed-off-by: Matthias Gehre <matthias.gehre@amd.com>
@mgehre-amd mgehre-amd merged commit cd26064 into gfx11 Jun 29, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants