Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the N parameter from set_kv_buffer and the Triton kernel masked_set_kv_buffer_kernel, eliminating the boundary check if pid >= N: return inside the kernel. This optimization prevents unnecessary kernel recompilations and specializations for different batch sizes. Additionally, a new unit test file test_masked_set_kv_buffer.py is added to verify the kernel's correctness and confirm that varying batch sizes do not create extra specializations. No review comments were provided for this pull request.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/tag-and-rerun-ci |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16f59727c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| from sglang.srt.mem_cache.memory_pool import masked_set_kv_buffer_kernel | ||
| from sglang.test.ci.ci_register import register_cuda_ci | ||
|
|
||
| register_cuda_ci(est_time=15, stage="base-b-kernel-unit", runner_config="1-gpu-small") |
There was a problem hiding this comment.
Register the kernel test in a dispatchable suite
This registration resolves to base-b-kernel-unit-test-1-gpu-small, but the CUDA suite allowlist in test/run_suite.py only includes the kernel-unit suites for 1-gpu-large, 4-gpu-b200, and 8-gpu-h200; validate_all_suites() rejects any registered test whose effective suite is not in that list before running a shard. In CI contexts that execute test/run_suite.py, adding this file makes collection fail with an invalid-suite error instead of running the tests, so this should use an existing dispatchable suite such as runner_config="1-gpu-large" or add the corresponding workflow/run_suite support.
Useful? React with 👍 / 👎.
|
@xiezhq-hermann @ispobock This addresses the CUDA-side specialization issue in #31568. The committed regression test now passes through the normal SGLang import path on an RTX 3090 with the current Could you please review it and add the |
|
CI update after fixing the test registration:
Could a maintainer please trigger a failed-only rerun for the standard CI workflows? @xiezhq-hermann @ispobock Thank you. |
d1b7bf4 to
f869299
Compare
Motivation
masked_set_kv_buffer_kernelreceivesNas atl.constexpr, althoughNonly guards
pid >= Nand the launch grid is exactly(N,). The guard cannotfire, while every distinct write batch size creates another Triton kernel
specialization.
This PR addresses the CUDA-side finding in #31568. The independent XPU
NT_BUCKETcleanup is intentionally left out so that it can be validated onthe appropriate hardware.
Modifications
Nfrom the Triton kernel signature and its call site.pid >= Nbranch.verifies masked KV writes exactly, and asserts that the second launch reuses
the first in-memory Triton specialization.
base-b-test-1-gpu-largesuite and provide its direct pytestentry point used by the CI runner.
Accuracy Tests
Reproduction on an NVIDIA RTX 3090 (SM86):
The committed test was also run through the normal SGLang package import path
in an environment aligned with current
main:Full registry validation also succeeds and resolves the test to:
The test checks that selected key/value rows are copied exactly, masked-out rows
remain untouched, and changing only the grid size does not add a specialization.
Speed Tests and Profiling
This removes one redundant compilation/cache entry for each distinct
Nafterthe first launch. No model-level throughput change is expected because the
generated write kernel and launch grid are otherwise unchanged.
Checklist
base-b-test-1-gpu-large.Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ci.CI States
Latest PR Test (Base): ❌ Run #32210758233
Latest PR Test (Extra): ❌ Run #32210758198