Skip to content

Commit e8b054c

Browse files
Update ORT_API_VERSION to 24 (#26418)
### Description - Updates the `ORT_API_VERSION` value in onnxruntime_c_api.h to `24`. - Edit documentation for the `TensorTypeAndShape_HasShape` API function to indicate the correct API version (1.24). - Adds `static_assert` to ensure that API functions for 1.23 are not added or removed. ### Motivation and Context The version of ORT was previously updated to 1.24.0 but we forgot to update `ORT_API_VERSION`.
1 parent 0600482 commit e8b054c

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

include/onnxruntime/core/session/onnxruntime_c_api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
*
3939
* This value is used by some API functions to behave as this version of the header expects.
4040
*/
41-
#define ORT_API_VERSION 23
41+
#define ORT_API_VERSION 24
4242

4343
#ifdef __cplusplus
4444
extern "C" {
@@ -6584,7 +6584,7 @@ struct OrtApi {
65846584
* \param[in] info The OrtTensorTypeAndShapeInfo instance.
65856585
* \return true if the tensor has shape information, false otherwise.
65866586
*
6587-
* \since Version 1.23
6587+
* \since Version 1.24
65886588
*/
65896589
ORT_API_T(bool, TensorTypeAndShape_HasShape, _In_ const OrtTensorTypeAndShapeInfo* info);
65906590
};

onnxruntime/core/session/compile_api.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,14 @@ static constexpr OrtCompileApi ort_compile_api = {
342342
&OrtCompileAPI::ModelCompilationOptions_SetGraphOptimizationLevel,
343343
&OrtCompileAPI::ModelCompilationOptions_SetOutputModelWriteFunc,
344344
&OrtCompileAPI::ModelCompilationOptions_SetOutputModelGetInitializerLocationFunc,
345+
// End of Version 23 - DO NOT MODIFY ABOVE
345346
};
346347

347348
// checks that we don't violate the rule that the functions must remain in the slots they were originally assigned
348349
static_assert(offsetof(OrtCompileApi, CompileModel) / sizeof(void*) == 8,
349350
"Size of version 22 Api cannot change"); // initial version in ORT 1.22
351+
static_assert(offsetof(OrtCompileApi, ModelCompilationOptions_SetOutputModelGetInitializerLocationFunc) / sizeof(void*) == 13,
352+
"Size of version 23 of Api cannot change");
350353

351354
ORT_API(const OrtCompileApi*, OrtCompileAPI::GetCompileApi) {
352355
return &ort_compile_api;

onnxruntime/core/session/model_editor_c_api.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ static constexpr OrtModelEditorApi ort_model_editor_api = {
393393
&OrtModelEditorAPI::SessionGetOpsetForDomain,
394394
&OrtModelEditorAPI::ApplyModelToModelEditorSession,
395395
&OrtModelEditorAPI::FinalizeModelEditorSession,
396+
// End of Version 22 - DO NOT MODIFY ABOVE
396397
};
397398

398399
// checks that we don't violate the rule that the functions must remain in the slots they were originally assigned

onnxruntime/core/session/onnxruntime_c_api.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4228,6 +4228,8 @@ static constexpr OrtApi ort_api_1_to_24 = {
42284228
&OrtApis::Graph_GetModelMetadata,
42294229
&OrtApis::GetModelCompatibilityForEpDevices,
42304230
&OrtApis::CreateExternalInitializerInfo,
4231+
// End of Version 23 - DO NOT MODIFY ABOVE (see above text for more information)
4232+
42314233
&OrtApis::TensorTypeAndShape_HasShape,
42324234
};
42334235

@@ -4264,6 +4266,7 @@ static_assert(offsetof(OrtApi, AddExternalInitializersFromFilesInMemory) / sizeo
42644266
static_assert(offsetof(OrtApi, SetEpDynamicOptions) / sizeof(void*) == 284, "Size of version 20 API cannot change");
42654267

42664268
static_assert(offsetof(OrtApi, GetEpApi) / sizeof(void*) == 317, "Size of version 22 API cannot change");
4269+
static_assert(offsetof(OrtApi, CreateExternalInitializerInfo) / sizeof(void*) == 389, "Size of version 23 API cannot change");
42674270

42684271
// So that nobody forgets to finish an API version, this check will serve as a reminder:
42694272
static_assert(std::string_view(ORT_VERSION) == "1.24.0",

onnxruntime/core/session/plugin_ep/ep_api.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,14 @@ static constexpr OrtEpApi ort_ep_api = {
230230
&OrtExecutionProviderApi::SyncStream_GetImpl,
231231
&OrtExecutionProviderApi::SyncStream_GetSyncId,
232232
&OrtExecutionProviderApi::GetSyncIdForLastWaitOnSyncStream,
233+
// End of Version 23 - DO NOT MODIFY ABOVE
233234
};
234235

235236
// checks that we don't violate the rule that the functions must remain in the slots they were originally assigned
236237
static_assert(offsetof(OrtEpApi, ReleaseEpDevice) / sizeof(void*) == 1,
237238
"Size of version 22 API cannot change"); // initial version in ORT 1.22
239+
static_assert(offsetof(OrtEpApi, GetSyncIdForLastWaitOnSyncStream) / sizeof(void*) == 15,
240+
"Size of version 23 API cannot change");
238241

239242
} // namespace OrtExecutionProviderApi
240243

0 commit comments

Comments
 (0)