Repository navigation
Hisparse Minor Fix - #22131
Merged
Merged
Hisparse Minor Fix#22131
Conversation
xiezhq-hermann
requested review from
BBuf,
DarkSharpness,
HydraQYH,
Ying1123,
celve,
hnyls2002,
merrymercy and
yuan-luo
as code owners
April 5, 2026 02:05
Contributor
There was a problem hiding this comment.
Code Review
This pull request optimizes memory transfers in the hisparse JIT kernel by implementing 128-bit bulk transfers using paired 64-bit loads and stores, while also updating the scheduler to reset the batch_is_full flag and centralizing hisparse request retraction within the release_req method. Feedback was provided regarding the robustness of the transfer kernel, specifically suggesting that it should handle cases where the item size is not a multiple of 8 bytes to prevent data loss for smaller tail segments.
Comment on lines
+42
to
50
| const int tail_8B = (item_size_bytes - total_pairs * 16) / 8; | ||
| if (tail_8B > 0 && lane_id < tail_8B) { | ||
| const uint64_t* __restrict__ src8 = | ||
| reinterpret_cast<const uint64_t*>(static_cast<const char*>(src_addr) + total_pairs * 16); | ||
| uint64_t* __restrict__ dst8 = reinterpret_cast<uint64_t*>(static_cast<char*>(dst_addr) + total_pairs * 16); | ||
| uint64_t tmp; | ||
| asm volatile("ld.global.nc.b64 %0,[%1];" : "=l"(tmp) : "l"(src + j) : "memory"); | ||
| asm volatile("st.global.cg.b64 [%0],%1;" ::"l"(dst + j), "l"(tmp) : "memory"); | ||
| asm volatile("ld.global.nc.b64 %0,[%1];" : "=l"(tmp) : "l"(src8 + lane_id) : "memory"); | ||
| asm volatile("st.global.cg.b64 [%0],%1;" ::"l"(dst8 + lane_id), "l"(tmp) : "memory"); | ||
| } |
Contributor
There was a problem hiding this comment.
JustinTong0323
pushed a commit
to JustinTong0323/sglang
that referenced
this pull request
Apr 7, 2026
Co-authored-by: huangtingwei9988 <[email protected]> Co-authored-by: hzh0425 <[email protected]>
caitengwei
pushed a commit
to caitengwei/sglang
that referenced
this pull request
Jun 1, 2026
Co-authored-by: huangtingwei9988 <[email protected]> Co-authored-by: hzh0425 <[email protected]>
Chronostasys
pushed a commit
to MindLab-Research/sglang
that referenced
this pull request
Aug 24, 2026
Co-authored-by: huangtingwei9988 <[email protected]> Co-authored-by: hzh0425 <[email protected]>
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 29, 2026
…fill has not returned Three boots of forensics land on one invariant. A request that has never produced an output token has nothing to decode from, and decoding it anyway is what has been killing this window's boots on their first short prompt. The chain, measured end to end: get_next_batch_to_run makes a freshly built PREFILL batch the running batch in the same breath. Upstream that holds -- without PP the prefill runs in the same round, so output_ids is non-empty by the time update_running_batch sees it. The seam is stock, every commit touching it is an upstream PR (sgl-project#29408, sgl-project#22131, sgl-project#20343, sgl-project#14320, sgl-project#17484, sgl-project#14883), none of ours, so there is nothing to revert. PP=3 widens it: the result comes back several passes later while membership was granted immediately, and with one short request and no other traffic the next round has nothing else to do and decodes it first. prepare_for_decode then leaves the prefill input_ids in place -- there is no last token to embed -- and the batch travels on labelled DECODE while carrying extend tokens. Boot 67 read every link: rid e463acc5, prefix_lens=0 fill_lens=3 out_lens=0, one ADMIT, no retraction, and no void at all (797_void=0, 798_void=0, so the void explanation is excluded). It surfaced first as forward_mode=2 with batch_size=1 and input_ids=3 through the sgl-project#1007 probe, then as "causal_conv1d_update: conv_state_indices has 1 entr(ies) for a batch of 3". Every short prompt does this, health checks included; long chunked prompts under continuous load never reach the state, which is exactly why it stayed latent behind every other defect this window. So the hold sits where decode eligibility is decided, not on a consumer. The requests are neither dropped nor reset: they stay in the running batch and become eligible the moment their prefill result lands, and filter_batch's keep_indices keeps the parallel tensors consistent rather than reseating reqs by hand. The counter is cumulative on purpose (INDIKATOR-GESETZ): a held_total that never grows means the class no longer occurs, one that grows without bound means results are not landing at all. Those are different diagnoses and a per-call line could not tell them apart. Evidence: desk, executed. py_compile; the condition sits inside update_running_batch ahead of prepare_for_decode, and the counter is written once and read twice. Belegstufe: DESK-BEWIESEN -- BOOT-BEWIESEN only once the 3-token probe returns tokens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Modifications
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci