#[repr(i32)]pub enum CustomCallApiVersion {
ApiVersionUnspecified = 0,
ApiVersionOriginal = 1,
ApiVersionStatusReturning = 2,
ApiVersionStatusReturningUnified = 3,
ApiVersionTypedFfi = 4,
}Expand description
The version of the API used by the custom call function. The signatures for each version are given below. TODO(b/189822916): Remove this enum when all clients are migrated to the status-returning API.
Variants§
ApiVersionUnspecified = 0
ApiVersionOriginal = 1
The first version of the API, with the following signatures:
CPU: void do_custom_call(void* out, const void** in);
GPU: void do_custom_call(CUstream stream, void** buffers, const char* opaque, size_t opaque_len);
ApiVersionStatusReturning = 2
When the ability to return success/failure status was added:
CPU: void do_custom_call(void* out, const void** in, XlaCustomCallStatus* status);
GPU: void do_custom_call(CUstream stream, void** buffers, const char* opaque, size_t opaque_len, XlaCustomCallStatus* status);
ApiVersionStatusReturningUnified = 3
Fixes the API signatures on the CPU side of the version STATUS_RETURNING by adding the opaque string so that the custom call API is consistent across CPUs and GPUs. For GPUs, the behaviors invoked by API_VERSION_STATUS_RETURNING and API_VERSION_STATUS_RETURNING_UNIFIED are the same.
CPU: void do_custom_call(void* out, const void** in, const char* opaque, size_t opaque_len, XlaCustomCallStatus* status);
GPU: void do_custom_call(CUstream stream, void** buffers, const char* opaque, size_t opaque_len, XlaCustomCallStatus* status);
ApiVersionTypedFfi = 4
Api version implementing XLA runtime custom call calling convention. These custom calls can be registered as an XLA runtime custom call (1) or as XLA runtime FFI binding (2).
This type of custom call uses custom ABI to pass type information along with custom call arguments. Also it passes buffer arguments together with data type, sizes and strides.
Example: (XLA runtime custom call)
absl::Status DoCustomCall(StridedMemrefView arg, float attr);
CustomCall::Bind(“custom_call”)
.Arg
(1) xla/runtime/custom_call.h (2) xla/runtime/ffi/ffi.h
Implementations§
Source§impl CustomCallApiVersion
impl CustomCallApiVersion
Sourcepub fn is_valid(value: i32) -> bool
pub fn is_valid(value: i32) -> bool
Returns true if value is a variant of CustomCallApiVersion.
Sourcepub fn from_i32(value: i32) -> Option<CustomCallApiVersion>
👎Deprecated: Use the TryFrom<i32> implementation instead
pub fn from_i32(value: i32) -> Option<CustomCallApiVersion>
Converts an i32 to a CustomCallApiVersion, or None if value is not a valid variant.
Source§impl CustomCallApiVersion
impl CustomCallApiVersion
Sourcepub fn as_str_name(&self) -> &'static str
pub fn as_str_name(&self) -> &'static str
String value of the enum field names used in the ProtoBuf definition.
The values are not transformed in any way and thus are considered stable (if the ProtoBuf definition does not change) and safe for programmatic use.
Sourcepub fn from_str_name(value: &str) -> Option<Self>
pub fn from_str_name(value: &str) -> Option<Self>
Creates an enum from field names used in the ProtoBuf definition.
Trait Implementations§
Source§impl Clone for CustomCallApiVersion
impl Clone for CustomCallApiVersion
Source§fn clone(&self) -> CustomCallApiVersion
fn clone(&self) -> CustomCallApiVersion
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CustomCallApiVersion
impl Debug for CustomCallApiVersion
Source§impl Default for CustomCallApiVersion
impl Default for CustomCallApiVersion
Source§fn default() -> CustomCallApiVersion
fn default() -> CustomCallApiVersion
Source§impl From<CustomCallApiVersion> for i32
impl From<CustomCallApiVersion> for i32
Source§fn from(value: CustomCallApiVersion) -> i32
fn from(value: CustomCallApiVersion) -> i32
Source§impl Hash for CustomCallApiVersion
impl Hash for CustomCallApiVersion
Source§impl Ord for CustomCallApiVersion
impl Ord for CustomCallApiVersion
Source§impl PartialEq for CustomCallApiVersion
impl PartialEq for CustomCallApiVersion
Source§impl PartialOrd for CustomCallApiVersion
impl PartialOrd for CustomCallApiVersion
Source§impl TryFrom<i32> for CustomCallApiVersion
impl TryFrom<i32> for CustomCallApiVersion
Source§type Error = UnknownEnumValue
type Error = UnknownEnumValue
Source§fn try_from(value: i32) -> Result<CustomCallApiVersion, UnknownEnumValue>
fn try_from(value: i32) -> Result<CustomCallApiVersion, UnknownEnumValue>
impl Copy for CustomCallApiVersion
impl Eq for CustomCallApiVersion
impl StructuralPartialEq for CustomCallApiVersion
Auto Trait Implementations§
impl Freeze for CustomCallApiVersion
impl RefUnwindSafe for CustomCallApiVersion
impl Send for CustomCallApiVersion
impl Sync for CustomCallApiVersion
impl Unpin for CustomCallApiVersion
impl UnwindSafe for CustomCallApiVersion
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)