Skip to main content

ABI_VERSION

Constant ABI_VERSION 

Source
pub const ABI_VERSION: u32 = 2;
Expand description

Protocol version, checked by TensorDyn::import_descriptor after the payload has already been read as this build’s TensorDesc.

This is the second line of defense, not the gate: it cannot catch a producer whose TensorDesc is a different size, since the out-of-bounds/misaligned read has already happened by the time this field could be inspected. The capsule name (edgefirst_tensor_v2, see INTEROP.md’s Versioning section) is what actually gates that – checked by PyCapsule::pointer_checked before any byte of the payload is read. DLPack reached the same conclusion after shipping an unversioned dltensor capsule and finding no upgrade path: its v1.0 fix added both a version field and a new capsule name, because the field alone is unreadable until the layout is already known.

This field covers the case the name rule does not: a change to what a same-sized, same-layout TensorDesc’s fields mean. Version 2 renumbered TensorDesc::kind onto the crate::TensorMemory codes (version 1 had its own numbering, in which 1 meant dma-buf), so a version-1 descriptor is refused rather than read with the wrong kinds.