[CI] CPU kernel benchmark for ngram_match — DO NOT MERGE#7203
Draft
cloudforge1 wants to merge 13 commits intoPaddlePaddle:developfrom
Draft
[CI] CPU kernel benchmark for ngram_match — DO NOT MERGE#7203cloudforge1 wants to merge 13 commits intoPaddlePaddle:developfrom
cloudforge1 wants to merge 13 commits intoPaddlePaddle:developfrom
Conversation
Provides the missing 'CPU compute' column for ngram_match benchmarks. The GPU PR (PaddlePaddle#7136) only measured D2H/H2D transfer overhead, not actual CPU computation. Uses the same 5-group experiment dimensions so results are directly comparable. NOT FOR MERGE — benchmark-only PR for reference data.
|
Thanks for your contribution! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7203 +/- ##
==========================================
Coverage ? 74.19%
==========================================
Files ? 376
Lines ? 52941
Branches ? 8260
==========================================
Hits ? 39279
Misses ? 10910
Partials ? 2752
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This was referenced Apr 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
PR #7136 benchmarks the GPU
ngram_matchkernel but the "CPU path" columnonly measures D2H/H2D tensor copy overhead, not the actual C++ kernel
computation. This makes the reported speedup (14×–1,700×) misleading — the
real GPU-vs-CPU-compute speedup is much more modest (~0.3×–5.8× per NKNaN's
profiling data).
This PR adds a standalone CPU benchmark that calls the production C++
kernel (
ngram_match.cc/find_candidate_pred_tokens) with CPU-placedtensors, using the same 5-group experiment dimensions so the numbers are
directly comparable.
.ccfileis deleted in the GPU kernel branch; this benchmark exists on
developwhere both
.ccand.cucoexist.Modifications
tests/spec_decode/test_benchmark_ngram_cpu.py(354 lines)paddle.CPUPlace()tensors → dispatches to.ccC++ kernelUsage or Command
cd FastDeploy python tests/spec_decode/test_benchmark_ngram_cpu.pyAccuracy Tests
Not applicable — benchmark-only, no functional changes.
Checklist