Skip to content

fix(xpu): read enable_deterministic_inference from the config bag - #36149

Merged
ShangmingCai merged 1 commit into
sgl-project:mainfrom
ShangmingCai:fix/xpu-deterministic-chain-read
Aug 24, 2026
Merged

ShangmingCai merged 1 commit into
sgl-project:mainfrom
ShangmingCai:fix/xpu-deterministic-chain-read

Conversation

@ShangmingCai

@ShangmingCai ShangmingCai commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

test/registered/unit/test_chain_read_ratchet.py is currently failing on main:

AssertionError: Lists differ: ['srt/layers/attention/xpu_backend.py:109 ...'] != []

First extra element 0:
'srt/layers/attention/xpu_backend.py:109 model_runner.server_args.enable_deterministic_inference'

XPUAttentionBackend.__init__ reaches the startup record through another object (model_runner.server_args) for a value that resolution decides, so it answers with the raw CLI default once the record stays raw.

This looks like a merge race: #29143 added the num_splits block using the pre-migration spelling while the config-bag migration (#35907 / #35910) landed alongside it. Every other attention backend already reads this field through get_exec().deterministic — dsa_backend.py:316, flashattention_backend.py:320, flashinfer_backend.py:409, triton_backend.py:292, linear/gdn_backend.py:75 — so XPU was the last holdout, and it is the only borrowed-record chain read of a resolution-written field left in srt/.

Modifications

Read enable_deterministic_inference from the config bag instead of the borrowed record:

self.num_splits = (
    1 if get_exec().deterministic.enable_deterministic_inference else 0
)

plus the corresponding get_exec import. One line of behavior, matching the fa3 backend the surrounding comment already points at.

Accuracy Tests

No output change on the default path: enable_deterministic_inference defaults to off, and both spellings read the same field — the config bag simply returns the resolved value rather than the CLI default. With the flag on, XPU now actually pins num_splits = 1 in the case where resolution would have set it, which is the intent of #29143.

Speed Tests and Profiling

N/A — a startup-time config read, not on any hot path.

Checklist

The existing ratchet test is the unit test for this — it goes green with this change and no new test is needed.

🤖 Generated with Claude Code


CI States

Latest PR Test (Base): ❌ Run #32694848718
Latest PR Test (Extra): ❌ Run #32694848571
Latest PR Test (AMD ROCm 7.2): ❌ Run #32694848660

XPUAttentionBackend.__init__ reads enable_deterministic_inference off the
borrowed startup record (model_runner.server_args), which answers with the
raw CLI default rather than the resolved value. Every other attention
backend already reads it through get_exec().deterministic -- dsa,
flashattention, flashinfer, triton, and linear/gdn -- so XPU was the last
holdout.

This also turns test/registered/unit/test_chain_read_ratchet.py red on
main: it is the only borrowed-record chain read of a resolution-written
field left in srt/.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@ShangmingCai

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/unit/test_chain_read_ratchet.py

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/unit/test_chain_read_ratchet.py:

🚀 ubuntu-latest (1 test): ✅ View workflow run

cd test/ && python3 registered/unit/test_chain_read_ratchet.py

@ShangmingCai
ShangmingCai merged commit 852b04b into sgl-project:main Aug 24, 2026
104 of 120 checks passed
@ShangmingCai
ShangmingCai deleted the fix/xpu-deterministic-chain-read branch August 24, 2026 05:56
longxin9715 added a commit to longxin9715/sglang that referenced this pull request Aug 24, 2026
…n-transport1

* 'main' of https://github.com/sgl-project/sglang: (326 commits)
  [diffusion] feat: cache LoRA-merged weights in files the page cache can hold (sgl-project#36062)
  [diffusion] Speed up LingBot high-quality VAE decode (sgl-project#36024)
  [diffusion] Honor XDG cache for model overlays (sgl-project#36019)
  Support streaming session on NPU (sgl-project#32597)
  fix(xpu): read enable_deterministic_inference from the config bag (sgl-project#36149)
  xeon ci fail fast strategy change (sgl-project#36146)
  [diffusion] Fix Hunyuan QKV pack indexing at production video shapes (sgl-project#36009)
  [diffusion] Refresh quality and BCG benchmark skills (sgl-project#36016)
  [MoE] Gather the cutlass MoE activation and its scales in one launch (sgl-project#34915)
  [diffusion] feat: add plain component weight overrides (sgl-project#36086)
  [diffusion] feat: support loading mixed w4a8 text encoders (sgl-project#36037)
  [diffusion] Default Hunyuan VAE to tiled decode (sgl-project#36012)
  fix(xpu): enable compressed-tensors FP8 W8A8 on XPU (RedHatAI FP8-dynamic models) (sgl-project#33057)
  chore: move cuda_vmm_utils.py under srt/utils/ (sgl-project#36053)
  [Intel XPU] Add xpu pass for biased_topk and hash_topk (sgl-project#33323)
  [CPU] Fix NUMA/core binding for DP ranks (sgl-project#32856)
  [Fix] Harden FlashAttention CUDA graph metadata bounds (sgl-project#35454)
  [XPU] Use a fused GDN kernel from sgl-kernel for Qwen3.5 (sgl-project#33354)
  [diffusion] Fuse LongCat-Image QKNorm and interleaved RoPE (sgl-project#35995)
  [diffusion] Keep LongLive2 components resident on large GPUs (sgl-project#35993)
  ...

# Conflicts:
#	python/sglang/srt/multimodal/processors/base_processor.py
#	python/sglang/srt/server_args.py
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.

1 participant