Skip to content

feat(qsa):Extend QSA prefill to support 1M context - #81

Merged
sammysun0711 merged 16 commits into
qwen38-flash-next-amd-current-fix-installfrom
qwen38-qsa-1m
Nov 4, 2026
Merged

sammysun0711 merged 16 commits into
qwen38-flash-next-amd-current-fix-installfrom
qwen38-qsa-1m

Conversation

@apinge

@apinge apinge commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Motivation

This PR is based on tingqli/pyhip#62 and it extends the QSA prefill (attention + indexer) to 1M-token contexts (MAX_COMPRESSED_KEYS 65536 → 262144 compressed keys) for TP2 TP4.

Co-authored-by: Cheng Luo [email protected]

Modifications

  1. The new version of the pyhip interface reads directly from the K/V pool via kv_slots, avoiding the creation of contiguous packed_k/packed_v copies; The indexer supports both 1M and YaRN, and it partitions prefill scoring across TP ranks using row_range/out before performing an all-gather to get the final selection results.
  2. Add YaRN rope support for pyhip indexer
  3. Introduce new env SGLANG_OPT_PYHIP_QSA_SPLIT_INDEXER with SGLANG_USE_PYHIP_QSA=1
  4. Add SGLANG_LOG_QSA_INDEXER_BACKEND for log

Accuracy Tests

1M context

This is just a smoke test and it passed (both yarn and default rope type).
server

bash scripts/launch_qwen38_flash_next_fp8_mi308x_long_server_1m.sh

client

python3 -m sglang.benchmark.serving \
  --backend sglang \
  --model /models/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16 \
  --host 127.0.0.1 --port 7080 \
  --dataset-name random --tokenize-prompt \
  --random-input-len 1000000 \
  --random-output-len 350 \
  --random-range-ratio 1.0 \
  --num-prompts 1 --max-concurrency 1 \
  --warmup-requests 0 --flush-cache \
  --cache-report

Test shorter example

CONTEXT_LEN=524288 CUDA_GRAPH_MAX_BS_DECODE=16 MAX_RUNNING_REQUESTS=16 \
bash /opt/sglang/scripts/launch_qwen38_flash_next_fp8_mi308x_long_server_1m.sh

gsm8k tp2

bash run_gsm8k_qwen38.sh 
[aiter] import [module_aiter_core] under /opt/aiter/aiter/jit/module_aiter_core.so
ChatCompletionSampler initialized with self.system_message=None self.temperature=0.0 self.max_tokens=16384 self.reasoning_effort=None self.extra_body=None self.stop=None self.record_meta_info=True
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1314/1314 [12:44<00:00,  1.72it/s]
Total latency: 765.015 s
Score: 0.979
Output throughput: 796.357 token/s
[METRIC] gsm8k_score=0.9786910197869102 labels={"model": "Qwen/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16", "eval": "gsm8k"}
[METRIC] gsm8k_latency=765.0149623239413 labels={"model": "Qwen/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16", "eval": "gsm8k"}
====================
Speculative accept length (per-request, from meta_info): n=1314 mean=3.1378 min=2.4677 max=3.6159
====================
Writing report to /tmp/gsm8k_Qwen_Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16.html
{'score:std': np.float64(0.14441228332578898), 'score': np.float64(0.9786910197869102), 'latency': 765.0149623239413, 'output_throughput': 796.356973397374}
Writing results to /tmp/gsm8k_Qwen_Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16.json

gsm8k tp4

bash run_gsm8k_qwen38.sh 
[aiter] import [module_aiter_core] under /opt/aiter/aiter/jit/module_aiter_core.so
ChatCompletionSampler initialized with self.system_message=None self.temperature=0.0 self.max_tokens=16384 self.reasoning_effort=None self.extra_body=None self.stop=None self.record_meta_info=True
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1314/1314 [12:02<00:00,  1.82it/s]
Total latency: 722.904 s
Score: 0.981
Output throughput: 872.661 token/s
[METRIC] gsm8k_score=0.9809741248097412 labels={"model": "Qwen/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16", "eval": "gsm8k"}
[METRIC] gsm8k_latency=722.9036684019957 labels={"model": "Qwen/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16", "eval": "gsm8k"}
====================
Speculative accept length (per-request, from meta_info): n=1314 mean=3.1298 min=2.5652 max=3.5858
====================
Writing report to /tmp/gsm8k_Qwen_Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16.html
{'score:std': np.float64(0.136615852899667), 'score': np.float64(0.9809741248097412), 'latency': 722.9036684019957, 'output_throughput': 872.6612238592127}
Writing results to /tmp/gsm8k_Qwen_Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16.json

Speed Tests and Profiling

evalscope test

server

bash scripts/launch_qwen38_flash_next_fp8_mi308x_long_server_1m.sh

client example

python3 -m pip install 'evalscope[perf]'

MODEL_PATH=/path/to/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16
MODEL_NAME=Qwen/Qwen3.8-Flash-Next-PTPC-FP8-PLE-BF16

ISL=262144
OSL=1536
PREFIX=236032
BODY=$((ISL - PREFIX))

evalscope perf \
  --api openai \
  --url http://127.0.0.1:9180/v1/completions \
  --model "$MODEL_NAME" \
  --tokenizer-path "$MODEL_PATH" \
  --dataset random --tokenize-prompt \
  --min-prompt-length "$BODY" \
  --max-prompt-length "$BODY" \
  --prefix-length "$PREFIX" --prefix-count 1 \
  --max-tokens "$OSL" \
  --extra-args '{"ignore_eos":true}' \
  --number 64 --warmup-num 1 --parallel 1 \
  --stream --temperature 0 --seed 42 \
  --no-test-connection \
  --read-timeout 7200 --total-timeout 7200 \
  --outputs-dir "./evalscope_tp2_$(date -u +%Y%m%dT%H%M%SZ)"

Comparison between pyhip and the torch ref on the same batch of random inputs: all 64 input hashes were identical, the per-request cache counts also matched, and the average cache hit rate was 89.9994% for both runs.

TP2, concurrency 1 with mtp; only the indexer path was changed, while all other inference settings were kept the same.

Indexer Avg. TTFT Avg. TPOT QPS (64 requests)
PyHIP 1.901 s 3.908 ms 0.12610 req/s
Torch reference 4.369 s 5.346 ms 0.07943 req/s

PyHIP reduced TTFT by 56.48%, reduced TPOT by 26.91%, and improved QPS by 58.77%.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

luocheng25 and others added 3 commits November 2, 2026 01:34
- Prefixed chunk prefill: PyHIP attention reads the layer's K/V pool in
  place through the packed slot table (kv_slots) instead of gathering the
  full-context K/V with index_select; pools PyHIP cannot read in place keep
  the gather path.
- Graph/eager decode: the PyHIP indexer accepts compressed page tables up to
  the runtime's MAX_COMPRESSED_KEYS (262144 keys, a 1M-token context)
  instead of 65536, bounded by the 32-bit offsets of its FP32 logits.
- Tests: in-place reads match the gather fallback, and graph decode with a
  1M-context page table still runs PyHIP.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 0a10105)
The 1M-context launch overrides RoPE to YaRN, which get_rope builds as
YaRNScalingMRotaryEmbedding. PyHIPIndexer.create matched MRotaryEmbedding by
exact type, so it returned None and the native indexer silently ran
(TP2, ~1M-token prompt: TTFT 229 s vs 87 s with PyHIP). YaRN only rescales
the cos/sin cache that the PyHIP prep reads; its lookup and MRoPE axis
composition are MRotaryEmbedding's. The new test builds the RoPE through
get_rope with the launch-style YaRN parameters and checks that PyHIP is
selected and matches native bit for bit in prefill, graph decode and verify.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 010b0e2)
…-TP ranks

