Skip to content

[Fix] sampling: deterministic top-p / top-k renorm when tp_size > 1 (TP rank divergence in DFlash/DSpark) - #38565

Merged
Fridge003 merged 2 commits into
sgl-project:mainfrom
gilfordting:fix/deterministic-renorm
Oct 31, 2026
Merged

Fridge003 merged 2 commits into
sgl-project:mainfrom
gilfordting:fix/deterministic-renorm

Conversation

@gilfordting

@gilfordting gilfordting commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

flashinfer's default top-p / top-k renorm kernels are non-deterministic (float atomicAdd); because of this, TP ranks that renormalize the same logits can produce different results. Every consumer of this output (plain sampler, spec-verify) samples against a deterministic coin and commits the result to per-rank KV/radix state. A coin that lands in between the cross-rank gap causes divergence across ranks, and NCCL collectives hang.

Previous PRs (#33549, #33289; #33614) work around this issue by broadcasting rank 0's decision. This PR addresses the root cause and avoids an extra collective, by routing the renorm through flashinfer's is_deterministic=True variants. This is turned on where it matters:

configuration renorm kernels why
single rank fast nothing to agree with
attn_tp_size > 1 deterministic each rank computes the same result; bit-identical across ranks
--enable-deterministic-inference deterministic self-explanatory
SGLANG_RENORM_DETERMINISTIC=1 / 0 forced on / off explicit override

Repro + results are below. With all relevant broadcasts turned off, the fast kernels reproduce the hang on H100 and B200 in every run. The deterministic kernels never diverge, and the end-to-end cost to TPOT is marginal.

Root cause

  • sgl_kernel.top_p_renorm_prob and top_k_renorm_prob forward to flashinfer.
  • In non-greedy verification, each rank compares its own target_probs (top-p/top-k output) against a shared coin and samples the bonus token from relu(q - p).
    • If ranks differ slightly, the coin might cross the acceptance or bonus thresholds on some ranks and not others; this will cause KV state to drift and a later prefix match will cause NCCL collectives to hang.
  • The sampler's min_p path calls the same kernels with no broadcast (SGLANG_SYNC_TOKEN_IDS_ACROSS_TP is off by default).
  • Earlier synthetic repros were clean because they used top_p=1.0, which skips the kernel entirely.

Repro

Setup

  • Image: current main (nightly ed8c3139, flashinfer 0.7.1, sgl_kernel 0.4.10) with this PR applied.
  • Model, config, workload: TP=2 DFlash, Llama-3.1-8B + z-lab/LLaMA3.1-8B-Instruct-DFlash-UltraChat, temperature=1.0, top_p=0.9, 32 concurrent multi-turn streams, fp8 KV.
  • Broadcast collectives off:
  • Deterministic renorm kernels on using a new environment variable, SGLANG_RENORM_DETERMINISTIC=1.
  • A probe all-gathers per-verify-step fingerprints of {rng state, prefix_lens, draft_tokens, target_logits, target_probs, accept_len, bonus, commit_lens, out_tokens} and reports the first field that differs.
    • It also calls top_p_renorm_prob twice on the same input on one rank, counting mismatches after.

Results

"knob" below refers to the new env-var, SGLANG_RENORM_DETERMINISTIC=1.

broadcast renorm runs requests per run first cross-rank target_probs difference rank-local mismatches (top-p calls) outcome
off fast (knob=0, same kernels as main) 4 x H100, 2 x B200 1.4k to 6.5k 1 to 22 s 0.4 to 0.9 % all 6 hung, at 190 to 610 s
off deterministic (knob=1) 3 x H100, 2 x B200 22.6k to 35.4k never 0 of 276,000 all 5 clean, full 30 min
all (#33614) fast (knob=0) 1 x H100 25.2k 14 s 0.9 % clean: 436 target_probs divergences, none reaches a token
all (#33614) deterministic (knob=1) 1 x H100 24.4k never 0 of 46,000 clean, 0 divergences

Every fast-kernel run with the broadcast off hung, with the same recorded chain each time:

  • target_probs differs between ranks while logits, prefix_lens and RNG are identical.
  • bonus / out_tokens differ on one rank.
  • Next step's draft_tokens differ.
  • Hang.

Toggling only the knob to 1 on the same image, model, load and probe consistently results in zero divergences, zero rank-local mismatches, and no hang.

Kernel measurements

We perform 99 repeated calls on byte-identical input. Settings: flashinfer 0.7.1, vocab 128256, H100. B200 and B300 give the same results.

nondet refers to calls that differ from call 0.

rows input distribution kernel current default is_deterministic=True
32 flat top-p 0.136 ms, nondet 99/99 0.169 ms, 0/99
32 peaky top-p 0.127 ms, 0/99 0.149 ms, 0/99
32 flat top-k 0.042 ms, 99/99 0.042 ms, 0/99
32 peaky top-k 0.042 ms, 77/99 0.042 ms, 0/99
256 flat top-p 0.603 ms, 98/99 0.815 ms, 0/99
256 flat top-k 0.288 ms, 99/99 0.289 ms, 0/99

We observe the following:

  • Top-k performs near-identical between both fast and deterministic arms.
  • Top-p adds 20 to 45% to a 0.1 to 0.8 ms kernel. We measure how much this matters in the next section.
  • The deterministic wrapper adds no host sync and no cudaMalloc, so there is no overhead.

End-to-end speed

Setup

  • Workload: sglang.bench_serving, random 512-in / 256-out, 400 prompts, concurrency 32.
  • Model, config: Llama-3.1-8B, fp8 KV, triton attention, H100.
  • One container boots four servers in sequence with the knob 1 / 0 / 1 / 0, two trials each, so both arms share a host and an image.
  • We look at TPOT, since this code change is exercised during decode. The first trial (warmup) is dropped, and we calculate mean TPOT. We see that differences are on the order of 0.01 ms.
config knob=1 knob=0 delta accept len
plain TP2 min_p=0.05 (the path the default policy makes deterministic), host A 4.974 ms 4.976 ms -0.0 %
same, host B, order 0 / 1 / 0 / 1 5.058 ms 5.062 ms -0.1 %
plain TP1 min_p=0.05 8.065 ms 8.067 ms -0.0 %
DFlash TP2 top_p=0.9 (knob=1 forces the verify path deterministic too) 3.992 ms 3.983 ms +0.2 % 4.563 / 4.564
EAGLE3 TP2 top_p=0.9 7.191 ms 7.175 ms +0.2 % 1.929 / 1.930

Thus, we see that there is no measureable end-to-end cost, including the forced-deterministic verify path; the accept length is also unchanged.

The renorm kernel runs once per step over batch_size rows (sampler) or batch_size x draft_tokens rows (verify), so deterministic top-p adds ~0.03 ms at 32 rows and ~0.2 ms at 256 rows, which is small compared to a step of several ms.

Modifications

  • python/sglang/srt/layers/sampling_renorm.py (new):
    • renorm_deterministic(ranks_agree) policy.
    • top_p_renorm_prob / top_k_renorm_prob for the sampler and spec_top_p_renorm_prob / spec_top_k_renorm_prob for verify, calling flashinfer with is_deterministic=True when appropriate (sgl_kernel as before otherwise).
    • The flag's presence is checked once at import (inspect.signature), so an older flashinfer degrades to the fast kernel rather than failing on the first sampled request.
    • Without flashinfer (MUSA, XPU) sgl_kernel's own single-CTA kernel is already deterministic; no int32-sensitive code is added there.
  • layers/sampler.py, speculative/dflash_utils.py, speculative/eagle_utils.py are the only renorm call sites, and now they import from the module above.
    • The _sync_token_ids_across_tp and spec_tp_sync.py comments name the renorm kernels as a known source of nondeterminism and point at the knob.
  • environ.py: SGLANG_RENORM_DETERMINISTIC next to the other determinism knobs.
  • test/registered/kernels/ops/sampling/test_renorm.py: existing correctness tests run through the new module; regression tests call each deterministic renorm 30 times on a flat 256 x 128256 input and assert bit-identical output (the default kernels fail this 30 of 30); scoped runtime-context fixture.
  • test/registered/unit/sampling/test_renorm_policy.py (CPU): single rank fast; TP=2 sampler deterministic and verify fast; --enable-deterministic-inference forces on; env overrides both ways.

The fix lives in sglang rather than the sgl_kernel wrappers, because sglang-kernel ships as a pinned prebuilt wheel. A wrapper change there is not testable in CI, and is not delivered until the next kernel release.

This fix is Complementary to #33614: the broadcast keeps replicated state safe against any future non-deterministic operator. This removes the one we found, so rank 0's own output and every other consumer of target_probs (logprobs, sampling masks) become reproducible too.

Checklist


CI States

Latest PR Test (Base): ✅ Run #40984177426
Latest PR Test (Extra): ❌ Run #40984177227
Latest PR Test (AMD ROCm 10): ⏳ Run #40984177258

@gilfordting

Copy link
Copy Markdown
Contributor Author

/rerun-test registered/kernels/ops/moe/test_renorm.py registered/sampling/test_sampling_mask.py registered/core/test_basic_sanity_dflash.py registered/core/test_basic_sanity_dspark.py registered/core/test_basic_sanity_eagle3.py registered/spec/dflash/test_dflash.py registered/spec/eagle/test_eagle_reject_sampling.py registered/spec/eagle/test_spec_eagle.py registered/spec/dspark/test_dspark_kernel_parity.py

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test registered/kernels/ops/moe/test_renorm.py registered/sampling/test_sampling_mask.py registered/core/test_basic_sanity_dflash.py registered/core/test_basic_sanity_dspark.py registered/core/test_basic_sanity_eagle3.py registered/spec/dflash/test_dflash.py registered/spec/eagle/test_eagle_reject_sampling.py registered/spec/eagle/test_spec_eagle.py registered/spec/dspark/test_dspark_kernel_parity.py:

🚀 1-gpu-h100 (2 tests): ❌ View workflow run

cd test/ && python3 registered/kernels/ops/moe/test_renorm.py
cd test/ && python3 registered/core/test_basic_sanity_dspark.py

🚀 1-gpu-5090 (6 tests): ✅ View workflow run

cd test/ && python3 registered/sampling/test_sampling_mask.py
cd test/ && python3 registered/core/test_basic_sanity_dflash.py
cd test/ && python3 registered/core/test_basic_sanity_eagle3.py
cd test/ && python3 registered/spec/dflash/test_dflash.py
cd test/ && python3 registered/spec/eagle/test_spec_eagle.py
cd test/ && python3 registered/spec/dspark/test_dspark_kernel_parity.py

🚀 2-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/spec/eagle/test_eagle_reject_sampling.py

@gilfordting gilfordting changed the title [Kernel] Make top-p / top-k renorm deterministic by default (fixes TP rank divergence in DFlash/DSpark) [Sampling] Deterministic top-p / top-k renorm by default (fixes TP rank divergence in DFlash/DSpark) Sep 8, 2026
@gilfordting
gilfordting force-pushed the fix/deterministic-renorm branch from bad0bb3 to f063d4c Compare September 8, 2026 21:52
@gilfordting

Copy link
Copy Markdown
Contributor Author

/rerun-group unit/mem_cache

@gilfordting

Copy link
Copy Markdown
Contributor Author

/rerun-group unit/observability

@gilfordting

Copy link
Copy Markdown
Contributor Author

/rerun-test test_metrics.py test_radix_cache_hit.py test_unified_radix_cache_kl_full.py test_hicache_variants.py test_hicache_storage.py

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-group unit/mem_cache:

🚀 1-gpu-5090 (18 tests): ✅ View workflow run

cd test/ && python3 registered/unit/mem_cache/test_asymmetric_mha_pool.py
cd test/ && python3 registered/unit/mem_cache/test_decode_retraction_backup.py
cd test/ && python3 registered/unit/mem_cache/test_dsa_pool_host_unit.py
cd test/ && python3 registered/unit/mem_cache/test_hicache_load_back_timing.py
cd test/ && python3 registered/unit/mem_cache/test_hicache_nixl_storage.py
cd test/ && python3 registered/unit/mem_cache/test_hiradix_cache_unit.py
cd test/ && python3 registered/unit/mem_cache/test_mamba_path_state_cap.py
cd test/ && python3 registered/unit/mem_cache/test_mamba_unittest.py
cd test/ && python3 registered/unit/mem_cache/test_minimax_sparse_pool_host_unit.py
cd test/ && python3 registered/unit/mem_cache/test_radix_cache_unit.py
cd test/ && python3 registered/unit/mem_cache/test_rust_unified_radix_cache_bench.py
cd test/ && python3 registered/unit/mem_cache/test_rust_unified_radix_cache_unittest.py
cd test/ && python3 registered/unit/mem_cache/test_swa_lock_release_lifecycle.py
cd test/ && python3 registered/unit/mem_cache/test_unified_handout_zeroing.py
cd test/ && python3 registered/unit/mem_cache/test_unified_mla_block_table.py
cd test/ && python3 registered/unit/mem_cache/test_unified_mla_gpu_parity.py
cd test/ && python3 registered/unit/mem_cache/test_unified_radix_cache_bench.py
cd test/ && python3 registered/unit/mem_cache/test_unified_radix_cache_unittest.py

🚀 ubuntu-latest (75 tests): ✅ View workflow run

cd test/ && python3 registered/unit/mem_cache/test_asymmetric_mha_pool_host_unit.py
cd test/ && python3 registered/unit/mem_cache/test_buffer_mode_sidecar.py
cd test/ && python3 registered/unit/mem_cache/test_decode_radix_lock_ref.py
cd test/ && python3 registered/unit/mem_cache/test_dllm_fdfo_kv_reuse.py
cd test/ && python3 registered/unit/mem_cache/test_dsa_layer_shard_utils.py
cd test/ && python3 registered/unit/mem_cache/test_dsv4_c4_state_lifecycle.py
cd test/ && python3 registered/unit/mem_cache/test_dsv4_compress_write_pad.py
cd test/ && python3 registered/unit/mem_cache/test_embedding_cache_controller.py
cd test/ && python3 registered/unit/mem_cache/test_evict_policy.py
cd test/ && python3 registered/unit/mem_cache/test_flashkda_strided_state_access.py
cd test/ && python3 registered/unit/mem_cache/test_full_loc_fast_path.py
cd test/ && python3 registered/unit/mem_cache/test_hicache_dcp_host_pool.py
cd test/ && python3 registered/unit/mem_cache/test_hicache_file_lru_unit.py
cd test/ && python3 registered/unit/mem_cache/test_hicache_host_register.py
cd test/ && python3 registered/unit/mem_cache/test_hicache_nixl_cleaner.py
cd test/ && python3 registered/unit/mem_cache/test_hicache_staged_write_back_dispatch.py
cd test/ && python3 registered/unit/mem_cache/test_hiradix_pp_sync_drain.py
cd test/ && python3 registered/unit/mem_cache/test_hisparse_allocator.py
cd test/ && python3 registered/unit/mem_cache/test_hisparse_max_token_pool_size.py
cd test/ && python3 registered/unit/mem_cache/test_hybrid_pool_assembler.py
cd test/ && python3 registered/unit/mem_cache/test_inkling_sconv_strided_conv_state.py
cd test/ && python3 registered/unit/mem_cache/test_kda_fused_decode_strided_state.py
cd test/ && python3 registered/unit/mem_cache/test_kv_index_translator.py
cd test/ && python3 registered/unit/mem_cache/test_layout_compat.py
cd test/ && python3 registered/unit/mem_cache/test_linker_pool_assembler.py
cd test/ && python3 registered/unit/mem_cache/test_mamba_donated_alloc_ratio.py
cd test/ && python3 registered/unit/mem_cache/test_mamba_state_transfer_buffers.py
cd test/ && python3 registered/unit/mem_cache/test_mem_cache_utils.py
cd test/ && python3 registered/unit/mem_cache/test_mem_pool_host.py
cd test/ && python3 registered/unit/mem_cache/test_minimax_sparse_pool_pd_unit.py
cd test/ && python3 registered/unit/mem_cache/test_mla_host_dedup_primitives.py
cd test/ && python3 registered/unit/mem_cache/test_mmap_allocator.py
cd test/ && python3 registered/unit/mem_cache/test_mooncake_group_semantics.py
cd test/ && python3 registered/unit/mem_cache/test_mooncake_standalone_dummy_mamba.py
cd test/ && python3 registered/unit/mem_cache/test_mooncake_tenant_config.py
cd test/ && python3 registered/unit/mem_cache/test_multi_ended_allocator.py
cd test/ && python3 registered/unit/mem_cache/test_mxfp8_scale_transfer_buffers.py
cd test/ && python3 registered/unit/mem_cache/test_page_major_layout.py
cd test/ && python3 registered/unit/mem_cache/test_paged_allocator_lazy_release.py
cd test/ && python3 registered/unit/mem_cache/test_paged_free_segment.py
cd test/ && python3 registered/unit/mem_cache/test_pd_envelope_transfer_layout.py
cd test/ && python3 registered/unit/mem_cache/test_pure_swa_chunk_cache.py
cd test/ && python3 registered/unit/mem_cache/test_quantized_kv_pool.py
cd test/ && python3 registered/unit/mem_cache/test_radix_cache_cpp_unit.py
cd test/ && python3 registered/unit/mem_cache/test_radix_cache_slru_accuracy.py
cd test/ && python3 registered/unit/mem_cache/test_radix_force_miss.py
cd test/ && python3 registered/unit/mem_cache/test_registry.py
cd test/ && python3 registered/unit/mem_cache/test_replayssm_ring_accounting.py
cd test/ && python3 registered/unit/mem_cache/test_retraction_mamba_backup.py
cd test/ && python3 registered/unit/mem_cache/test_rust_tree_core.py
cd test/ && python3 registered/unit/mem_cache/test_rust_tree_core_integration.py
cd test/ && python3 registered/unit/mem_cache/test_session_token_share_unit.py
cd test/ && python3 registered/unit/mem_cache/test_session_unified_radix_cache.py
cd test/ && python3 registered/unit/mem_cache/test_streaming_session_unit.py
cd test/ && python3 registered/unit/mem_cache/test_swa_alloc_extend_page_estimation.py
cd test/ && python3 registered/unit/mem_cache/test_swa_cpu_copy_filter.py
cd test/ && python3 registered/unit/mem_cache/test_swa_locked_full_recover_unified.py
cd test/ && python3 registered/unit/mem_cache/test_swa_pool_v_head_dim.py
cd test/ && python3 registered/unit/mem_cache/test_tree_core_registry.py
cd test/ && python3 registered/unit/mem_cache/test_umbp_host_allocator.py
cd test/ && python3 registered/unit/mem_cache/test_unified_byte_accounting.py
cd test/ && python3 registered/unit/mem_cache/test_unified_byte_budget_sizing.py
cd test/ && python3 registered/unit/mem_cache/test_unified_cache_linker.py
cd test/ && python3 registered/unit/mem_cache/test_unified_capacity_memo.py
cd test/ && python3 registered/unit/mem_cache/test_unified_free_no_host_sync.py
cd test/ && python3 registered/unit/mem_cache/test_unified_mamba_views.py
cd test/ && python3 registered/unit/mem_cache/test_unified_mha_views.py
cd test/ && python3 registered/unit/mem_cache/test_unified_mla_views.py
cd test/ && python3 registered/unit/mem_cache/test_unified_npool_sweep.py
cd test/ && python3 registered/unit/mem_cache/test_unified_radix_allocation_eviction.py
cd test/ && python3 registered/unit/mem_cache/test_unified_radix_hicache_dispatch.py
cd test/ && python3 registered/unit/mem_cache/test_unified_radix_lock_ref.py
cd test/ && python3 registered/unit/mem_cache/test_unified_swa_shared_virtual_ids.py
cd test/ && python3 registered/unit/mem_cache/test_unified_tri_pool.py
cd test/ && python3 registered/unit/mem_cache/test_uno_allocation_sizing.py

🚀 4-gpu-b200 (1 test): ✅ View workflow run

cd test/ && python3 registered/unit/mem_cache/test_dsa_layer_split_broadcast.py

🚀 1-gpu-h100 (2 tests): ✅ View workflow run

cd test/ && python3 registered/unit/mem_cache/test_swa_eviction_boundary.py
cd test/ && python3 registered/unit/mem_cache/test_swa_unittest.py

⛔ registered/unit/mem_cache/test_umbp_store.py: test/registered/unit/mem_cache/test_umbp_store.py is registered for AMD (suite stage-a-test-1-gpu-small-amd), not for CUDA or CPU; rerun-test.yml has no AMD job. Rerun it with /rerun-failed-ci, or dispatch the AMD workflow manually.

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-group unit/observability:

🚀 ubuntu-latest (12 tests): ✅ View workflow run

cd test/ && python3 registered/unit/observability/test_cpu_monitor.py
cd test/ && python3 registered/unit/observability/test_forward_pass_metrics.py
cd test/ && python3 registered/unit/observability/test_func_timer.py
cd test/ && python3 registered/unit/observability/test_label_transform.py
cd test/ && python3 registered/unit/observability/test_metrics_utils.py
cd test/ && python3 registered/unit/observability/test_ray_wrappers.py
cd test/ && python3 registered/unit/observability/test_req_time_stats.py
cd test/ && python3 registered/unit/observability/test_request_metrics_exporter.py
cd test/ && python3 registered/unit/observability/test_scheduler_stage_metrics.py
cd test/ && python3 registered/unit/observability/test_startup_func_log_and_timer.py
cd test/ && python3 registered/unit/observability/test_stat_loggers_di.py
cd test/ && python3 registered/unit/observability/test_trace.py

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_metrics.py test_radix_cache_hit.py test_unified_radix_cache_kl_full.py test_hicache_variants.py test_hicache_storage.py:

🚀 1-gpu-5090 (3 tests): ✅ View workflow run

cd test/ && python3 registered/observability/test_metrics.py
cd test/ && python3 registered/radix_cache/test_radix_cache_hit.py
cd test/ && python3 registered/hicache/test_hicache_storage.py

🚀 2-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_full.py

🚀 1-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/hicache/test_hicache_variants.py

@gilfordting

Copy link
Copy Markdown
Contributor Author

/rerun-test registered/kernels/ops/moe/test_renorm.py registered/sampling/test_sampling_mask.py registered/core/test_basic_sanity_dflash.py registered/core/test_basic_sanity_dspark.py registered/core/test_basic_sanity_eagle3.py registered/spec/dflash/test_dflash.py registered/spec/eagle/test_eagle_reject_sampling.py registered/spec/eagle/test_spec_eagle.py registered/spec/dspark/test_dspark_kernel_parity.py

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test registered/kernels/ops/moe/test_renorm.py registered/sampling/test_sampling_mask.py registered/core/test_basic_sanity_dflash.py registered/core/test_basic_sanity_dspark.py registered/core/test_basic_sanity_eagle3.py registered/spec/dflash/test_dflash.py registered/spec/eagle/test_eagle_reject_sampling.py registered/spec/eagle/test_spec_eagle.py registered/spec/dspark/test_dspark_kernel_parity.py:

🚀 1-gpu-h100 (2 tests): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/moe/test_renorm.py
cd test/ && python3 registered/core/test_basic_sanity_dspark.py

🚀 1-gpu-5090 (6 tests): ✅ View workflow run

cd test/ && python3 registered/sampling/test_sampling_mask.py
cd test/ && python3 registered/core/test_basic_sanity_dflash.py
cd test/ && python3 registered/core/test_basic_sanity_eagle3.py
cd test/ && python3 registered/spec/dflash/test_dflash.py
cd test/ && python3 registered/spec/eagle/test_spec_eagle.py
cd test/ && python3 registered/spec/dspark/test_dspark_kernel_parity.py

🚀 2-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/spec/eagle/test_eagle_reject_sampling.py

@gilfordting
gilfordting force-pushed the fix/deterministic-renorm branch from f063d4c to e8ee82d Compare September 8, 2026 23:41
@gilfordting

Copy link
Copy Markdown
Contributor Author

/rerun-test registered/kernels/ops/moe/test_renorm.py registered/sampling/test_sampling_mask.py registered/core/test_basic_sanity_dflash.py registered/core/test_basic_sanity_dspark.py registered/core/test_basic_sanity_eagle3.py registered/spec/dflash/test_dflash.py registered/spec/eagle/test_eagle_reject_sampling.py registered/spec/eagle/test_spec_eagle.py registered/spec/dspark/test_dspark_kernel_parity.py

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test registered/kernels/ops/moe/test_renorm.py registered/sampling/test_sampling_mask.py registered/core/test_basic_sanity_dflash.py registered/core/test_basic_sanity_dspark.py registered/core/test_basic_sanity_eagle3.py registered/spec/dflash/test_dflash.py registered/spec/eagle/test_eagle_reject_sampling.py registered/spec/eagle/test_spec_eagle.py registered/spec/dspark/test_dspark_kernel_parity.py:

🚀 1-gpu-h100 (2 tests): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/moe/test_renorm.py
cd test/ && python3 registered/core/test_basic_sanity_dspark.py

🚀 1-gpu-5090 (6 tests): ✅ View workflow run

cd test/ && python3 registered/sampling/test_sampling_mask.py
cd test/ && python3 registered/core/test_basic_sanity_dflash.py
cd test/ && python3 registered/core/test_basic_sanity_eagle3.py
cd test/ && python3 registered/spec/dflash/test_dflash.py
cd test/ && python3 registered/spec/eagle/test_spec_eagle.py
cd test/ && python3 registered/spec/dspark/test_dspark_kernel_parity.py

🚀 2-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/spec/eagle/test_eagle_reject_sampling.py

detain added a commit to detain/sglang that referenced this pull request Oct 20, 2026
…multicast probe in the gather-selection test

sgl-project#42863's selection tests predate sgl-project#41888's has_multicast_support() probe, which
now runs before the symmetric-memory rendezvous inside _build_multimem. Without
a stub they only pass on a multicast-capable host (the probe is real in the
test process), so sgl-project#38565's own CI would flip on hardware. Drive the probe from
the tests' existing multicast= knob and cover the claims-support-but-no-alias
case with the new probe= override.
detain added a commit to detain/sglang that referenced this pull request Oct 20, 2026
…/deferred/avoid map

- 3A [24-35]: NVFP4 MoE boot sgl-project#39807/sgl-project#40173, block-FP8 TP refine sgl-project#42566, k-pool indexer split sgl-project#43619,
  SM120 skinny GEMM sgl-project#42865/sgl-project#42867, DeepGEMM warmup guards sgl-project#32686/sgl-project#43712, autotune sgl-project#43363/sgl-project#40420,
  mHC overlap sgl-project#42985, FP8-einsum precompile sgl-project#42821.
- 3B [36-43]: PCIe CustomAllreduce VMM sgl-project#44448, EP local expert ids sgl-project#44480, shm TP broadcast sgl-project#44202,
  PCIe-IPC all-gather sgl-project#42863 + multicast guard sgl-project#41888, TP-sampling consistency sgl-project#41916/sgl-project#38565,
  draft embed/lm_head VRAM sgl-project#37155.
- sgl-project#39807 toolchain commit verified safe against our CUDA_HOME=12.9 pin (cu13 fallback needs CUDA_HOME unset AND glibc>=2.41; we are 2.39).
- stack_want.txt: execution-status banner. Branch tip 5dd6ec7.
@Fridge003

Copy link
Copy Markdown
Collaborator

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread python/sglang/srt/environ.py Resolved
@Fridge003

Copy link
Copy Markdown
Collaborator

Please fix conflicts

flashinfer's default top-p / top-k renorm kernels pool partial sums with
float atomics, so TP ranks can disagree in the last bits on identical
logits. A shared sampling coin that lands in that gap commits different
tokens on different ranks, and the ranks later wedge in a collective.

Route every renorm call (plain sampler, min_p path, EAGLE / DFlash /
DSpark verify) through one policy module that picks flashinfer's
is_deterministic=True variants whenever the TP group has more than one
rank, or under --enable-deterministic-inference. A single rank keeps the
fast kernels. The fast fallbacks come from the per-platform table in
kernels/ops/sampling/renorm.py, which gains an XPU entry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@gilfordting
gilfordting force-pushed the fix/deterministic-renorm branch from 53c104d to c33aeb0 Compare October 30, 2026 00:15
@gilfordting gilfordting changed the title [Fix] sampling: deterministic top-p / top-k renorm when attn_tp_size > 1 (TP rank divergence in DFlash/DSpark) [Fix] sampling: deterministic top-p / top-k renorm when tp_size > 1 (TP rank divergence in DFlash/DSpark) Oct 30, 2026
The sampling-mask capture tests build a bare Sampler and patch only the
sampler module's get_exec. The renorm policy reads the published parallel
and exec config on every call, so without a published config the first
top-k renorm raised "config namespace 'exec' not published". Install the
same scoped override the policy test uses (tp_size=1: fast kernels, as
before) for the lifetime of each test.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@gilfordting

Copy link
Copy Markdown
Contributor Author

/rerun-failed-ci

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jit-kernel run-ci CI: run the baseline test suite on this PR sgl-kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants