Skip to content

Update version to v0.1.14 - #324

Merged
merrymercy merged 2 commits into
mainfrom
update-version
Mar 22, 2024
Merged

merrymercy merged 2 commits into
mainfrom
update-version

Conversation

@merrymercy

Copy link
Copy Markdown
Collaborator

No description provided.

@merrymercy
merrymercy merged commit 51104cd into main Mar 22, 2024
@merrymercy
merrymercy deleted the update-version branch March 22, 2024 20:42
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
vschandramourya pushed a commit to vschandramourya/sglang that referenced this pull request Feb 3, 2026
AndyLi429 pushed a commit to AndyLi429/sglang that referenced this pull request Apr 16, 2026
williamjameshandley added a commit to williamjameshandley/sglang that referenced this pull request May 8, 2026
…M through deepgemm-sm120

- paged_mqa_backend.py: sm_120 default flips from TRITON_SM120 to
  DEEP_GEMM. Add SGLANG_FP8_PAGED_MQA_LOGITS_TRITON_SM120 env as a
  sm_120-precondition debug fallback for the prior Triton kernel.
- compressed/metadata.py + indexer.py: reshape c4_seq_lens to 2-D
  [B, 1] when uses_deep_gemm_metadata(backend) is true. PR sgl-project#324
  csrc/apis/attention.hpp asserts context_lens.dim() == 2; the
  Torch / TRITON_SM120 / TileLang / HIP fallbacks consume the
  existing 1-D shape natively. Drop the JIT-metadata helper branch
  inside the deepgemm path (its 1-D output never reached anything
  on sm_120 anyway since the Triton wrapper ignores deep_gemm_metadata).
- fp8_utils.py initialize_fp8_gemm_config: sm_120 default flips from
  Triton to DeepGEMM. PR sgl-project#324 fp8_fp4_gemm_nt covers V4-Flash FP8
  block-GEMM shapes; live V4-Flash FP8 attention linears (wq_a,
  wq_b, wkv, wo_b), C4 indexer wq_b, and lm_head all reach this
  path on sm_120.
- environ.py SGLANG_OPT_FP8_WO_A_GEMM: default flips False -> True.
  V4 attention output projection routes through deep_gemm.fp8_einsum
  (already implemented; was env-gated off).
- environ.py SGLANG_OPT_BF16_FP32_GEMM_ALGO: env type fix EnvBool ->
  EnvStr("deep_gemm"). The prior EnvBool default never matched the
  string compares in linear_bf16_fp32, leaving cublas+deep_gemm
  branches both unreachable; live default fell through to torch FP32
  fallback. New default "deep_gemm" reaches deep_gemm.bf16_gemm_nt
  for the V4 compressor kv_score = linear_bf16_fp32(x, wkv_gate.weight)
  call at models/deepseek_v4.py:890.

Tensor-level harness _test_paged_mqa_logits_dg.py compares deepgemm
vs fp8_paged_mqa_logits_torch on V4-Flash-shaped synthetic inputs
(FP8 Q via act_quant semantics, fused weights, 2-D seq_lens for
deepgemm + 1-D for torch oracle). 4/4 PASS at abs <= 1.2e-4,
rel <= 1.4e-7 across B in {1,2,4} and max_seq_len in {256,512,1024}.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
williamjameshandley added a commit to williamjameshandley/sglang that referenced this pull request May 8, 2026
- New module srt/layers/mhc_deepgemm.py exposes:
  * deepgemm_hc_pre_gemm(x_flat, fn) -> (gemm_out, sqrsum):
    BF16 x FP32 -> FP32 GEMM with per-row sum-of-squares via
    deep_gemm.tf32_hc_prenorm_gemm. Same (out, sqrsum) contract as
    the Triton pre-GEMM that mhc_pre_big_fuse_triton consumes.
  * mhc_pre_deepgemm(residual, fn, hc_scale, hc_base, ...) -> (post,
    comb, layer_input): full resolved callable. Body calls
    deepgemm_hc_pre_gemm for the GEMM step; reuses
    mhc_pre_big_fuse_triton for the sinkhorn + per-head normalization
    + output combination step (deepgemm has no big_fuse equivalent).
  Lives in its own module to avoid the TileLang import at the top
  of srt/layers/mhc.py:5-6.

