[xla:ffi] Revert ABI version change

Also relax the FFI version check.

PiperOrigin-RevId: 821905272
This commit is contained in:
Eugene Zhulenev 2025-10-20 19:32:43 -07:00 committed by TensorFlower Gardener
parent 14710459b6
commit 5caf2a70d8
2 changed files with 4 additions and 4 deletions

View File

@ -67,7 +67,7 @@ XLA_FFI_DEFINE_STRUCT_TRAITS(XLA_FFI_Extension_Base, next);
// * Deleting a method or argument
// * Changing the type of an argument
// * Rearranging fields in the XLA_FFI_Api or argument structs
#define XLA_FFI_API_MAJOR 1
#define XLA_FFI_API_MAJOR 0
// Incremented when the interface is updated in a way that is potentially
// ABI-compatible with older versions, if supported by the caller and/or
@ -82,7 +82,7 @@ XLA_FFI_DEFINE_STRUCT_TRAITS(XLA_FFI_Extension_Base, next);
// Minor changes include:
// * Adding a new field to the XLA_FFI_Api or argument structs
// * Renaming a method or argument (doesn't affect ABI)
#define XLA_FFI_API_MINOR 0
#define XLA_FFI_API_MINOR 2
struct XLA_FFI_Api_Version {
size_t struct_size;

View File

@ -384,8 +384,8 @@ static absl::Status RegisterHandler(absl::string_view name,
// Check the API versions.
TF_ASSIGN_OR_RETURN(XLA_FFI_Metadata metadata, GetMetadata(bundle.execute));
const XLA_FFI_Api_Version& api_version = metadata.api_version;
if (api_version.major_version != XLA_FFI_API_MAJOR ||
api_version.minor_version != XLA_FFI_API_MINOR) {
if (std::make_pair(api_version.major_version, api_version.minor_version) >
std::make_pair(XLA_FFI_API_MAJOR, XLA_FFI_API_MINOR)) {
return InvalidArgument(
"FFI handler registration for %s on platform %s (canonical %s) failed "
"because the handler's API version (%d.%d) is incompatible with the "