-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[CXX] Introduce C++ API for new C entry points #25897
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
Conversation
…/onnxruntime into yuslepukhin/cxx_ep_api
Start on OpAttr
While it properly checks for the mapping offset to be granularity
aligned, it calculates it as page aligned.
Also, we donot need to align big tensors to windwows granularity or anything
that is platform dependent. Set it to 4096 for all platforms.
Granularity matters only for calculating mapping address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Introduces C++ API wrappers for new C entry points to enable exception-safe coding in C++ codebase by replacing raw C API calls with C++ wrappers that provide RAII and exception handling.
- Creates C++ wrapper classes for graph, node, value info, and operator attribute APIs
- Implements exception-safe methods that wrap existing C API calls
- Migrates test code from raw C API usage to new C++ wrappers
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| onnxruntime/test/shared_lib/test_model_builder_api.cc | Updates method calls from Name() to GetName() for graph inputs |
| onnxruntime/test/ep_graph/test_ep_graph_topo_sort.cc | Replaces C API calls with C++ wrappers and adds exception handling |
| onnxruntime/test/ep_graph/test_ep_graph.cc | Migrates from raw C API to C++ wrapper APIs for graph traversal and attribute access |
| onnxruntime/test/autoep/library/example_plugin_ep_utils.h | Updates function signature to use C++ wrapper types |
| onnxruntime/test/autoep/library/example_plugin_ep_utils.cc | Implements exception-safe versions using C++ wrappers |
| onnxruntime/test/autoep/library/example_plugin_ep.cc | Adds C++ API initialization and migrates kernel implementation |
| onnxruntime/test/autoep/library/ep.h | Fixes duplicate class qualifier |
| onnxruntime/test/autoep/library/ep.cc | Comprehensive migration to C++ API with exception handling |
| include/onnxruntime/core/session/onnxruntime_cxx_inline.h | Implements inline methods for new C++ wrapper classes |
| include/onnxruntime/core/session/onnxruntime_cxx_api.h | Defines new C++ wrapper classes and type aliases |
| include/onnxruntime/core/providers/utils/ort_graph_to_proto.h | Migrates utility functions to use C++ wrappers |
Comments suppressed due to low confidence (2)
onnxruntime/test/ep_graph/test_ep_graph.cc:1
- Logic error: The condition should be
op_type == "Mul"instead ofop_type != "Mul". The current condition will process non-Mul nodes and skip Mul nodes, which is opposite to the intended behavior based on the subsequent code that expects Mul operations.
// Copyright (c) Microsoft Corporation. All rights reserved.
onnxruntime/test/autoep/library/ep.cc:1
- Comment parameter name is misspelled. Should be 'value_info' instead of '/* value_info */'.
// Copyright (c) Microsoft Corporation. All rights reserved.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
### Description <!-- Describe your changes. --> Create or augment existing C++ API for new entry points ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Enable exception safe coding in C++ codebase.
### Description Cherry-pick the following PRs: #25943 #25937 #25917 #25909 #25898 #25897 #25888 #25881 #25830 #25619 #25575 #25572 #25558 #25530 #25474 #25455 #25110 Also two dependent PRs for qMoE cpu: #25877 #25822 --------- Co-authored-by: xiaomsft <[email protected]> Co-authored-by: Xiaoyan Hu <[email protected]> Co-authored-by: Akshay Sonawane <[email protected]> Co-authored-by: Kunal Vaishnavi <[email protected]> Co-authored-by: Pradeep Sakhamoori <[email protected]> Co-authored-by: mingyue <[email protected]> Co-authored-by: Maximilian Müller <[email protected]> Co-authored-by: Adrian Lizarraga <[email protected]> Co-authored-by: Dmitri Smirnov <[email protected]> Co-authored-by: Emmanuel <[email protected]> Co-authored-by: Emmanuel Assumang <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: praneshgo <[email protected]> Co-authored-by: Hariharan Seshadri <[email protected]> Co-authored-by: Jing Fang <[email protected]> Co-authored-by: Ishwar Raut <[email protected]>
Description
Create or augment existing C++ API for new entry points
Motivation and Context
Enable exception safe coding in C++ codebase.