Skip to main content

validate_destination_layout

Function validate_destination_layout 

Source
pub fn validate_destination_layout(
    dims: &[usize],
    strides: &[isize],
) -> Result<ValidatedDestinationLayout>
Expand description

Validate destination injectivity and return the replay marker.

Runs the exact (allocation-free pairwise, then spilling) injectivity check, so every injective layout the other kernel entry points accept is accepted here. Kernel families that need the marker for more than one step (for example validating shapes and then taking a specialization) should call this once and pass the marker on instead of re-running the check.

ยงErrors

Returns StridedError::NonInjectiveOutputLayout when the layout cannot be proven representable and injective: two distinct logical indices of dims name the same offset under strides, or the element count or the address span is too large to represent. A rejected layout need not be colliding.