Add CCL support to Gemma4, Qwen3.5 (moe), and qwn3_vl models - #1188
Open
vjanfaza wants to merge 3 commits into
Open
Add CCL support to Gemma4, Qwen3.5 (moe), and qwn3_vl models#1188vjanfaza wants to merge 3 commits into
vjanfaza wants to merge 3 commits into
Conversation
Enable the compute-context-length (CCL) feature for the Gemma4 and Qwen3.5 image-text-to-text model families and fix CCL specialization gating so it also works for disaggregated (separate prefill/decode) serving. Gemma4 (modeling_gemma4.py): - Thread comp_ctx_lengths through the text model, decoder layer, and attention so the exported ONNX actually consumes it: slice the attention mask to the CCL width and pass "CCL" into cache_kwargs (mirrors Gemma3). - Fix the dummy comp_ctx_lengths input dtype (int8 -> int64) so the traced ONNX input matches the int64 runtime buffer. - Split the "prefill and decode" specialization gate into an OR so CCL is honored when only one of the prefill/decode lists is provided. Qwen3.5 (modeling_qwen3_5.py, modeling_qwen3_5_moe.py): - Fix the dummy comp_ctx_lengths input dtype (int8 -> int64). - Add the missing comp_ctx_lengths pass-through on the MoE full-model forwards (QEffQwen3_5MoeModel, QEffQwen3_5MoeForConditionalGeneration) to match the non-MoE variant. - Allow decode-only CCL specialization (gate -> OR, guard prefill loop). Qwen3.5-VL (modeling_qwen3_vl.py, modeling_qwen3_vl_moe.py): - Allow decode-only CCL specialization and guard both prefill/decode loops with `or []` to avoid a TypeError when one list is None (disaggregated serving). Examples (gemma4_example.py, gemma4_utils.py): - Carry comp_ctx_lengths_prefill/decode through build_compile_kwargs and document CCL activation in the example. Signed-off-by: Vahid Janfaza <vjanfaza@qti.qualcomm.com>
Contributor
|
Can you please update the example script for one of the QWEN3 or QWEN3.5 model for CCL. Also do post the results in the comments after execution via QEfficient. |
quic-hemagnih
requested changes
Jul 17, 2026
quic-hemagnih
left a comment
Contributor
There was a problem hiding this comment.
Can you post the execution results via QEFF, and update one of the QWEN3/3.5 example script
Document how to activate the compute-context-length (CCL) feature in the
image-text-to-text example scripts: pass qaic_config={"ccl_enabled": True}
at from_pretrained and comp_ctx_lengths_prefill / comp_ctx_lengths_decode
to compile().
- gemma4_example.py: update the CCL sample lists.
- qwen3_5/qwen3_5.py, qwen3_5_moe/qwen3_5_moe.py: enable CCL and pass the
CCL lists into both the text-only and vision+text compile() calls.
- qwen3_vl_moe/qwen3_vl_moe.py: enable CCL and pass the CCL lists into
both compile() calls.
- qwen3vl/qwen3_vl.py: add commented CCL activation as a reference.
Signed-off-by: Vahid Janfaza <vjanfaza@qti.qualcomm.com>
Contributor
Author
I added CCL related changes but they are commented by default |
Refresh the commented-out compute-context-length (CCL) sample lists in the image-text-to-text example scripts. CCL stays deactivated by default (the qaic_config ccl_enabled block and comp_ctx_lengths_* compile args remain commented out); users uncomment them to enable CCL. Note that CCL requires use_onnx_subfunctions=False. Files: gemma4_example.py, qwen3_5/qwen3_5.py, qwen3_5_moe/qwen3_5_moe.py, qwen3_vl_moe/qwen3_vl_moe.py, qwen3vl/qwen3_vl.py Signed-off-by: Vahid Janfaza <vjanfaza@qti.qualcomm.com>
Contributor
Author
I have created the following confluence page: |
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.
Enable the compute-context-length (CCL) feature for the Gemma4 and Qwen3.5 image-text-to-text model families and fix CCL specialization gating so it also works for disaggregated (separate prefill/decode) serving.
Gemma4 (modeling_gemma4.py):
Qwen3.5 (modeling_qwen3_5.py, modeling_qwen3_5_moe.py):
Qwen3.5-VL (modeling_qwen3_vl.py, modeling_qwen3_vl_moe.py):
or []to avoid a TypeError when one list is None (disaggregated serving).Examples (gemma4_example.py, gemma4_utils.py):
Important points to consider:
https://jira-dc.qualcomm.com/jira/browse/QRANIUMSW-63142