Skip to content

Conversation

@yuslepukhin
Copy link
Member

Description

Create or augment existing C++ API for new entry points

Motivation and Context

Enable exception safe coding in C++ codebase.

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.
Copy link
Contributor

Copilot AI left a 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 of op_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.

@yuslepukhin yuslepukhin marked this pull request as ready for review August 29, 2025 20:19
@jywu-msft jywu-msft merged commit ef60e38 into main Sep 3, 2025
91 of 94 checks passed
@jywu-msft jywu-msft deleted the yuslepukhin/cxx_api_phase_ii branch September 3, 2025 16:00
tianleiwu pushed a commit that referenced this pull request Sep 4, 2025
### 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.
@tianleiwu tianleiwu added cherry-picked Cherry-picked for a cherrypicks branch and removed release:1.23.0 labels Sep 4, 2025
jywu-msft pushed a commit that referenced this pull request Sep 5, 2025
### 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked Cherry-picked for a cherrypicks branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants