Skip to content

Conversation

lmoneta
Copy link
Member

@lmoneta lmoneta commented Sep 5, 2025

This PR introduces a time-based profiler for the SOFIE inference engine. It provides developers with the tools to analyze the performance of generated C++ models by measuring the execution time of each individual operator, as well as the total inference time.

Changes or fixes:

A new option, SOFIE::Options::kProfile, is added to the RModel::Generate() method to enable the feature.
When enabled, a new RModelProfiler helper class instruments the generated doInfer() method with std::chrono timers.
Utility functions like PrintProfilingResults() and GetOpAvgTime() are added to the generated Session struct to access the collected timing data.
Checklist:

Tested changes locally by running inference in a loop and verifying the timing results.
updated the docs (if necessary)

This PR replaces #19558 by fixing the conflicts with rebasing to master

@dpiparo
Copy link
Member

dpiparo commented Sep 5, 2025

Is there perhaps a way in which we could test this new nice feature?

Copy link

github-actions bot commented Sep 5, 2025

Test Results

    16 files      16 suites   2d 20h 55m 36s ⏱️
 3 659 tests  3 649 ✅   0 💤 10 ❌
57 117 runs  57 001 ✅ 106 💤 10 ❌

For more details on these failures, see this check.

Results for commit 8639e94.

@lmoneta
Copy link
Member Author

lmoneta commented Sep 5, 2025

Yes, I think we should add a tutorial for this, generting code instrumented with timers and then producing the results.
@olia110 can you add this new tutorial?

@olia110
Copy link
Contributor

olia110 commented Sep 5, 2025

Yes, thank you. I will look how to add some testing and will add a tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants