Mark end of version 17 and 18 C API (#20671)

Additionally, these versions are safeguarded by the `static_assert`.
This commit is contained in:
Yi-Hong Lyu 2024-05-14 02:26:15 -07:00 committed by GitHub
parent d72b476723
commit ed349b9d9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2723,10 +2723,14 @@ static constexpr OrtApi ort_api_1_to_18 = {
&OrtApis::SetDeterministicCompute,
&OrtApis::KernelContext_ParallelFor,
&OrtApis::SessionOptionsAppendExecutionProvider_OpenVINO_V2,
// End of Version 17 - DO NOT MODIFY ABOVE (see above text for more information)
&OrtApis::SessionOptionsAppendExecutionProvider_VitisAI,
&OrtApis::KernelContext_GetScratchBuffer,
&OrtApis::KernelInfoGetAllocator,
&OrtApis::AddExternalInitializersFromFilesInMemory};
&OrtApis::AddExternalInitializersFromFilesInMemory
// End of Version 18 - DO NOT MODIFY ABOVE (see above text for more information)
};
// OrtApiBase can never change as there is no way to know what version of OrtApiBase is returned by OrtGetApiBase.
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
static_assert(offsetof(OrtApi, GetSessionConfigEntry) / sizeof(void*) == 238, "Size of version 14 API cannot change");
static_assert(offsetof(OrtApi, GetBuildInfoString) / sizeof(void*) == 254, "Size of version 15 API cannot change");
static_assert(offsetof(OrtApi, KernelContext_GetResource) / sizeof(void*) == 265, "Size of version 16 API cannot change");
static_assert(offsetof(OrtApi, SetUserLoggingFunction) / sizeof(void*) == 266, "Size of version 17 API cannot change");
static_assert(offsetof(OrtApi, SessionOptionsAppendExecutionProvider_OpenVINO_V2) / sizeof(void*) == 275, "Size of version 17 API cannot change");
static_assert(offsetof(OrtApi, AddExternalInitializersFromFilesInMemory) / sizeof(void*) == 279, "Size of version 18 API cannot change");
// So that nobody forgets to finish an API version, this check will serve as a reminder:
static_assert(std::string_view(ORT_VERSION) == "1.18.0",