-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix IsOnnxStaticRegistrationDisabled() inline function breaking schema registration in external modules #7409
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
base: main
Are you sure you want to change the base?
Conversation
…issue Co-authored-by: justinchuby <[email protected]>
…mentation Co-authored-by: justinchuby <[email protected]>
Signed-off-by: Justin Chu <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7409 +/- ##
=======================================
Coverage 54.48% 54.48%
=======================================
Files 512 512
Lines 31929 31929
Branches 2868 2868
=======================================
Hits 17397 17397
Misses 13749 13749
Partials 783 783 ☔ View full report in Codecov by Sentry. |
|
@eKevinHoang does this look ok to you? Thanks |
|
@gramalingam for approval. Thanks |
|
@copilot can you address the feedback/comment? |
Clarify the responsibilities of the linking module when static registration is disabled vs enabled, as requested in code review feedback. Co-authored-by: gramalingam <[email protected]>
Head branch was pushed to by a user without write access
Signed-off-by: Justin Chu <[email protected]>
Fix IsOnnxStaticRegistrationDisabled() inline function breaking schema registration in external modules
Issue Summary:
The
IsOnnxStaticRegistrationDisabled()function was defined as an inline function inonnx/defs/operator_sets.hwith behavior based on compile-time macro__ONNX_DISABLE_STATIC_REGISTRATION. This breaks encapsulation when external projects (like ONNX Runtime) use prebuilt ONNX libraries, as the function's return value depends on the caller's compile-time macro rather than ONNX's actual build configuration.Root Cause:
Inline functions with preprocessor-dependent behavior are expanded at the call site, causing the function to use the caller's compile-time configuration instead of the library's build configuration.
Solution:
Changes Made:
Documentation Added:
Added detailed comments explaining:
RegisterOnnxOperatorSetSchema()for ai.onnx domainRegisterOnnxMLOperatorSetSchema()for ai.onnx.ml domainRegisterOnnxTrainingOperatorSetSchema()for ai.onnx.training domainRegisterOnnxPreviewOperatorSetSchema()for ai.onnx.preview domainTesting Results:
SchemaRegistrationTest.DisabledOnnxStaticRegistrationAPICallvalidates correct behaviorImpact:
IsOnnxStaticRegistrationDisabled()always reflects ONNX library's actual build configurationFixes #7399
Original prompt
Fixes #7399
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.