Code Monkey home page Code Monkey logo

simd's Introduction

simd

MIT licensed English | 中文

SIMD-accelerated operations

crate version docs
base64-simd Crates.io Docs
hex-simd Crates.io Docs
uuid-simd Crates.io Docs

The crates automatically select SIMD functions when available and provide fast fallback implementations. Benchmark results are available in simd-benches.

Goals

  • Performance: To be the fastest
  • Productivity: Efficient SIMD abstractions
  • Ergonomics: Easy to use

Safety

This project relies heavily on unsafe code. We encourage everyone to review the code and report any issues.

Memory safety bugs and unsoundness issues are classified as critical bugs. They will be fixed as soon as possible.

Spoken Language

This project accepts English or Chinese. All code, docs, PRs and issues should be written in English or Chinese.

References

This project contains multiple algorithms and implementations. Some of them are not original. We list the references here.

base64:

hex:

unicode:

Sponsor

If my open-source work has been helpful to you, please sponsor me.

Every little bit helps. Thank you!

simd's People

Contributors

a4lg avatar dependabot[bot] avatar nugine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

simd's Issues

support floating number

now vsimd support integer number only, but it in 3D math it represent floating number, please consider support it as possible ?

Todo List

Project Status:

  • Maintaining but not developing.
  • I'm thinking a new SIMD design based on custom codegen, but have no idea for now.
  • To avoid frequent version bumping, I plan to stay at v0.8 for one year.
  • I'll come back!

Docs:

  • More examples
  • API docs translation
  • Add some explanations and examples for encode and decode.
    #36

Tests:

  • Fuzz tests
  • #23
  • Coverage report

Needs design:

  • #5
  • #11
  • AVX512
  • Refactor hex-simd APIs

Experimental

Issues

Parallel API

Improve throughput by using multi-threading (rayon).

In most cases, the simd functions are fast enough that we may not benefit from multi-threading. And some functions are not divisible.

Crates with parallel api:

Document and give example for alsw implementation

Hi Nugine,
I'm planning to add a new charset support to simd-base32, and is stuck with the alsw decoder implementation.
Given that the charset is:

const BASE32CROCKFORD_CHARSET: &[u8; 32] = b"0123456789ABCDEFGHJKMNPQRSTVWXYZ";

I have the decode function as:

    #[inline]
    const fn decode(c: u8) -> u8 {
        match c {
            b'0'..=b'9' => c - b'0',
            b'A'..=b'H' => c - b'A' + 10,
            b'J'..=b'K' => c - b'J' + 18,
            b'M'..=b'N' => c - b'M' + 20,
            b'P'..=b'T' => c - b'P' + 22,
            b'V'..=b'Z' => c - b'V' + 27,
            _ => 0xff,
        }
    }

But it is unclear to me how the check_hash function is implemented. Would you please add some documentation to the implementation and the verification of such functions?

Thanks!

`simd-abstraction-0.7.0` doesn't compile on i686 / i586 / i486

error[E0425]: cannot find function `_mm_crc32_u64` in this scope
   --> C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\simd-abstraction-0.7.0\src\arch\x86.rs:369:18
    |
369 |         unsafe { _mm_crc32_u64(crc as u64, value) as u32 }
    |                  ^^^^^^^^^^^^^ help: a function with a similar name exists: `_mm_crc32_u16`

Benchmark Dashboard

Updated by GitHub Action automatically

Summary 2023-01-13

  • base64-simd is the fastest base64 crate.
  • hex-simd is the fastest hex crate.

Continuous Benchmark

Keep tracking performance

  • x86_64 benchmark (GitHub Actions)
  • aarch64 benchmark (CircleCI)
  • A dashboard (GitHub Actions)

base64_simd: Forgiving mode should handle missing padding

Currently forgiving mode handles no padding properly:

decoding SGVsbG8sIHdvcmxkIQ = Hello, world!

but decoding to little padding SGVsbG8sIHdvcmxkIQ= errors.

It would be great if forgiving mode appends the correct padding. Similarly it could also ignore extra padding:

aGVsbG8== = hello

Return encode/decode size as part of encode/decode call

Would it be possible to add a simple encode/decode method pair?

e.g:

encode_to_slice(source:&[u8],dest:&mut [u8])->Result(usize, Error)

decode_to_slice(source: &[u8], dest[&mut[u8])->Result(usize, Error)

so the caller does not need to call sizing additionally to find out how much was written. It just makes it a little more fluid to use.

This obviously assumes the dest buffers are large enough to hold the output (as with the other encode/decode methods)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.