Skip to main content

Module vector

Module vector 

Source
Expand description

Vector intrinsics — element-wise SIMD operations on f64 / i64 typed arrays.

Twelve typed-marshal entry points (__intrinsic_vec_*) are registered via register_typed_fn_N into the module returned by create_vector_intrinsics_module. Inputs are zero-copy Arc<Vec<f64>> (f64) / Arc<Vec<i64>> (i64) per the per-storage-variant body-type map in docs/defections.md 2026-05-07 zero-copy entry. Outputs project through ConcreteReturn::ArrayF64(Vec<f64>) / ConcreteReturn::ArrayI64(Vec<i64>) (output owned-clone — full output- zero-copy is deferred follow-on per the same entry’s α-ToSlot-dead-at- marshal-layer subsection).

Q2-marshal-fold-light migration of the vector cluster (intrinsics-typed-CC cluster, M-A scope per the entry’s three-stage Q2 lifecycle subsection). shape-vm dispatcher routing in vector_intrinsics.rs:25-39 is part of shape-vm cleanup workstream’s natural scope; not migrated here.

SIMD via the wide crate’s f64x4. Kernel SIMD helpers (simd_vec_*_f64, simd_vec_*_i64, i64_slice_to_f64) below are also used by shape-vm’s executor arithmetic dispatch; kept pub for that consumer.

Functions§

create_vector_intrinsics_module
Create the vector intrinsics module with all 12 typed-marshal entry points.
i64_slice_to_f64
Coerce an i64 slice to f64 for mixed-type arithmetic.
simd_vec_add_f64
Element-wise addition of two f64 slices using SIMD (f64x4). Returns an AlignedVec<f64>. Panics if lengths differ (debug only).
simd_vec_add_i64
Element-wise addition of two i64 slices with checked overflow. Returns Err if any element pair overflows.
simd_vec_div_f64
Element-wise division of two f64 slices using SIMD.
simd_vec_div_i64
Element-wise division of two i64 slices with checked overflow.
simd_vec_mul_f64
Element-wise multiplication of two f64 slices using SIMD.
simd_vec_mul_i64
Element-wise multiplication of two i64 slices with checked overflow.
simd_vec_scale_f64
Scalar broadcast: multiply each element by a scalar using SIMD.
simd_vec_sub_f64
Element-wise subtraction of two f64 slices using SIMD.
simd_vec_sub_i64
Element-wise subtraction of two i64 slices with checked overflow.