- models/deepseek_v4.py DeepseekV4DecoderLayer.__init__: refactor
  MHC binding precedence on sm_120:
    1. SGLANG_OPT_USE_TRITON_MHC=True  -> Triton MHC pre-GEMM.
    2. SGLANG_OPT_USE_TRITON_MHC=False -> legacy inline dispatch.
    3. Default (None) on sm_120        -> mhc_pre_deepgemm.
  Replaces the prior auto-pick where sm_120 + None bound to
  mhc_pre_triton; the deepgemm tf32_hc_prenorm_gemm branch in
  hc_pre() (gated by SGLANG_OPT_DEEPGEMM_HC_PRENORM=True default)
  was dead code on sm_120 because Triton bound first. MHC post stays
  on Triton (deepgemm has no MHC-post kernel in PR sgl-project#324).

- New harness _test_mhc_pre_deepgemm.py compares the deepgemm
  GEMM output against an FP32 torch reference (F.linear(x.float(),
  fn) + per-row sum-of-squares). Mixed atol+rtol pass criterion to
  account for deepgemm's internal BF16->TF32 cast vs FP32 reference.
  5/5 PASS at V4-Flash MHC shapes (hc_mult=4 hidden=7168 hc_mult3=24,
  num_tokens in {1, 16, 128, 2048, 2049}) with abs <= 8.4e-4 and
  rel <= 8.1e-4 over magnitude-significant positions.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
williamjameshandley added a commit to williamjameshandley/sglang that referenced this pull request May 8, 2026
The PR sgl-project#324 sm120 branch (deepgemm 2.5.0, AUR python-deepgemm-git
r209.aa2042d-1) does not expose get_compile_mode / set_compile_mode.
Guard the warmup compile-mode hint behind hasattr so the FP8 block
GEMM warmup path runs cleanly on this deepgemm version. When the
attribute is absent, the JIT uses its built-in default.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MengYu10151 pushed a commit to MengYu10151/sglang that referenced this pull request Jul 21, 2026
Enable the external DeepGEMM PR sgl-project#324 path on SM120, including packed UE8M0 scale handling and compatibility with the updated DeepGEMM layout API. Propagate FP4 expert capability through dispatcher quantization metadata so the backend selects the correct SM120 recipe.

Decouple DeepGEMM clamp fusion from the MegaMoE memory flag without adding an A2A-backend dependency or EPv2-specific swizzle workaround. EPv2 remains on the regular gate/up layout and explicitly runs with SGLANG_OPT_FIX_MEGA_MOE_MEMORY=false.

Replace the stale SM120 README with the current 5k11 deployment, data-flow, correctness, dependency, and benchmark record. Separate the 18-case clamp-off ablation from the supported clamp-on EPv2 result, document the TP8 fused-clamp shape limit, and remove the obsolete claim that EPv2 wins the full matrix.

Validation: 20 DeepEP v2 unit tests pass; DSv4 Flash direct/FP8/DeepGEMM chat correctness passes; representative 1024/1 and 1/1024 serving cases reach 338.56 total tok/s and 78.04 ms mean TPOT respectively.
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…amily) axis over mlp/attn_gdn/vocab/moe in the score derivation — families filled ONLY from genuine per-module declarations (ModelOpt MIXED_PRECISION quantized_layers, CT >1 config_groups), a family matching the checkpoint-wide format gets no own vector so mixed never lies; new lane keys nvfp4_native/nvfp4_marlin + format keys nvfp4_a4/a16, dispatch order only, no probes, NO PROFILE_VERSION bump; exactly one production caller existed and was switched, non-MIXED checkpoints bit-for-bit unchanged (pinned against #298a fixtures); side fix: hf_quant_config.json read when config.json lacks the quant block; per-family prefill-time arithmetic DELIBERATELY deferred to sgl-project#287 (sum(p)/r vs sum(p/r) differ in last bits — would break the byte-identity promise); 28 tests/30 subtests, planner+spec 1919 green; finding: the on-disk Qwen3.6-27B-NVFP4 is CT single-group W4A4 (nvfp4_a4, no family split), the genuine MIXED V1 is not on this box (mocks + config shapes)

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Jul 31, 2026
…fable per user approval): staircase axes rung x phase x depth-bin (0.05-1.0, 'auch dazwischen') x format; relief order re-pinned per sgl-project#320 (dcp_ratio < admission_cap < kv_spill < weightless_rank < session_offload); solve_operating_grid solves the KV vector per bin as argmin of lockstep time under fit constraint — format factors exclusively from the sgl-project#324 per-(rank,family) scores, missing inputs named not guessed; STAGE-1 LIMITS HONEST: admission_cap + session_offload are wired actuators, dcp_ratio/kv_spill/weightless_rank are PLANNED-ONLY (physical KV move = sgl-project#297), named in boot inventory and every flip line; rank uniformity: replicated inputs only, commits only at consensus boundaries with UNCONDITIONAL cadence, one MIN-reduction of [v,-v] pairs via the sgl-project#312 bounded_collective, min!=max raises the same loud KvLadderError on all ranks; desync falsifier green (poisoned rank -> all three fail loudly, nobody hangs, nobody commits); graph decision: stage-1 rungs mutate CPU scheduler state outside capture paths, geometry rungs get graph sets later; per-family sum(p/r) arithmetic gated on gemm.mixed — single-scheme checkpoints bit-for-bit unchanged (closed-form pin); 38 new tests, planner 1722 green; CARD PASS: flips 0->1->2 rank-uniform with 0 desync, exactly one retract then prevented, descend + release uniform, negative control byte-identical (first 'differs' was a comparison calibration error, corrected)

# Conflicts:
#	docs/dev/INTEGRATION_R3_VALIDATION.md
efschu added a commit to efschu/htsglang that referenced this pull request Aug 16, 2026
…3 us threshold

Desk half of sgl-project#705, the sgl-project#485 phase matrix applied to DECODE as sgl-project#702 applied it
to prefill. No GPU touched.

Verdict: the desk-net is positive if and only if a blocking TP all-reduce costs
more than 14.3 microseconds on this rig. Everything else is priced; the whole
question collapses to that one measurable threshold, which is the only number
this desk could not source.

Two premise corrections, one each way.

(a) "20 GB of GDN weights" is ~4x too high for the part that actually moves.
The MoE block is 77.7 percent of all weights and does NOT move -- it stays
sharded on every layer. Only the GDN attention module relocates: 110.5 MiB per
layer, 5,304 MiB total.

(b) "75 percent of depth becomes sync-free" is FALSE, and this cuts against the
proposal. Every layer is MoE (qwen3_next.py:580, is_layer_sparse = True
unconditionally) and the MoE block issues its own all-reduce whenever
moe_tp_size > 1 (moe/fused_moe_triton/layer.py:2047, :2062). No layer becomes
sync-free at any depth. The removal is 48 of 128 collectives per round, 37.5
percent, not 75 percent of depth.

(c) Cutting FOR the proposal: the 48 removed all-reduces are the BLOCKING kind
(RowParallelLinear calls tensor_model_parallel_all_reduce synchronously,
linear.py:2340), while the surviving MoE all-reduce is DEFERRED and joined in
the next layer's prepare_attn (communicator.py:888-891, sgl-project#597). So the removed
collectives are worth more per unit than a count comparison suggests.

Bandwidth cost, priced: +0.668 ms/round for GDN attention weights (sharded
1,768 MiB each binds on the 3080s at 2.439 ms; solo 5,304 MiB on the 5090 is
3.107 ms) plus +0.018 ms for state, so +0.686 ms/round total -- far below the
ticket's ~+5 ms envelope. The reason is that the sharded case is bound by the
SLOWEST rank, so trading three slow readers for one fast one costs much less
than the aggregate-bandwidth framing implies. Break-even is 0.686 ms / 48 =
14.3 us per collective, a low bar for a PHB round trip on a 10 KB payload.

Capacity ledger: rank0 +4,688 MiB (GDN weights +3,536, GDN states +1,152 at 12
mamba slots), each 3080 frees 2,344 MiB, world net EXACTLY ZERO. Here that
conservation is correct rather than the sgl-project#702 error: decode really is the TP
phase, the pool really is the sum, and the DCP vector really can relieve a tight
rank. sgl-project#702's mistake was applying this rule to PP prefill, where the pool is
layer-sharded and takes the min.

Residual tension named: capacity wants rank0's token share lower, bandwidth
wants 2.4:1:1. Recommendation is to hold 2.4:1:1 and absorb the 4,688 MiB out of
rank0's KV share, since the world pool is conserved and the 3080s were just
handed 2,344 MiB each. Ranks 1/2 become zero-shard for the GDN family per sgl-project#115,
an intermediate rung rather than all-or-nothing, as sgl-project#324 per-(rank,family)
ratios allow.

Ledger gap stated rather than smoothed: the census on disk is the PP layout, so
world-neutrality holds as an accounting identity but the per-rank FIT of
+4,688 MiB on rank0 is unverified.

One conditional A/B arm defined, gated on measuring the break-even first, with
the wait column as the acceptance signal and a falsifier on rank0 compute
rising by ~0.69 ms and no more. Must not be co-armed with a sgl-project#702 prefill-cut
change -- one phase at a time or neither result is attributable.

Docs only. No arm, no deploy.
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
… as data, and the embed-quant checks

sgl-project#725. THE BRIEF'S PREMISE DOES NOT HOLD, and saying so is the finding. The
task was to locate where the cost model prices quantized-linear lanes as
M-independent or with a wrong crossover, and to stop bs=1-decode points being
priced through the quant stage. Neither happens: the planner has NO
activation-quant axis at all. decode is weight_bytes / effective_decode_bw
(key_solver.decode_weight_time), prefill is 2*params / gemm_tflops
(key_solver.prefill_compute_time), and quantization enters those two formulas
only as a smaller weight-byte count and as which lane rate is picked (sgl-project#324). A
T=2 decode point never passes through a quant stage, so there is no misprice
to make red. Per the brief's own escape clause this reduces to
data-with-provenance plus pins.

TWO CORRECTIONS TO THE FRAMING, both load-bearing:

1. The real dispatch decision is not in the planner. It is
   layers/quantization/fp8_dequant_gemv.py:324 (fused_gemv_applicable, aspect
   test N >= K) and the sm120 NVFP4 buckets in nvfp4_scaled_mm_sm120.cuh:
   192-201 -- per-call runtime branches.

2. sgl-project#368 measured the small-M quant penalty as largely a LAUNCH CONSTANT that
   CUDA-graph replay removes: int8_quant 0.0266 -> 0.0012 ms (~21x), quant
   share of the fused op 61% -> 11%. NInfer's thresholds are dispatch branches
   in a C++ header, i.e. taken per call in an eager engine, and a captured
   graph cannot branch on T at replay. Wiring an eager-measured crossover into
   our graph-captured decode path would import an artefact. The table is
   therefore recorded with NO consumer, deliberately (sgl-project#421's audit class: an
   instrument that looks wired and is not is worse than one honestly inert).

WHAT THE HARVEST IS WORTH TODAY: corroboration, and it is real. Two codebases,
two mechanisms, two GPU classes agree on which family must not take the
small-M quant/fused path -- the K>N shapes. Our own sm86 aspect gate separates
exactly those ([5120,6144] 0.86x LOSE, [5120,17408] 0.90x LOSE). Five of six
shapes agree in direction.

(d) sm86 stays EMPTY. NInfer measured sm120a only, and sgl-project#368 established sm86
is GEMM-slow rather than quant-dominant, so its crossovers are not merely
unmeasured but expected to differ in KIND. An estimate would be a number with
no measurement wearing the same type as five that have one.

sgl-project#724, checks only, no port. Checkpoint read by headers only (120 and 2624
bytes of header JSON; no shard mmapped, no tensor data touched).

(a) YES on all three counts, from two independent places. config.json:
tie_word_embeddings False, and quantization_config.ignore names 'lm_head' and
're:.*embed_tokens.*'. Safetensors headers confirm it without trusting the
config: lm_head.weight BF16 [248320, 5120], embed_tokens.weight BF16
[248320, 5120].

  This CLOSES the one open divergence from sgl-project#725. That shape is exactly
  NInfer's lm_head row -- the single shape where their "A16 always" points
  opposite to our N>=K gate (N/K=48.5, selects fused). On this checkpoint
  lm_head is BF16, so no activation-quant gate ever sees it: moot.

(b) NO gap in that form; the kernel exists and IS wired, just scoped.
  main model  qwen3_5.py:1386-1405 builds embed_tokens quantized-resident via
    GGUFEmbeddingMethod (gguf.py:1532), gated explicitly to GGUF; every other
    quantization keeps quant_config=None and takes the dense path.
  NEXTN draft qwen3_5_mtp.py:185-204 set_embed_and_head_modules hands the
    draft the target's MODULE OBJECTS rather than tensors -- precisely because
    a packed qweight has no .weight to hand over -- so the draft inherits
    whatever the main model built and has no independent path to carry a gap.

  The only real delta is a capability question for its own decision: extending
  quantized-resident vocab beyond GGUF would require re-quantizing embed and
  lm_head, which this checkpoint's producer deliberately excluded, so the
  ~1.1 GiB/rank prize is not available without changing the checkpoint.

Tests, hermetic (CUDA_VISIBLE_DEVICES="", no GPU, no model load, no serving):
  test_activation_quant_crossover_725.py  13 passed + 31 subtests
    MUTATION PROOF: estimating an sm86 row and making ABSENT answer False
    turns 3 pins red
  test/registered/unit/planner  2524 passed, 123 skipped, 188 subtests,
    2 failed -- PROVEN PRE-EXISTING by re-running the failing file with both
    new files moved aside: same 2 fail (test_rejected_evidence_pins.py).
  ruff + codespell clean.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…olved attention family

The remainder I sized in cc8e666 was two structural problems. Both are fixed,
and the acceptance is the one that slice set: the function on the real
checkpoint no longer returns {}.

  Qwen3.8-27B-INT8-yarn1.5 -> {'moe': 'int8', 'mlp': 'int8',
                               'vocab': 'bf16', 'attn_gdn': 'bf16'}

CLASS-SELECTOR ATTRIBUTION, AS A COMPLEMENT. _is_class_selector recognises a
bare module-class target (Linear) and distinguishes it from a path or a regex,
which name specific modules and must not be widened. A class selector then
contributes its key to every GEMM family the ignore list does NOT name, derived
from _ALL_GEMM_FAMILIES rather than spelled out twice. The direction is the
load-bearing choice: claiming a family the quantizer was told to skip would
overwrite a bf16-resident fact with a scheme never applied. Two reverse pins
hold it -- a regex target and a dotted path each stay narrow.

THE ATTN_GDN SPAN, RESOLVED BY LAYERS. _weigh_attn_gdn_by_layers uses sgl-project#371's
per-layer counts: linear_attn evidence weighs the GDN layers, the rest of the
family weighs the full-attention ones. Reversing the split reverses the answer,
which is what makes it a measurement rather than a vote -- _dominant's
config-entry count never could.

sgl-project#371 WAS REUSED, NOT REBUILT. Its census covers the block_configs axis; the
GDN-hybrid axis was already derived from layer_types (uneven_perf.py:3712-3717,
full_layers / gdn_layers). Nothing needed extending -- the per-layer truth
existed and simply was not reaching this function. The caller now derives the
same split and passes it.

THE SHIPPED KEY IS A MAJORITY KEY, AND ITS PROVENANCE IS THE COMPLEMENT RULE.
On this checkpoint attn_gdn resolves through the complement (its only evidence
is the ignored linear_attn), NOT through the layer weighting. So attn_gdn=bf16
describes 48 GDN layers and does not describe the 16 full-attention ones. My
first draft printed "resolved per layer" there, which overclaimed; the
description now states the span and names the layers the key does not cover, so
no consumer can read it as uniform. The per-layer VECTOR contract is filed as a
named follow-up in NOTE_485_item1_family_report.md, with its consumer (sgl-project#324
per-(rank, family) scores and sgl-project#705-class family-placement pricing, which would
otherwise charge full-attention layers at the GDN family's bf16 rate) and its
feed (sgl-project#371's census, already measured). Not built here: it changes the
interface every sgl-project#324 consumer reads and deserves its own red-first slice rather
than being smuggled into a reporting fix.

int8_a16 IS DECLARED, NOT LANE-REGISTERED. FORMATS_WITHOUT_LANES records
weight-only INT8 as recognised but unmeasurable and rank_gemm_scores says so in
its own branch. It is deliberately NOT added to _FORMAT_LANES: that table's own
comment says registering a lane the serving path cannot take would make the plan
lie, and this tree has no weight-only int8 arm. The fix is sgl-project#606's
known-but-unmeasured versus unrecognised distinction, not a fabricated lane.

20 tests, red first. Mutation-proven: disabling class-selector recognition and
the layer weighting together red 7, including all four real-checkpoint
acceptance tests. 133 passed / 10 skipped across the planner consumer suites, up
from 120 -- the delta is these tests. Mapping was missing from the typing
import, caught by ruff and invisible at runtime under postponed annotations;
uneven_perf.py is back to its 6 pre-existing findings. No boots.
1195343015 pushed a commit to 1195343015/sglang that referenced this pull request Dec 2, 2026
…in workflow_dispatch (sgl-project#324)

* [CI] [PPU] Allow repo-variable allowlisted GitHub App bots in workflow_dispatch approval

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

* [CI] [PPU] Restrict bot ownRef workflow_dispatch strictly to trusted release branches

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

---------

Signed-off-by: Yunzshi310 <[email protected]>
(cherry picked from commit cffa54d2a20f6c270cc55d49d38554a663defbe9)
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