[tmva][sofie] Add ONNX Gelu operator support #20876
Open
+236
−0
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.
This Pull request:
This PR implements the GELU operator (Opset 20) for TMVA/SOFIE.
Changes or fixes:
This PR implements the
Geluoperator for the SOFIE inference engine, targeting ONNX Opset 20 specification. This addition extends SOFIE's support to modern transformer architectures which rely on the Gaussian Error Linear Unit.Technical Approach
0x1.6a09e667f3bcdp-1and0.5).RModelParser_ONNXregisters theGelunode and explicitly validates attributes to reject unsupported approximations (liketanh), ensuring no silent numerical mismatches.Key Features:
Bit-Exact Reproducibility: - Uses hexfloat constants ($1/\sqrt{2}$ ) to guarantee identical floating-point behavior across all IEEE-754 platforms (x86/ARM/PPC).
0x1.6a09e667f3bcdp-1forstd::sqrt(2)division which is susceptible to compiler-specific fast-math optimizations.Safety: - Parser explicitly rejects
approximate='tanh'(unsupported) to prevent silent model degradation.Validation (New):
TestSofieGELU.cxx(GTest).Validation
Validation was performed using a custom Opset-20 ONNX graph constructed via
onnx.helperto prevent the operator decomposition often produced bytorch.onnx.export.erfimplementation.0.0) against the ground truth on the test interval between[-3.0, 3.0].Checklist:
This PR fixes #
cc: @lmoneta @sanjibansg @omazapa