Trait polars_arrow::types::simd::NativeSimd

source ·
pub unsafe trait NativeSimd: Sized + Default + Copy {
    type Native: NativeType;
    type Chunk: BitChunk;
    type Mask: FromMaskChunk<Self::Chunk>;

    const LANES: usize;

    // Required methods
    fn select(self, mask: Self::Mask, default: Self) -> Self;
    fn from_chunk(v: &[Self::Native]) -> Self;
    fn from_incomplete_chunk(
        v: &[Self::Native],
        remaining: Self::Native,
    ) -> Self;
    fn align(
        values: &[Self::Native],
    ) -> (&[Self::Native], &[Self], &[Self::Native]);
}
Expand description

A struct that lends itself well to be compiled leveraging SIMD

§Safety

The NativeType and the NativeSimd must have possible a matching alignment. e.g. slicing &[NativeType] by align_of<NativeSimd>() must be properly aligned/safe.

Required Associated Types§

source

type Native: NativeType

The NativeType of this struct. E.g. f32 for a NativeSimd = f32x16.

source

type Chunk: BitChunk

The type holding bits for masks.

source

type Mask: FromMaskChunk<Self::Chunk>

Type used for masking.

Required Associated Constants§

source

const LANES: usize

Number of lanes

Required Methods§

source

fn select(self, mask: Self::Mask, default: Self) -> Self

Sets values to default based on mask.

source

fn from_chunk(v: &[Self::Native]) -> Self

Convert itself from a slice.

§Panics
  • iff v.len() != T::LANES
source

fn from_incomplete_chunk(v: &[Self::Native], remaining: Self::Native) -> Self

creates a new Self from v by populating items from v up to its length. Items from v at positions larger than the number of lanes are ignored; remaining items are populated with remaining.

source

fn align(values: &[Self::Native]) -> (&[Self::Native], &[Self], &[Self::Native])

Returns a tuple of 3 items whose middle item is itself, and the remaining are the head and tail of the un-aligned parts.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl NativeSimd for days_msx8

source§

const LANES: usize = 8usize

§

type Native = days_ms

§

type Chunk = u8

§

type Mask = u8

source§

impl NativeSimd for f16x32

source§

const LANES: usize = 32usize

§

type Native = f16

§

type Chunk = u32

§

type Mask = u32

source§

impl NativeSimd for f32x16

source§

const LANES: usize = 16usize

§

type Native = f32

§

type Chunk = u16

§

type Mask = u16

source§

impl NativeSimd for f64x8

source§

const LANES: usize = 8usize

§

type Native = f64

§

type Chunk = u8

§

type Mask = u8

source§

impl NativeSimd for i8x64

source§

const LANES: usize = 64usize

§

type Native = i8

§

type Chunk = u64

§

type Mask = u64

source§

impl NativeSimd for i16x32

source§

const LANES: usize = 32usize

§

type Native = i16

§

type Chunk = u32

§

type Mask = u32

source§

impl NativeSimd for i32x16

source§

const LANES: usize = 16usize

§

type Native = i32

§

type Chunk = u16

§

type Mask = u16

source§

impl NativeSimd for i64x8

source§

const LANES: usize = 8usize

§

type Native = i64

§

type Chunk = u8

§

type Mask = u8

source§

impl NativeSimd for i128x8

source§

const LANES: usize = 8usize

§

type Native = i128

§

type Chunk = u8

§

type Mask = u8

source§

impl NativeSimd for i256x8

source§

const LANES: usize = 8usize

§

type Native = i256

§

type Chunk = u8

§

type Mask = u8

source§

impl NativeSimd for months_days_nsx8

source§

const LANES: usize = 8usize

§

type Native = months_days_ns

§

type Chunk = u8

§

type Mask = u8

source§

impl NativeSimd for u8x64

source§

const LANES: usize = 64usize

§

type Native = u8

§

type Chunk = u64

§

type Mask = u64

source§

impl NativeSimd for u16x32

source§

const LANES: usize = 32usize

§

type Native = u16

§

type Chunk = u32

§

type Mask = u32

source§

impl NativeSimd for u32x16

source§

const LANES: usize = 16usize

§

type Native = u32

§

type Chunk = u16

§

type Mask = u16

source§

impl NativeSimd for u64x8

source§

const LANES: usize = 8usize

§

type Native = u64

§

type Chunk = u8

§

type Mask = u8