Skip to content

Turn kernel activity off while a context has PC sampling enabled - #56

Draft
gnurizen wants to merge 1 commit into
mainfrom
fix/pc-no-kernel-activity
Draft

gnurizen wants to merge 1 commit into
mainfrom
fix/pc-no-kernel-activity

Conversation

@gnurizen

Copy link
Copy Markdown
Contributor

When CUPTI CONCURRENT_KERNEL activity runs while a context has PC sampling enabled, vLLM and SGLang lose most of their throughput. This PR turns kernel activity off for the process from the moment the first context is set up for PC sampling until the last one is finalized.

Measured

CoreWeave 8x RTX PRO 6000 (driver 580), Qwen3-8B, vllm bench serve. Both arms ran the same experiment build at agent window 30 ms / gap 10 s, on freshly started servers. Throughput in tok/s at C=8, one 4-minute rep per column:

PC sampling off on, rep 1 rep 2 rep 3
vLLM, activity on 569 427 271 192
vLLM, activity off while PC sampling is enabled 570 579 576 574
SGLang, activity on 572 472 288 216
SGLang, activity off while PC sampling is enabled 572 573 573 573

C=64 shows the same pattern.

Trade-off

While a process has PC sampling enabled it emits no kernel_executed, kernel_stats or cuda_activity_batch. Without a disable between windows, that is from the first window on. The plan is to time sampled launches with CUDA events instead, which doesn't need CUPTI activity at all (draft PR to follow).

Not yet verified

  • PC samples with activity off: the run didn't check that PC samples still reach the agent.
  • Activity off only during windows: the tested behaviour is "activity off while PC sampling is enabled". That variant wasn't tested.
  • Concurrency: cuptiActivityDisable is process-wide and is called from the launch callback that sets the context up. It isn't stress-tested with several contexts or alongside concurrent completeBuffer calls.
  • Tests: no mock test yet. The mock CUPTI logs enable and disable calls, so test-agent-ctl could assert them.
  • Build: this branch builds. The GPU numbers come from the equivalent environment-gated experiment build.

CUPTI CONCURRENT_KERNEL activity together with PC sampling enabled on a
context made vLLM and SGLang lose 50-75% of their throughput for about
15 minutes after PC sampling first started, and several percent after
that. CUPTI's activity worker thread saturated a core and stopped
delivering activity buffers. Disabling PC sampling between windows and
skipping the synchronize inside the gap did not change it.

With activity off from the moment a context is set up for PC sampling
until it is finalized, throughput stayed within about 1% of PC sampling
off (same build, both arms, agent window 30 ms / gap 10 s).

So the first context set up for PC sampling turns CONCURRENT_KERNEL
activity off for the process and the last one finalized turns it back
on. While it is off there are no kernel_executed, kernel_stats or
activity_batch events from the process.
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