npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

llml_simd

v0.1.3

Published

WASM SIMD bindings

Downloads

2

Readme

Crates.io NPM Rust docs

LLML's SIMD

SIMD (Single Instruction Multiple Data) extension for a variety of targets. This project was initially started to facilitate the expansion of LLML's suported targets & features

Contents

This crate/library contains bindings to native-level SIMD instructions (alongside some polyfill) for SSE, AVX (see AVX support), NEON & WASM. It also contains naive implementations of all data-types (see naive implementation)

No std

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

Dot product (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.);
}

Dot product (JavaScript)

import { f32x4 } from llml_simd

let 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)