Skip to content

Experimental C++ API update#29142

Open
edgchen1 wants to merge 4 commits into
mainfrom
edgchen1/experimental_c_api_update
Open

Experimental C++ API update#29142
edgchen1 wants to merge 4 commits into
mainfrom
edgchen1/experimental_c_api_update

Conversation

@edgchen1

Copy link
Copy Markdown
Contributor

Description

  • Split out C++ code into separate C++ experimental header onnxruntime_experimental_cxx_api.h. This can also contain other auxiliary experimental API-related C++ code.
  • Add throwing C++ experimental function accessors. The Get_X_FnOrThrow() variant throws an exception if the experimental API is unavailable in the build.

Motivation and Context

Improve experimental API ergonomics for C++.

edgchen1 and others added 4 commits June 16, 2026 20:23
Move the C++ accessor wrappers out of the experimental C header into a new C++ companion header (onnxruntime_experimental_cxx_api.h), keeping onnxruntime_experimental_c_api.h pure C. Add a throwing accessor variant (Get_..._FnOrThrow) alongside the existing nullable accessor; it throws Ort::Exception (ORT_NOT_IMPLEMENTED) when the experimental function is unavailable.

Split the mechanical, X-macro-generated per-function plumbing into _fns.h detail headers so each public header stays focused on its curated, hand-written surface. Enforce that the detail headers are only included through their public header via a scoped ORT_INCLUDING_* guard macro that triggers a #error otherwise.

Register the new headers in cmake, update the design doc, and update the tests to use the new headers and the throwing accessor.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Inline the experimental C typedef/name-constant macro pass and C++ nullable/FnOrThrow accessor passes into the public headers. Keep explicit section comments for auxiliary/custom code in each header.

Remove obsolete split detail headers and their installation entries from cmake. Update Experimental_C_API.md to document the restored two-header model and inline X-macro expansion approach.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@edgchen1 edgchen1 requested a review from jambayk June 17, 2026 19:23
@GopalakrishnanN GopalakrishnanN self-requested a review June 17, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant