root icon indicating copy to clipboard operation
root copied to clipboard

[tmva][sofie] Added RModelProfiler and named ROperator s

Open fsossai opened this issue 4 years ago • 1 comments

Profiler for inspecting C++ models generated with SOFIE

Added a new class called RModelProfiler that allows to generate an hardcoded C++ header that automatically measures the time that each operator took during one or more runs of the infer function. In other words it profiles the model by means of code instrumentation.

Under the hood

RModelProfiler is a friend class of RModel that initializes a private reference to an existing RModel object. When the code is generated through RModelProfiler::Generate() (rewritten to inject profiling code in between operators), the latter access the private member fGC, thus generating the model directly into the RModel object. In the generated code, profiling info such as time (microseconds) are saved in ::profiler_results.

Affine changes

  • Added public member std::string name in ROperator (e.g. Gemm_1, ..).
  • Changed make_ROperator() so that is assigns name of the operator with the one it had within the original ONNX model.
  • Added an example of how to use the profiler in README.md.

fsossai avatar Sep 03 '21 15:09 fsossai

Can one of the admins verify this patch?

phsft-bot avatar Sep 03 '21 15:09 phsft-bot