The PyHIP prefill indexer is replicated on every TP rank; at 1M context its
last chunk costs 45.3 ms per layer. With SGLANG_OPT_PYHIP_QSA_SPLIT_INDEXER=1
(off by default), a chunk of at least 2048 rows averaging at least 32768
compressed keys per row is cut into equal contiguous shares: each
attention-TP rank selects its share with prefill_indexer(row_range, out)
into a shared [tp * share, 2051] frame, and an in-place
all_gather_into_tensor completes it. The thresholds come from MI308X
measurements (indexer ~1.06e-5 us per row and key, TP2 all-gather ~0.087 us
per row) with about a 2x margin.

Validated on TP2 with YaRN at --context-length 1000000: SGLANG_TEST_PYHIP_QSA=1
passes with the split on (including a 999648-token request), and TTFT changes
by +0.1% / -1.3% / -5.0% / -11.5% at 131k / 262k / 524k / 1M inputs (1M:
86.1 s -> 76.2 s); the decode path is unchanged. Needs pyhip with
prefill_indexer(row_range, out).

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit b1abbb0)
@apinge apinge changed the title Qwen38 qsa 1m feat(qsa):Extend QSA prefill to support 1M context Nov 2, 2026
Gather and score compressed keys in page-aligned chunks with a 256 MiB
FP32 K budget. Preserve FP32 scoring, full logits, masking and
capture-static shapes without materializing all per-query keys at once.

Handle empty batches/capacity and truncated or padded output lengths.
Add the opt-in SGLANG_LOG_QSA_INDEXER_BACKEND diagnostic flag. Log the
selected PyHIP, Torch or TileLang path after the indexer returns, with
layer, forward mode and query row count.

Deduplicate by layer instance, mode and backend. Keep logging disabled
by default and avoid import hooks or GPU synchronization.

Copilot AI 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.

🟡 Changes recommended

The pinned PyHIP revision does not support the newly passed kv_slots argument, causing the first attention call to fail on installations using the declared dependencies.

4 open issues
What changed in this PR

This PR extends SGLang’s PyHIP Qwen Sparse Attention integration toward 1M-token contexts on TP2 and TP4 deployments.

Changes:

  • Adds YaRN support, optional prefill indexer splitting across attention-TP ranks, and direct KV-pool reads.
  • Bounds the Torch decode fallback’s key workspace and adds indexer backend logging.
  • Adds long-context launch/client scripts and tests for the expanded PyHIP paths.
File Description
test/​registered/​kernels/​test_pyhip_qsa.py Tests YaRN, split prefill, KV-slot reads, and larger graph page tables.
scripts/​test_qwen38_long_request.py Sends exact-length requests and reports token counts and latency.
scripts/​launch_qwen38_flash_next_fp8_mi308x_pure_tp_4_or_8_or_2.sh Enables indexer backend logging by default.
scripts/​launch_qwen38_flash_next_fp8_mi308x_long_server_1m.sh Adds a configurable 1M-context ROCm launcher.
scripts/​generate_qwen38_long_prompts.py Generates long token-ID prompt fixtures.
python/​sglang/​srt/​layers/​attention/​qwen_sparse_attn_backend.py Uses direct KV-pool reads when supported.
python/​sglang/​srt/​layers/​attention/​qsa/​qsa_indexer.py Logs the selected indexer backend.
python/​sglang/​srt/​layers/​attention/​qsa/​pyhip_backend.py Integrates extended PyHIP attention and indexer capabilities.
python/​sglang/​srt/​layers/​attention/​qsa/​mqa.py Chunks gathered decode keys to limit workspace size.
python/​sglang/​srt/​environ.py Defines backend-logging and split-indexer controls.

Review effort: Balanced

Comment thread scripts/generate_qwen38_long_prompts.py Resolved
apinge and others added 3 commits November 2, 2026 12:42
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Lower the FP32 key budget to force multiple page chunks and compare
against a dense reference. Cover reordered pages, different context
lengths, partial-page truncation, padded output and empty inputs.

Add a 1M-capacity CUDA Graph workspace bound and replay checks with
changed query, cache, page-table and length inputs.

Copilot AI 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.

🟡 Changes recommended

Both ROCm extras still pin an incompatible PyHIP revision, so the new unconditional kv_slots argument causes TypeError on every PyHIP attention call in standard installations.

3 open issues
2 resolved since last review

Review effort: Balanced

apinge and others added 2 commits November 2, 2026 20:57
Refactor TestQsaDecodeWorkspace to inherit from CustomTestCase.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Revert the chunked reference implementation and its dedicated workspace
regressions. Keep the PyHIP 1M/YaRN/TP-split integration and actual backend
dispatch logging unchanged.

Reverts 14c5729,
7edc822, and
e255acb.
@apinge
apinge marked this pull request as ready for review November 3, 2026 01:32
Comment thread scripts/test_qwen38_long_request.py Resolved
Compare real compressed lengths of 66049 and 250001 against an independent Torch reference, with reordered pages, masked tail keys, and changing lengths during CUDA graph replay.
Use the built-in serving benchmark with token-ID prompts, zero client warmups, and an explicit cache flush for long-context reproduction. Validated a cold 1000000-token input and 350-token output on TP2 with YaRN.

Copilot AI 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.

🔵 Needs a closer look

Long-context TP4 correctness needs gfx942 maintainer validation because the split test mocks the in-place collective and the reported TP4 accuracy test covers only short contexts.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

@sammysun0711
sammysun0711 merged commit 286cd46 into qwen38-flash-next-amd-current-fix-install Nov 4, 2026
1 of 2 checks passed
apinge added a commit that referenced this pull request Nov 7, 2026
* feat(qsa): read K/V in place and allow 1M-context decode in PyHIP QSA

- Prefixed chunk prefill: PyHIP attention reads the layer's K/V pool in
  place through the packed slot table (kv_slots) instead of gathering the
  full-context K/V with index_select; pools PyHIP cannot read in place keep
  the gather path.
- Graph/eager decode: the PyHIP indexer accepts compressed page tables up to
  the runtime's MAX_COMPRESSED_KEYS (262144 keys, a 1M-token context)
  instead of 65536, bounded by the 32-bit offsets of its FP32 logits.
- Tests: in-place reads match the gather fallback, and graph decode with a
  1M-context page table still runs PyHIP.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 0a10105)

* fix(qsa): accept YaRN MRoPE in the PyHIP QSA indexer

The 1M-context launch overrides RoPE to YaRN, which get_rope builds as
YaRNScalingMRotaryEmbedding. PyHIPIndexer.create matched MRotaryEmbedding by
exact type, so it returned None and the native indexer silently ran
(TP2, ~1M-token prompt: TTFT 229 s vs 87 s with PyHIP). YaRN only rescales
the cos/sin cache that the PyHIP prep reads; its lookup and MRoPE axis
composition are MRotaryEmbedding's. The new test builds the RoPE through
get_rope with the launch-style YaRN parameters and checks that PyHIP is
selected and matches native bit for bit in prefill, graph decode and verify.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 010b0e2)

* feat(qsa): split long PyHIP QSA prefill indexer rows across attention-TP ranks

The PyHIP prefill indexer is replicated on every TP rank; at 1M context its
last chunk costs 45.3 ms per layer. With SGLANG_OPT_PYHIP_QSA_SPLIT_INDEXER=1
(off by default), a chunk of at least 2048 rows averaging at least 32768
compressed keys per row is cut into equal contiguous shares: each
attention-TP rank selects its share with prefill_indexer(row_range, out)
into a shared [tp * share, 2051] frame, and an in-place
all_gather_into_tensor completes it. The thresholds come from MI308X
measurements (indexer ~1.06e-5 us per row and key, TP2 all-gather ~0.087 us
per row) with about a 2x margin.

Validated on TP2 with YaRN at --context-length 1000000: SGLANG_TEST_PYHIP_QSA=1
passes with the split on (including a 999648-token request), and TTFT changes
by +0.1% / -1.3% / -5.0% / -11.5% at 131k / 262k / 524k / 1M inputs (1M:
86.1 s -> 76.2 s); the decode path is unchanged. Needs pyhip with
prefill_indexer(row_range, out).

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit b1abbb0)

* add 1m script

* fix(qsa): bound Torch decode fallback key workspace

Gather and score compressed keys in page-aligned chunks with a 256 MiB
FP32 K budget. Preserve FP32 scoring, full logits, masking and
capture-static shapes without materializing all per-query keys at once.

Handle empty batches/capacity and truncated or padded output lengths.

* feat(qsa): log actual indexer backend dispatch

Add the opt-in SGLANG_LOG_QSA_INDEXER_BACKEND diagnostic flag. Log the
selected PyHIP, Torch or TileLang path after the indexer returns, with
layer, forward mode and query row count.

Deduplicate by layer instance, mode and backend. Keep logging disabled
by default and avoid import hooks or GPU synchronization.

* update scripts

* update test

* Update default model path in argument parser

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* test(qsa): cover chunked decode reference workspace

Lower the FP32 key budget to force multiple page chunks and compare
against a dense reference. Cover reordered pages, different context
lengths, partial-page truncation, padded output and empty inputs.

Add a 1M-capacity CUDA Graph workspace bound and replay checks with
changed query, cache, page-table and length inputs.

* Change TestQsaDecodeWorkspace base class

Refactor TestQsaDecodeWorkspace to inherit from CustomTestCase.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* revert(qsa): drop chunked Torch decode fallback and workspace tests

Revert the chunked reference implementation and its dedicated workspace
regressions. Keep the PyHIP 1M/YaRN/TP-split integration and actual backend
dispatch logging unchanged.

Reverts 14c5729,
7edc822, and
e255acb.

* update script

* test(qsa): validate graph selection beyond 65536 compressed keys

Compare real compressed lengths of 66049 and 250001 against an independent Torch reference, with reordered pages, masked tail keys, and changing lengths during CUDA graph replay.

* chore(scripts): remove redundant long-context request helpers

Use the built-in serving benchmark with token-ID prompts, zero client warmups, and an explicit cache flush for long-context reproduction. Validated a cold 1000000-token input and 350-token output on TP2 with YaRN.

* build(rocm): pin PyHIP to merged QSA API revision

---------

Co-authored-by: Luo Cheng <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
(cherry picked from commit 286cd46)
sammysun0711 pushed a commit that referenced this pull request Nov 9, 2026
…#90)

* feat(qsa): Support pyhip qsa indexer for prefill/decode, sparse gqa for prefill (#43)

* add pyhip qsa support

* enable pyhip for mtp verify

* fix error overwriting for ring buffer

* align new indexer interface

* remove potential sync in qsa

* cache packed QSA KV slots per forward

* update scripts

* update mtp method

* update pyhip version

* clean qsa attn conditions

* rename condition function

* rename indexer support

* support qsa indexer in decode eager mode

* rename ring to ring_slots

* fix ring slots

* Apply suggestion from @yicyang

Co-authored-by: Ethan Yang <[email protected]>

---------

Co-authored-by: Luo Cheng <[email protected]>
Co-authored-by: Ethan Yang <[email protected]>
(cherry picked from commit d14f81d)

* feat(qsa):Extend QSA prefill to support 1M context (#81)

* feat(qsa): read K/V in place and allow 1M-context decode in PyHIP QSA

- Prefixed chunk prefill: PyHIP attention reads the layer's K/V pool in
  place through the packed slot table (kv_slots) instead of gathering the
  full-context K/V with index_select; pools PyHIP cannot read in place keep
  the gather path.
- Graph/eager decode: the PyHIP indexer accepts compressed page tables up to
  the runtime's MAX_COMPRESSED_KEYS (262144 keys, a 1M-token context)
  instead of 65536, bounded by the 32-bit offsets of its FP32 logits.
- Tests: in-place reads match the gather fallback, and graph decode with a
  1M-context page table still runs PyHIP.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 0a10105)

* fix(qsa): accept YaRN MRoPE in the PyHIP QSA indexer

The 1M-context launch overrides RoPE to YaRN, which get_rope builds as
YaRNScalingMRotaryEmbedding. PyHIPIndexer.create matched MRotaryEmbedding by
exact type, so it returned None and the native indexer silently ran
(TP2, ~1M-token prompt: TTFT 229 s vs 87 s with PyHIP). YaRN only rescales
the cos/sin cache that the PyHIP prep reads; its lookup and MRoPE axis
composition are MRotaryEmbedding's. The new test builds the RoPE through
get_rope with the launch-style YaRN parameters and checks that PyHIP is
selected and matches native bit for bit in prefill, graph decode and verify.

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit 010b0e2)

