Reduce use of unsafe
in portable SIMD library
#549
Labels
safety
Issues related to use of `unsafe` code
unsafe
in portable SIMD library
#549
The current low-level SIMD operations in
rten-simd
are allunsafe
because they are thin wrappers around intrinsics incore::arch
and therefore the caller needs to have verified that the instructions are supported before using them. It would be nice to find ways to reduce the amount of unsafe code here.Constraints
Sources of inspiration
std::simd
avoids the issue by using SIMD types with a fixed-width which can be implemented for every architecture. A given SIMD type will just be mapped to different instructions when used depending on active target featurespulp
- Safe portable SIMD library for Rust with dynamic dispatch. This handles the issue by making theSimd
trait represent an instruction family with operations and associated vector types, not a SIMD vector. This trait is then impl-ed by types which can only be constructed if the feature set is available.Vectorized
types in PyTorchThe text was updated successfully, but these errors were encountered: