You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A high-performance C++ framework for SIMD (Single Instruction Multiple Data) operations, providing optimized vector math operations for both floating-point and integer data types.
3
+
A high-performance C++ framework for SIMD (Single Instruction Multiple Data) operations, providing optimized vector math operations for both floating-point and integer data types. This library significantly accelerates data-parallel computations by leveraging CPU SIMD instruction sets.
4
4
5
5
## Features
6
6
7
7
- Optimized SIMD operations for different data types:
8
-
-`Int128`, `Int256` and `Int512` for integer operations (with `int8_t`, `int16_t`, and `int32_t`)
8
+
-`Int128`, `Int256`, and `Int512` for integer operations (with `int8_t`, `int16_t`, and `int32_t`)
9
9
-`Float256` and `Float512` for floating-point operations
10
10
-`Double256` and `Double512` for double-precision operations
11
11
- Standard mathematical operations:
12
12
- Addition
13
13
- Subtraction
14
14
- Multiplication
15
15
- Division (for floating-point and double-precision)
16
+
- Equality comparison
16
17
- Automatic vectorization with significant performance improvements
17
18
- Comprehensive test suite using Google Test
18
19
- Performance benchmarks using Google Benchmark
@@ -39,26 +40,107 @@ Performance improvements comparing SIMD operations vs. standard operations on di
39
40
40
41
### Prerequisites
41
42
42
-
- C++ compiler with SIMD support (AVX2 recommended)
43
+
- C++ compiler with SIMD support (tests verified on GCC and MSVC)
44
+
- CPU with support for relevant instruction sets (SSE2, AVX2, AVX512)
43
45
44
-
### Using the Project
46
+
### User Guide
45
47
46
-
This is a header only project, no need for building.
47
-
```bash
48
-
#include<SIMD.h>
48
+
This is a header-only library, no building required:
49
+
50
+
```c++
51
+
#include<SIMD.h>
52
+
```
53
+
54
+
The available SIMD types will be detected by your IDE via IntelliSense. A basic runtime check is also implemented in SIMD types.
55
+
56
+
The library uses the namespace 'SIMD', but you can customize this before including the header:
57
+
58
+
```c++
59
+
#defineBASIC_SIMD_NAMESPACE MySimdNamespace
60
+
#include <SIMD.h>
49
61
```
50
-
Should be sufficient.
51
62
52
-
### Running Tests & Benchmarks
63
+
### Available Types
64
+
65
+
The following SIMD types are available on compatible CPU and compiler configurations:
66
+
67
+
| SIMD Type | Container Type | Width | Type of Each Element | Description | ISA Extension |
SIMD::int_128<int8_t>::AddInplaceRaw(a, b); // a += b
130
+
```
131
+
132
+
For large arrays, it's recommended to use an aligned dynamic memory allocator. The `AlignedMemory` namespace included with SIMD.h provides this functionality.
133
+
134
+
## Running Tests & Benchmarks
135
+
136
+
Use the provided scripts to run tests and benchmarks:
137
+
138
+
### Windows
57
139
```bash
58
140
run_tests.bat
59
141
```
60
142
61
-
####Linux
143
+
### Linux
62
144
```bash
63
145
run_tests.sh
64
146
```
@@ -69,10 +151,20 @@ This project is licensed under the GPLv3 License - see the LICENSE file for deta
69
151
70
152
## Contributing
71
153
72
-
Current state of the project is purely based on the personal needs, any contribution for extending SIMD support is appreciated & welcome.
154
+
Contributions to extend SIMD support are welcome! The project started based on personal needs but could benefit from community involvement.
155
+
156
+
### How to Contribute
157
+
158
+
1. Fork the repository
159
+
2. Create a feature branch
160
+
3. Implement your changes
161
+
4. Add or update tests as appropriate
162
+
5. Submit a pull request
163
+
164
+
The SIMD.h implementation uses macros to minimize repetitive code. The basic pattern is to define a macro for a new operator/function as a specialization of the base SIMD_Type_t, then apply it for different bit widths.
The SIMD::Array class provided in the codebase serves as a good example for building custom SIMD classes efficiently.
75
167
76
-
The SIMD.h uses macros a lot to eliminate manual work of repetitive coding, but the idea is really simple; define a macro for a new operator/function as a specialization of base SIMD_Type_t and then use it for different bit widths.
168
+
### Contact
77
169
78
-
The SIMD::Array class is created for testing, but I believe it is a good example for building your own SIMD classes efficiently.
0 commit comments