perf: route Qwen3.5 FSGDR model path to TileLang.#1889
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the NPU kernel implementation for fused_sigmoid_gating_delta_rule_update to use the TileLang wrapper fused_sigmoid_gating_delta_rule and adjusts the input tensor shapes in Qwen3GatedDeltaNetBaseImpl::forward by replacing .contiguous() with appropriate .reshape(...) calls. A critical issue was identified where attn_metadata.q_cu_seq_lens is not explicitly cast to torch::kInt32 before being passed to the kernel, which could lead to a runtime crash due to type assertions.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| processed_k.reshape({-1, processed_k.size(-2), processed_k.size(-1)}); | ||
| params.v = | ||
| processed_v.reshape({-1, processed_v.size(-2), processed_v.size(-1)}); | ||
| params.b = b.reshape({-1, b.size(-1)}); |
There was a problem hiding this comment.
The attn_metadata.q_cu_seq_lens tensor (assigned to params.cu_seqlens on line 863) is not guaranteed to be of type torch::kInt32 and can often be torch::kInt64/torch::kLong. However, the TileLang wrapper fused_sigmoid_gating_delta_rule has an explicit assertion CHECK_EQ(cu_seqlens.scalar_type(), torch::kInt32) which will fail and cause a runtime crash if a 64-bit integer tensor is passed. Please explicitly cast attn_metadata.q_cu_seq_lens to torch::kInt32 before calling .contiguous(), similar to how it is handled in other kernels (e.g., causal_conv1d_update or chunk_gated_delta_rule).
Description
This PR depends on #1873.
#1873 adds the TileLang implementation of the FSGDR operator. This PR routes the Qwen3.5 FSGDR model path from the existing Triton backend to the TileLang backend.
Main changes:
fused_sigmoid_gating_delta_rule_updateto the TileLang FSGDR wrapper.Validation Summary
Validated with Qwen3.5-27B TP4.
Accuracy
Performance
Synthetic streaming benchmark, 2048 input tokens / 1024 output tokens, 128 requests, max concurrency 16.
The summary below uses aggregate benchmark metrics. The raw per-request latency and throughput distributions are listed in the appendix.
The TileLang path improves end-to-end latency, TPOT/ITL, and aggregate output throughput in this setup. Average TTFT increases in this run.
Related Issues
Depends on #1873.
Change Type
Pull Request Checklist
Thank you for contributing to xLLM. Before requesting review, please make sure the following items are complete.
PR Title and Commit Messages
<type>: <subject>.Pre-commit Checks
pre-commitby runningpip install pre-commitor an equivalent command.pre-commit install.pre-commit run --all-filesand fixed any reported issues.Self Review
.agents/skills/code-review/references/custom-code-style.md, especially code written or assisted by AI.mainbranch.Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes
Please focus review on:
initial_state_source,initial_state_indices, andcu_seqlens.Appendix: Validation Details
xLLM Server Configuration
Launcher key settings:
NNODES=4MAX_SEQS_PER_BATCH=16MAX_CONCURRENT_REQUESTS=256MAX_TOKENS_PER_BATCH=8192MAX_MEMORY_UTILIZATION=0.7BLOCK_SIZE=128ENABLE_GRAPH=trueENABLE_GRAPH_MODE_DECODE_NO_PADDING=trueENABLE_SCHEDULE_OVERLAP=trueENABLE_CHUNKED_PREFILL=trueENABLE_PREFIX_CACHE=trueNPU_KERNEL_BACKEND=TORCHCOMMUNICATION_BACKEND=hcclPerformance Benchmark Configuration
Benchmark model config:
Qwen3.5-27Bxllm-qwen35-27b-general-streamignore_eos=true,temperature=0.0,top_p=1.0Raw Performance Metrics
TileLang FSGDR
Triton FSGDR (baseline)
Raw Accuracy Metrics
GSM8K:
C-Eval: