Skip to content

fix(patch): repair spec-capture-ascend-mount.patch hunk headers - #776

Open
curnane-lab wants to merge 2 commits into
sgl-project:mainfrom
curnane-lab:fix/spec-capture-ascend-mount-hunk
Open

fix(patch): repair spec-capture-ascend-mount.patch hunk headers#776
curnane-lab wants to merge 2 commits into
sgl-project:mainfrom
curnane-lab:fix/spec-capture-ascend-mount-hunk

Conversation

@curnane-lab

@curnane-lab curnane-lab commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Motivation

The companion patch merged by #722 (patches/sglang/v0.5.14/spec-capture-ascend-mount.patch) does not apply. Its first hunk header declares 31 new-side lines while the body carries only 28 - a pre-merge edit shortened a comment from 5 lines to 2 without updating the header - so every fresh Ascend setup from main aborts with:

error: corrupt patch at line 41

Separately, a8c0993 ("feat: enhance spec_capture_sink with dynamic pinning configuration", merged into main via #698 nine hours after #722) moved the with_hard_pin guard into the base patch, leaving this patch's second hunk context stale (patch does not apply even once the header is fixed).

Two gaps in the Ascend docs then made fresh setups fail even with a valid patch: the documented git apply command lacks -p2 (it fails with No such file or directory against an installed SGLang), and the doc never explains how to install Mooncake on Ascend in the first place.

Modifications

Regenerate the patch against the current v0.5.14 base - the Ascend behavior itself is unchanged:

  • Hunk 1 header corrected: @@ -81,18 +81,31 @@ -> @@ -87,18 +87,28 @@ (line numbers re-based, new-side count fixed).
  • Hunk 2 reduced to a pure mount-block insertion (@@ -106,6 +116,25 @@); the old pin-guard exchange is dropped because the base patch now ships with_hard_pin/with_soft_pin handling itself.
  • Blob index line updated to the current base.

docs/basic_usage/Ascend/ascend_npu.md (+37/-1):

  • Add the missing Mooncake installation section (NPU wheel first, source build with -DUSE_ASCEND_DIRECT=ON as fallback), with verification commands for both mooncake_master and mooncake.store.
  • Fix the companion-patch apply command: git apply needs -p2 against an installed SGLang.

Related Issues

Validation

git apply --check before / after:

Base Before After
current main (395-line sink) corrupt patch at line 41 (exit 128) ✅ applies
#722 merge-time (389-line sink) corrupt patch at line 41 (exit 128) ✅ applies

The patched sink compiles, the Ascend mount logic (allocate_and_mount_segment with location="cpu") lands intact, and the base's with_hard_pin/with_soft_pin fallback is preserved. CUDA hosts are unaffected: the Ascend path activates only when ASCEND_RT_VISIBLE_DEVICES is set, otherwise the setup() arguments are identical to the base.

The -p2 fix mirrors scripts/apply_sglang_spec_capture_patch.sh, which already strips the python/ prefix for installed SGLang trees (same dirname(dirname(sglang.__file__)) root): without -p2 the companion patch fails with No such file or directory; with it, both install layouts (site-packages and editable source) apply.

Accuracy Test

N/A - file repair only; no runtime code changed.

Benchmark & Profiling

N/A.

Checklist

  • Format your code according to the Code Formatting with Pre-Commit. (.patch files are excluded from whitespace hooks by repo config; verified the file applies cleanly.)
  • Add unit tests as outlined in the Running Unit Tests. (N/A - no code change.)
  • Update documentation / docstrings / example tutorials as needed, according to Writing Documentation. (ascend_npu.md gains the Mooncake install section and the corrected -p2 apply command.)
  • Provide throughput / latency benchmark results and accuracy evaluation results as needed, according to Benchmark and Profiling and Accuracy Results. (N/A.)
  • For reviewers: If you haven't made any contributions to this PR and are only assisting in merging the main branch, please remove yourself as a co-author when merging the PR.
  • Feel free to join our Slack channel at https://sgl-fru7574.slack.com/archives/C09784E3EN6 to discuss your PR.

@curnane-lab
curnane-lab marked this pull request as ready for review August 20, 2026 02:21
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.

2 participants