Skip to content

Add a note about triton version for older GPUs - #72

Merged
merrymercy merged 2 commits into
mainfrom
fix-triton
Jan 22, 2024
Merged

merrymercy merged 2 commits into
mainfrom
fix-triton

Conversation

@merrymercy

Copy link
Copy Markdown
Collaborator

No description provided.

@merrymercy
merrymercy merged commit cd3ccb2 into main Jan 22, 2024
@merrymercy
merrymercy deleted the fix-triton branch January 22, 2024 00:51
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
NorthmanPKU pushed a commit to NorthmanPKU/sglang that referenced this pull request May 16, 2025
* enable gated_mlp example

* fmt

---------

Co-authored-by: Mengdi Wu <[email protected]>
Co-authored-by: Zhihao Jia <[email protected]>
chunyuan-w pushed a commit to chunyuan-w/sglang that referenced this pull request May 20, 2025
pengchengneo pushed a commit to pengchengneo/sglang that referenced this pull request Jun 5, 2025
Co-authored-by: yanami_anna <[email protected]>
pi314ever pushed a commit to pi314ever/sglang that referenced this pull request Jul 10, 2025
* Update to latest vllm-hpu-extension-commit

* Update to latest vllm-hpu-extension-commit
blzheng added a commit to blzheng/sglang that referenced this pull request Sep 2, 2025
sammysun0711 pushed a commit to sammysun0711/sglang that referenced this pull request Dec 10, 2025
* add qwen3-omni ci

Signed-off-by: apinge <[email protected]>

* update sglang_benchmark_workflow.sh

* update indentation

Signed-off-by: apinge <[email protected]>

* add debug flag for ci

Signed-off-by: apinge <[email protected]>

---------

Signed-off-by: apinge <[email protected]>
vschandramourya pushed a commit to vschandramourya/sglang that referenced this pull request Feb 3, 2026
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
cen121212 pushed a commit to cen121212/sglang that referenced this pull request Mar 7, 2026
* bugfix for qwen35

* resolve lint
efschu added a commit to efschu/htsglang that referenced this pull request Jul 22, 2026
… beats llama.cpp)

Closes the last GGUF TP=2 gap from the sgl-project#69 investigation. The legacy
mul_mat_vec_q_nc kernel ran one warp per row walking every K-block
serially; for Q6_K (qi=32, vdr=1 -> 1 block/warp) that is a fully
serial dependent-load chain, and 32-thread blocks cap sm86 occupancy
-> the measured 322 GB/s (45% peak) at M=4 vs Q8_0's ~600 GB/s. The
tuned mul_mat_vec_q_nc_kq (faithful port of llama.cpp master's generic
mul_mat_vec_q: 4/2-warp K-split, 2 rows/block y-load amortization)
restores the parallel K-split. Gated by SGLANG_GGUF_KQ_KERNEL (default
on when the tuned wheel is present); legacy kernel is the kill-switch
fallback and stays bit-identical. Non-K-quant types and nvecs==1 stay
on the legacy path bit-identically.

Follow-on: with the tuned MMVQ now beating MMQ at every measured M, the
sgl-project#72 K-quant MMQ reroute (_kquant_prefers_mmq) is a regression for tuned
wheels -> gated off when the tuned kernel is active (probe op
ggml_mmvq_kq_tuned registered in common_extension.cc, detected via
hasattr + env in gguf.py). Requires a rebuilt sgl_kernel wheel (cu13,
archs 80;86;90;120a) for the tuned path; graceful legacy fallback
without.

Numerics: the K-split reorders accumulation -> declared divergence, NOT
bit-parity. Proven equivalent by teacher-forced argmax identity.

Validation (thermal-gated, GPUs 0 MiB after):
- Microbench Q6_K M=4 tuned vs legacy: RTX 3080 (sm86) 561 vs 322 GB/s
  (1.73x, >=550 target met); down-proj 3.22x; all M=2..8 win and now
  beat MMQ. RTX 5090 (sm120) 1981 vs 1138 (+74%).
- E2E decode Q6_K_XL MTP, D1 code/prose: TP=2 (2x3080) tuned
  88.38/72.22 vs legacy kill-switch 67.86/54.17 (+30%/+33%) -- beats
  llama.cpp 79.6; TP=3 uneven tuned 118.01/98.62 vs 91.1-class base
  (+29.5% code) -- far above llama.cpp's 74.5-79.6.