* feat(qsa): split long PyHIP QSA prefill indexer rows across attention-TP ranks

The PyHIP prefill indexer is replicated on every TP rank; at 1M context its
last chunk costs 45.3 ms per layer. With SGLANG_OPT_PYHIP_QSA_SPLIT_INDEXER=1
(off by default), a chunk of at least 2048 rows averaging at least 32768
compressed keys per row is cut into equal contiguous shares: each
attention-TP rank selects its share with prefill_indexer(row_range, out)
into a shared [tp * share, 2051] frame, and an in-place
all_gather_into_tensor completes it. The thresholds come from MI308X
measurements (indexer ~1.06e-5 us per row and key, TP2 all-gather ~0.087 us
per row) with about a 2x margin.

Validated on TP2 with YaRN at --context-length 1000000: SGLANG_TEST_PYHIP_QSA=1
passes with the split on (including a 999648-token request), and TTFT changes
by +0.1% / -1.3% / -5.0% / -11.5% at 131k / 262k / 524k / 1M inputs (1M:
86.1 s -> 76.2 s); the decode path is unchanged. Needs pyhip with
prefill_indexer(row_range, out).

Co-authored-by: Copilot <[email protected]>
(cherry picked from commit b1abbb0)

* add 1m script

* fix(qsa): bound Torch decode fallback key workspace

Gather and score compressed keys in page-aligned chunks with a 256 MiB
FP32 K budget. Preserve FP32 scoring, full logits, masking and
capture-static shapes without materializing all per-query keys at once.

Handle empty batches/capacity and truncated or padded output lengths.

* feat(qsa): log actual indexer backend dispatch

Add the opt-in SGLANG_LOG_QSA_INDEXER_BACKEND diagnostic flag. Log the
selected PyHIP, Torch or TileLang path after the indexer returns, with
layer, forward mode and query row count.

Deduplicate by layer instance, mode and backend. Keep logging disabled
by default and avoid import hooks or GPU synchronization.

* update scripts

* update test

* Update default model path in argument parser

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* test(qsa): cover chunked decode reference workspace

Lower the FP32 key budget to force multiple page chunks and compare
against a dense reference. Cover reordered pages, different context
lengths, partial-page truncation, padded output and empty inputs.

Add a 1M-capacity CUDA Graph workspace bound and replay checks with
changed query, cache, page-table and length inputs.

* Change TestQsaDecodeWorkspace base class

Refactor TestQsaDecodeWorkspace to inherit from CustomTestCase.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* revert(qsa): drop chunked Torch decode fallback and workspace tests

Revert the chunked reference implementation and its dedicated workspace
regressions. Keep the PyHIP 1M/YaRN/TP-split integration and actual backend
dispatch logging unchanged.

Reverts 14c5729,
7edc822, and
e255acb.

* update script

* test(qsa): validate graph selection beyond 65536 compressed keys

Compare real compressed lengths of 66049 and 250001 against an independent Torch reference, with reordered pages, masked tail keys, and changing lengths during CUDA graph replay.

* chore(scripts): remove redundant long-context request helpers

Use the built-in serving benchmark with token-ID prompts, zero client warmups, and an explicit cache flush for long-context reproduction. Validated a cold 1000000-token input and 350-token output on TP2 with YaRN.

* build(rocm): pin PyHIP to merged QSA API revision

---------

Co-authored-by: Luo Cheng <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
(cherry picked from commit 286cd46)

* fix(qsa): adapt backports to qwen4 v0.5.21 interfaces

* chore(scripts): move Qwen3.8 1M launcher to evaluation

* docs: add Qwen3.8 TP1 and 1M launch examples

---------

Co-authored-by: Luo Cheng <[email protected]>
Co-authored-by: Ethan Yang <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
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.

5 participants