Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guzba/nimsimd
Pleasant Nim bindings for SIMD instruction sets.
https://github.com/guzba/nimsimd
arm avx avx2 bindings neon nim simd simd-intrinsics sse x86 x86-64
Last synced: 24 days ago
JSON representation
Pleasant Nim bindings for SIMD instruction sets.
- Host: GitHub
- URL: https://github.com/guzba/nimsimd
- Owner: guzba
- License: mit
- Created: 2020-11-30T22:59:46.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-21T20:44:27.000Z (about 1 month ago)
- Last Synced: 2024-11-21T21:29:32.668Z (about 1 month ago)
- Topics: arm, avx, avx2, bindings, neon, nim, simd, simd-intrinsics, sse, x86, x86-64
- Language: Nim
- Homepage:
- Size: 127 KB
- Stars: 76
- Watchers: 5
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nimsimd
![Github Actions](https://github.com/guzba/nimsimd/workflows/Github%20Actions/badge.svg)
`nimble install nimsimd`
This repo provides pleasant Nim bindings for various SIMD instructions.
Each SIMD instruction set is in its own file for importing.
## x86
Instruction Set | Bindings
--------- | :----:
SSE | ✅
SSE2 | ✅
SSE3 | ✅
SSSE3 | ✅
SSE4.1 | ✅
SSE4.2 | ✅
AVX | ✅
AVX2 | ✅
PCLMULQDQ | ✅
BMI1 | ✅
BMI2 | ✅
F16C | ✅
MOVBE | ✅
MOVBE | ✅
POPCNT | ✅
FMA | ✅### Compiler flags
Some instruction sets require additional compiler flags to compile. I suggest
putting any code that uses these instructions into its own .nim file and adding a `localPassc` pragma to the top of that file as needed, such as:```nim
import nimsimd/sse42when defined(gcc) or defined(clang):
{.localPassc: "-msse4.2".}...
```### Runtime check
You can also check if instruction sets are available at runtime:
```nim
import nimsimd/runtimecheckecho checkInstructionSets({SSE41, PCLMULQDQ})
```## ARM
NEON bindings are started but experimental. Much to learn here about versioning and compilers.
## Uses of nimsimd
* [Pixie](https://github.com/treeform/pixie) uses SIMD for faster 2D drawing.
* [Crunchy](https://github.com/guzba/crunchy) uses SIMD for faster hashing and checksums.
* [Noisy](https://github.com/guzba/noisy) uses SIMD to accelerate generating coherent noise.## Testing
`nimble test`