- Teacher-forced argmax identity tuned vs legacy: 100/100 positions,
  0 mismatches (the ~1e-4 divergence never flips greedy top-1 at
  identical context; 1024-tok long-forms cascade after a rare tie-flip
  = expected, sgl-project#66 class). accept-neutral, coherence perfect, conc-8
  8/8 no crash.
- 27B-FP8: structurally untouched (change is confined to the GGUF
  K-quant MMVQ path; FP8/compressed-tensors never call it) -- not
  E2E-run.

Note: TP=3 first boot OOM'd at graph capture with reserve 2048 ->
reserve 3500 + cuda-graph-max-bs-decode 8 fixes it (not a kernel
issue; the sgl-project#68/sgl-project#79 sizing class).
q2727 pushed a commit to q2727/sglang that referenced this pull request Aug 26, 2026
* feat(marlin): add DeepSeek V4 MXFP4 MoE backend

* feat(kt): pipeline MXFP4 layerwise prefill
luke396 added a commit to luke396/sglang that referenced this pull request Oct 28, 2026
--enable-mla-hicache-per-node keeps one MLA KV HiCache host copy per node.
SGLANG_MLA_HICACHE_PER_NODE_MODE now selects how followers get the KV:

- broadcast (default): unchanged sgl-project#72 behaviour. Followers keep an
  allocator-only host pool and the leader broadcasts each loaded layer
  over NCCL from the layer-wait hook.
- shm: the leader allocates the MLA host pool in a memfd (interleaved over
  the node's NUMA nodes by the existing leader_budget_scope) and sends the
  fd to same-host followers over an abstract Unix socket (SCM_RIGHTS).
  Every rank maps and pins the same pages and does its own H2D, so the
  forward path is the same as without the flag.

In both modes only the leader writes the shared copy: followers skip the
anchor D2H, use a page-get stub for L3 prefetch (the leader's count wins
through the existing all_reduce(MIN)), and do not register the buffer with
Mooncake. shm rejects --hicache-write-policy write_back at startup and on
attach-storage: write-back eviction syncs locally, so a follower could load
shared pages before the leader's D2H into them lands.

Also adds benchmark/hicache/bench_h2d_numa.py, which compares HiCache-style
page-gather H2D from one interleaved shared buffer against per-GPU private
local buffers, one process per GPU.

Not run: no GPU here; checked with py_compile, ruff and isort only.
luke396 added a commit to luke396/sglang that referenced this pull request Oct 28, 2026
* feat(hicache): keep one MLA KV host copy per node

MLA latent KV is identical on every TP rank, but each rank kept its own
HiCache host copy and read it from L3 on its own, so a 4-GPU node held
and fetched 4 copies of the same data.

With --enable-mla-hicache-per-node, only the first rank on each node
(leader) keeps a real MLA host pool and loads from L3; the other local
ranks use the allocator-only host pool from sgl-project#36800. During the forward,
the per-layer HiCache wait hook (as in sgl-project#42009) broadcasts each loaded
MLA layer from the leader to the local GPUs over NCCL/NVLink, so the
broadcast overlaps with compute. KDA/Mamba state, L3 keys and L3 layout
are unchanged, so existing L3 data stays valid.

The leader's host pool and budget are sized for the whole node; all
ranks size the allocator the same so the radix tree stays consistent.
PD decode, DCP, FP4 MLA and single-rank nodes fall back to per-rank
copies with a warning. The flag is off by default.

Co-Authored-By: Claude <[email protected]>

* fix(hicache): fix three node-leader MLA dedup bugs

Three bugs in the --enable-mla-hicache-per-node path.

1. Chunked-prefix prefill read prefix KV before the leader's broadcast

   A follower's device KV comes only from the leader's broadcast, and that
   broadcast is sent from the layer-wait hook (LayerDoneCounter.wait_until).
   The trtllm_mla eager prefill takes MHA_CHUNKED_KV and reads prefix KV
   through HybridLinearKVPool.get_mla_kv_buffer, which, unlike the other
   reads on that pool, did not wait. The inner MLA pool does not wait
   either: the hybrid pool clears its counter to None. So a follower read
   stale rows for that layer and gave wrong output with no error.

   get_mla_kv_buffer now waits on the model layer id before swapping in
   the compact id, as get_key_buffer does. This also fixes the same
   missing wait on H2D for the non-dedup path.

2. Explicit --hicache-ratio/--hicache-size could pin past host memory

   Followers build an allocator-only MLA pool with no memory check and
   go straight on to the Mamba host pool, whose check reads live free
   memory while the leader is still pinning. With an explicit size there
   is no budget snapshot, so an oversized config could fail while pinning
   (or be killed) instead of with "Not enough host memory available".

   Every rank now waits on a gloo barrier over the TP CPU group before
   the Mamba pool is built. Followers block until all leaders have
   pinned, so the check sees real free memory. Gloo, not NCCL, since
   pinning can outlast the NCCL watchdog. No new process group.

3. GB200/GB300: the leader's pool was sized for two Graces

   A tray has two Graces, each its own NUMA node, and the scheduler is
   membind-ed to its GPU's node. The leader's budget is the whole tray's
   free memory, but it can only pin from one Grace, so the default
   auto-sized pool asked for about twice what that node can give.

   auto_size_hicache halves the per-rank budget when the flag is on and
   is_mnnvl_fabric_device() is true; the MIN all-reduce keeps every
   rank's ratio equal. Limits: Mamba host capacity is halved too, and an
   explicit ratio/size is not covered.

Not run: no GPU available, only checked with py_compile.

Co-Authored-By: Claude <[email protected]>

* fix(hicache): interleave the MLA leader's host pool over its NUMA nodes

The previous commit fixed GB200/GB300 by halving the auto-size budget.
That was wrong in two ways:

- auto_size_hicache overrides the global hicache_ratio, and the Mamba
  host pool reads the same value (MambaPoolHost in
  build_hybrid_mamba_stack), so Mamba host capacity was halved too.
- An explicit --hicache-ratio/--hicache-size never reaches
  auto_size_hicache, so the leader still pinned the whole tray's share
  on one Grace.

The real constraint is per NUMA node, not per host. With the same
ratio, the tray's total is unchanged by this feature; what changed is
that the leader, membind-ed to its GPU's node, pins every follower's
share there. A GB300 tray has two Graces, each its own node, so the
leader's node took twice its share.

Spread the leader's MLA host pool over the nodes its ranks are bound
to instead:

- build_for_node all-gathers each rank's NUMA node and cpuset-allowed
  nodes over the TP CPU group. The node comes from
  get_numa_node_if_available, the same query the launcher binds with.
- leader_host_shares derives the multiplier from that layout, not a
  constant. If the group spans several nodes, every rank is bound and
  the leader may allocate on all of them, the pool is interleaved over
  them and the multiplier is (fewest ranks on a node) x (node count):
  2 x 2 = 4 on a GB300 tray. Even interleave puts the same amount on
  every node, so this keeps each node at or below its own ranks'
  share. A group on one node, or with NUMA binding off, keeps the
  group size and is not interleaved. If the leader cannot reach every
  node, or binding is mixed, it falls back to the ranks on its own
  node. The minimum over all groups is used so every rank sizes its
  allocator the same.
- numa_utils.interleave_memory sets MPOL_INTERLEAVE on the calling
  thread for the leader's pool build only, then restores the previous
  policy, mode flags included. It must wrap the allocation: the HiCache
  mmap is pre-faulted, so mbind afterwards would not move the pages. It
  raises if the policy cannot be set, since the pool was sized for it.
- leader_budget_scope uses the same multiplier and enters the
  interleave scope.

With the same ratio, no NUMA node holds more host memory than without
the flag. Mamba is unchanged, explicit ratio/size and auto-sizing are
both covered, and KV cache capacity stays 4x on GB300. L3 reads stay
at one per tray.

Trade-off: the leader's H2D now reads half its pages from the other
node (Grace-Grace link on GB300, the socket link on dual-socket x86).
Dual-socket x86 hosts with binding on are interleaved too, with the
multiplier going from 4 to 8. Neither link's bandwidth was measured.
Not checked: whether the Mooncake/UMBP host allocators fault pages in
this process, which the policy needs.

The halving in hicache_auto_size.py is reverted.

Not run: no GPU available, only checked with py_compile; the multiplier
and nodemask logic were checked on GB300, single-NUMA, dual-socket,
uneven and restricted-cpuset layouts in isolation.

Co-Authored-By: Claude <[email protected]>

* feat(hicache): add shm mode for per-node MLA host copy

--enable-mla-hicache-per-node keeps one MLA KV HiCache host copy per node.
SGLANG_MLA_HICACHE_PER_NODE_MODE now selects how followers get the KV:

- broadcast (default): unchanged sgl-project#72 behaviour. Followers keep an
  allocator-only host pool and the leader broadcasts each loaded layer
  over NCCL from the layer-wait hook.
- shm: the leader allocates the MLA host pool in a memfd (interleaved over
  the node's NUMA nodes by the existing leader_budget_scope) and sends the
  fd to same-host followers over an abstract Unix socket (SCM_RIGHTS).
  Every rank maps and pins the same pages and does its own H2D, so the
  forward path is the same as without the flag.

In both modes only the leader writes the shared copy: followers skip the
anchor D2H, use a page-get stub for L3 prefetch (the leader's count wins
through the existing all_reduce(MIN)), and do not register the buffer with
Mooncake. shm rejects --hicache-write-policy write_back at startup and on
attach-storage: write-back eviction syncs locally, so a follower could load
shared pages before the leader's D2H into them lands.

Also adds benchmark/hicache/bench_h2d_numa.py, which compares HiCache-style
page-gather H2D from one interleaved shared buffer against per-GPU private
local buffers, one process per GPU.

Not run: no GPU here; checked with py_compile, ruff and isort only.

* fix(hicache): tighten per-node MLA host sharing

Reject pipeline parallelism for per-node MLA HiCache and check mode agreement
on the WORLD CPU group before entering mode-specific collectives.

Close shared-buffer descriptors and bootstrap sockets on success and failure.
Derive the controller's follower role from the MLA host pool, skip unused
follower D2H staging, and avoid follower MLA existence queries while retaining
rank-sharded Mamba checks.

Add focused regression coverage, including cold/preloaded module identity
handling in the Mooncake fixtures.

Validation: Python compilation, formatting/import-order checks, no new Ruff
diagnostics, and isolated before/after source probes. Registered tests could
not collect because torch/msgspec are unavailable; GPU/distributed/Mooncake
integration remains untested.

* fix(hicache): bound the shm fd wait and guard one-shot setup

Three gaps in the per-node MLA HiCache startup path:

- A follower waited for the leader's shared host buffer with no timeout,
  so a stuck leader hung it forever. The wait now uses --dist-timeout,
  or 120 minutes (the gloo group default) when it is unset, and raises
  a RuntimeError that points at the leader's log.
- NodeSharedHostTensorAllocator closes its sockets after the first
  exchange, so a second allocate() raised IndexError on a follower and
  returned an unshared buffer on the leader. It now rejects a second
  call explicitly.
- In broadcast mode, the one-rank-per-node early return leaked the NCCL
  group it had just created. Every rank takes that return together, so
  each now destroys its own handle before returning.

Adds unit tests for all three.

Not run: torch is unavailable locally; checked with py_compile only.

Co-Authored-By: Claude <[email protected]>

* refactor(hicache): rework per-node MLA host sharing setup

Share one initialization path between broadcast and shm, replace the socket
handoff, fix L3 configuration at startup, and trim the feature to its
contracts.

- Both modes: the leader sizes a memfd without prefaulting it, followers
  reopen it via /proc/<pid>/fd/<fd>, each rank prefaults a contiguous
  page-aligned share with MADV_POPULATE_WRITE, and no rank registers before
  every share is populated. Broadcast followers then drop the mapping and
  keep dummy slot metadata. The leader's FD stays open until that fence;
  open and mapped-size failures abort every rank.
- Leave NUMA placement to deployment: remove the leader interleave, the NUMA
  benchmark and their helpers.
- With the flag on, reject runtime L3 attach/detach and policy updates.
  Reject at startup Mooncake standalone_storage, PD decode, DCP, stacks
  other than hybrid MLA + Mamba/KDA, and non-CUDA or FP4 MLA pools.
- Replace SGLANG_MLA_HICACHE_PER_NODE_MODE with
  --mla-hicache-per-node-mode {broadcast,shm}; drop the WORLD mode agreement.
- NodeSharedHostTensorAllocator takes this node's ranks and the cache group
  and derives its index, size and leader.
- Make host-pool parameters explicit and keep allocation fences in the
  assembler.
- Cover the hybrid MLA read waiting on its layer load.
- Trim tests to contract-level guards and comments to unstated contracts.

---------

Co-authored-by: yifei she <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: Nozom1ff <[email protected]>
Co-authored-by: Zhengbo Wang <[email protected]>
Nozom1ff pushed a commit to Nozom1ff/sglang that referenced this pull request Oct 29, 2026
--enable-mla-hicache-per-node keeps one MLA KV HiCache host copy per node.
SGLANG_MLA_HICACHE_PER_NODE_MODE now selects how followers get the KV:

- broadcast (default): unchanged sgl-project#72 behaviour. Followers keep an
  allocator-only host pool and the leader broadcasts each loaded layer
  over NCCL from the layer-wait hook.
- shm: the leader allocates the MLA host pool in a memfd (interleaved over
  the node's NUMA nodes by the existing leader_budget_scope) and sends the
  fd to same-host followers over an abstract Unix socket (SCM_RIGHTS).
  Every rank maps and pins the same pages and does its own H2D, so the
  forward path is the same as without the flag.

In both modes only the leader writes the shared copy: followers skip the
anchor D2H, use a page-get stub for L3 prefetch (the leader's count wins
through the existing all_reduce(MIN)), and do not register the buffer with
Mooncake. shm rejects --hicache-write-policy write_back at startup and on
attach-storage: write-back eviction syncs locally, so a follower could load
shared pages before the leader's D2H into them lands.

Also adds benchmark/hicache/bench_h2d_numa.py, which compares HiCache-style
page-gather H2D from one interleaved shared buffer against per-GPU private
local buffers, one process per GPU.

Not run: no GPU here; checked with py_compile, ruff and isort only.
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