WASM SIMD bindings
npm install llml_simd


llml_simd` is a no_std crate. This means that it can be used for embeded systems projects seamlessly.Naive implementation ##
If no supported target is detected (or if you enable the feature `force_naive`), Rust will compile the the SIMD vectors in naive mode. This mode represent's all data types as an array, executing most of the methods via iterators. This mode, while not recommended, is usefull if you intend to share code with some other programm that doesn't have SIMD support.> Warning\
> While not explicitly SIMD,
`rustc` might still optimize some parts of the code to utilize SIMD instructions if it can and you allow it to.
> If you want to fully disable SIMD instructions, use `--target-feature=-sse` on x86/x86_64 and `--target-feature=-neon` on arm/aarch64 (naive mode will be used automatically in those cases, not requiring to enable `force_naive`)AVX Support ##
If Rust detects `avx` as a target feature and you have the `use_avx` feature enabled (see features), `llml_simd` will compile all vectors over 128-bit long with AVX instructions, increasing performance significantly.JavaScript Library ##
Thanks to WASM, `llml_simd` is available for JavaScript/TypeScript via npm.\
You can install it into your Node project with `npm i llml_simd`Features ##
| Feature | Description |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `use_std` | Enables standard library functionality. Enabled by default |
| `force_naive` | Forces naive types (see Naive implementation) |
| `use_avx` | Enables the use of AVX SIMD types (see AVX support) |
| `random` | Enables random generation of vectors via rand |
| `serialize` | Enables serialization and deserialization of vectors via serde |Examples ##
$3
`rust
use llml_simd::float::single::f32x4;pub fn main() {
let alpha = f32x4::new([1., 2., 3., 4.]);
let beta = f32x4::new([5., 6., 7., 8.]);
let dot = (alpha * beta).sum();
assert_eq!(dot, 70.);
}
`$3
`js
import { f32x4 } from llml_simdlet alpha = new f32x4(new Float32Array([1, 2, 3, 4]))
let beta = new f32x4(new Float32Array([5, 6, 7, 8]))
let dot = alpha.mul(beta).sum()
console.assert(dot === 70)
``