Skip to content

Commit ed349b9

Browse files
authored
Mark end of version 17 and 18 C API (#20671)
Additionally, these versions are safeguarded by the `static_assert`.
1 parent d72b476 commit ed349b9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

onnxruntime/core/session/onnxruntime_c_api.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,10 +2723,14 @@ static constexpr OrtApi ort_api_1_to_18 = {
27232723
&OrtApis::SetDeterministicCompute,
27242724
&OrtApis::KernelContext_ParallelFor,
27252725
&OrtApis::SessionOptionsAppendExecutionProvider_OpenVINO_V2,
2726+
// End of Version 17 - DO NOT MODIFY ABOVE (see above text for more information)
2727+
27262728
&OrtApis::SessionOptionsAppendExecutionProvider_VitisAI,
27272729
&OrtApis::KernelContext_GetScratchBuffer,
27282730
&OrtApis::KernelInfoGetAllocator,
2729-
&OrtApis::AddExternalInitializersFromFilesInMemory};
2731+
&OrtApis::AddExternalInitializersFromFilesInMemory
2732+
// End of Version 18 - DO NOT MODIFY ABOVE (see above text for more information)
2733+
};
27302734

27312735
// OrtApiBase can never change as there is no way to know what version of OrtApiBase is returned by OrtGetApiBase.
27322736
static_assert(sizeof(OrtApiBase) == sizeof(void*) * 2, "New methods can't be added to OrtApiBase as it is not versioned");
@@ -2755,7 +2759,8 @@ static_assert(offsetof(OrtApi, ReleaseCANNProviderOptions) / sizeof(void*) == 22
27552759
static_assert(offsetof(OrtApi, GetSessionConfigEntry) / sizeof(void*) == 238, "Size of version 14 API cannot change");
27562760
static_assert(offsetof(OrtApi, GetBuildInfoString) / sizeof(void*) == 254, "Size of version 15 API cannot change");
27572761
static_assert(offsetof(OrtApi, KernelContext_GetResource) / sizeof(void*) == 265, "Size of version 16 API cannot change");
2758-
static_assert(offsetof(OrtApi, SetUserLoggingFunction) / sizeof(void*) == 266, "Size of version 17 API cannot change");
2762+
static_assert(offsetof(OrtApi, SessionOptionsAppendExecutionProvider_OpenVINO_V2) / sizeof(void*) == 275, "Size of version 17 API cannot change");
2763+
static_assert(offsetof(OrtApi, AddExternalInitializersFromFilesInMemory) / sizeof(void*) == 279, "Size of version 18 API cannot change");
27592764

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

0 commit comments

Comments
 (0)