[tmva][sofie] Make all ROperator headers private implementation details and remove custom operator support - #23443
Merged
guitargeek merged 2 commits intoSep 22, 2026
Conversation
The custom-operator feature (ROperator_Custom and RSofieReader:: AddCustomOperator, originally from root-project#11065 — thanks for the nice work!) let users splice a hand-written C++ header into the generated inference code. It is not needed anymore and kept alive as dead weight: - An ONNX model containing an op SOFIE does not know cannot be rescued this way: the ONNX parser throws unconditionally on unknown op types, and there is no dispatch from the parser to ROperator_Custom. The only possible use was appending an op to a model that already parsed. - Nothing in the repository uses it anymore: the Keras-parser test that motivated it was removed together with that parser, and no test or tutorial covers the surviving RSofieReader hook. - With the SOFIE ROperator headers made private implementation details, the feature cannot work in an installed ROOT at all, since the interpreted code it generates needs ROperator_Custom.hxx. Missing ONNX operators should be implemented in SOFIE itself instead. RModel_Base::AddNeededCustomHeader stays: it is general code-generation plumbing also used by the Random and Softmax operators.
None of the ROperator*.hxx headers (including ROperator.hxx itself) are copied to the build tree include directory or installed anymore. This greatly reduces the public API contract of SOFIE: the operator layer is an implementation detail of the code generation that downstream code should not depend on. The CMake change requires NO_GLOB_HEADERS, because otherwise all headers under inc/ are globbed and installed regardless of the HEADERS list. RModel.hxx can no longer include ROperator.hxx, so ROperator is now only forward-declared in the public header. Two things follow from this: - The std::unique_ptr<ROperator> storage needs the out-of-line deleter ROperatorDeleter, and RModel destructor/move operations are defined out-of-line in RModel.cxx. Without this, every translation unit destroying an RModel (and the rootcling dictionary) would need the complete ROperator type. Since the operator headers are resolved via the build-interface include directory of the library targets, only sources of ROOTTMVASofie and ROOTTMVASofieParser see them. RModelParser_ONNX.cxx now includes TMVA/ROperator.hxx explicitly.
Test Results 23 files 23 suites 3d 16h 10m 35s ⏱️ Results for commit 3d672ba. |
dpiparo
approved these changes
Sep 22, 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.
All these
ROperator*.hxxheaders are implementation details of the one feature that we expect SOFIE to provide: rock-solid emission of CPU C++ code for ONNX models. Therefore, these numerous headers should not be part of the public interface.That also means that the feature to add custom operators goes away. There are no custom operator extensions in ONNX, so if we stick to what SOFIE in ROOT should provide it's not needed anyway.