-
Notifications
You must be signed in to change notification settings - Fork 284
Add performance metrics for StructuredOutput generation #2398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add performance metrics for StructuredOutput generation #2398
Conversation
Co-authored-by: Artur Paniukov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR instruments and exposes performance metrics for structured output generation, capturing grammar compilation and initialization timings across C++ and Python layers, along with tests and CI updates.
- Extend
RawPerfMetrics
andPerfMetrics
to include grammar compile and compiler-init times, with newSummaryStats
type. - Propagate timings through
StructuredOutputController
,Sampler
, andContinuousBatchingPipeline
in C++. - Bind new metrics to Python, update type stubs, add a test for structured output metrics, and tweak CI to skip it in precommit.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/python_tests/test_llm_pipeline.py | Added test_perf_metrics_with_structured_output test case |
src/python/py_utils.cpp | Handle StructuredOutputConfig in kwargs-to-AnyMap conversion |
src/python/py_perf_metrics.cpp | Bind and document new grammar compile/init metrics in Python |
src/python/openvino_genai/py_openvino_genai.pyi | Updated stub to include SummaryStats and new PerfMetrics methods |
src/cpp/src/sampling/structured_output/structured_output_controller.hpp | Record and expose init/compile times, added std::mutex field |
src/cpp/src/sampling/structured_output/structured_output_controller.cpp | Time grammar compilation and initialization |
src/cpp/src/sampling/sampler.hpp | Expose get_structured_output_times and clear method |
src/cpp/src/sampling/sampler.cpp | Implement structured-output timing getters |
src/cpp/src/perf_metrics.cpp | Implement calc_full_stat , bind new metrics, merge operations |
src/cpp/src/generation_config.cpp | Read structured_output_config from AnyMap |
src/cpp/src/continuous_batching/pipeline_impl.cpp | Clear and record structured-output metrics in batch pipeline |
src/cpp/include/openvino/genai/perf_metrics.hpp | Extend RawPerfMetrics /PerfMetrics definitions |
.github/workflows/linux.yml | Skip new structured-output test via -k filter |
Comments suppressed due to low confidence (2)
.github/workflows/linux.yml:906
- The
-k "not test_perf_metrics_with_structured_output"
filter prevents the new structured-output performance test from running in CI. Consider removing or adjusting this filter so the test executes under the appropriate job (e.g., nightly).
python3 -m pytest -v ${{ env.SRC_DIR }}/tests/python_tests/test_llm_pipeline.py -k "not test_perf_metrics_with_structured_output"
src/cpp/src/sampling/structured_output/structured_output_controller.hpp:87
- The code uses
std::mutex
but the header<mutex>
is not included in this file, which will cause a compilation error. Please add#include <mutex>
at the top.
std::mutex m_mutex;
There's merge conflict |
resolved |
208e873
Ticket: CVS-168960