feat(sampling): Add async ring buffer and Spyre-optimized samplers - #1046
Conversation
|
👋 Hi! Thank you for contributing. We also recommend installing prek and configuring it to check your code before every local commit. |
3bdd387 to
91e99a1
Compare
|
Otherwise looks good to me. Pele tests passed fine. Maybe we wanted to run e2e tests on card once? @gkumbhat can you please take a look at this once? |
|
Thank you for your review @dilipgb, let's run another round of tests to get this PR green |
|
@joerunde would take look at this PR once? |
|
Can we rebase the PR against the new version of vLLM to check there is no interaction? |
Implement asynchronous exponential noise pre-sampling to optimize the latency-critical sampling path for Spyre hardware. Signed-off-by: David Holtz <56723830+dmholtz@users.noreply.github.com>
…ll ranks. Previously, the full sampling path was redundantly executed on every rank and the results of non-zero ranks were discarded. In the context of CPU bound sampling, this wastes CPU resources and can be streamlined by sampling only on TP rank 0, broadcasting results to all ranks to initialize the next step. Signed-off-by: David Holtz <56723830+dmholtz@users.noreply.github.com>
…rick. Currently, the softmax runs on CPU critical path, adding few milliseconds of runtime to every decode. This change rewrites the score computation by transfering the computation to log-space without changing the relative order of tokens. Co-authored-by: Jan Hofmeier <jan.hofmeier@de.ibm.com> Signed-off-by: David Holtz <56723830+dmholtz@users.noreply.github.com>
|
@tdoublep I rebased this PR to main, it went smooth without any conflicts. Could you please re-run the tests to confirm the behavior with vLLM v0.27.1? |
tdoublep
left a comment
There was a problem hiding this comment.
LGTM - thanks for the awesome work!
|
@dilipgb Please take a final look (you requested changes, which is blocking merge). Tests are passing against latests main |
R3hankhan123
left a comment
There was a problem hiding this comment.
1-2 nits rest it looks good to me
Signed-off-by: dmholtz <56723830+dmholtz@users.noreply.github.com>
Signed-off-by: dmholtz <56723830+dmholtz@users.noreply.github.com>
|
@R3hankhan123 Thanks for your review, I addressed both NITs. |
Description
This PR optimizes the Spyre sampling path in three stages to remove the main latency bottlenecks from token generation while preserving correctness.
To ease the review, each stage is a separate commit.
Problem
The default sampling path spends too much time in the critical decoding loop on CPU-heavy work:
Solution
Stage 1: Async noise pre-sampling
exponential_()calls in the critical path with zero-copy buffer access.SpyreTopKTopPSamplerandSpyreSamplerintegration for the Spyre path.Stage 2: Single-rank sampling on TP
Stage 3: Log-space Gumbel sampling
argmax(logits - log_noise)instead ofargmax(log(softmax(logits)) + log_noise).Key Insight
The three optimizations are complementary: async noise generation removes expensive background work from the hot loop, TP rank gating removes redundant computation and divergence, and log-space Gumbel sampling removes softmax entirely. Together they reduce sampling latency without changing output distribution.
Performance tests show that OTPS increase by >30% for Granite 4.1 while staying in a fixed, thight compute budget.
Related Issues
n/a
Test Plan
Checklist
bash format.sh)Signed-off-by:line (DCO compliance)