AdamNiederer / AdamNiederer/faster

Run-time feature detection

Aperta
#2 7 commenti 9 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
1.6k
Fork
52
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Currently the vector size and the SIMD instructions to be used are fixed at compile-time. This is a good first step.

It allows me to write an algorithm once, and by changing a compiler-flag generate different versions of this algorithm for different target architectures (with different vector sizes, SIMD instructions, etc.).

I really like to be able to do this at compile-time within the same binary as well, so that I can write:

```rust
// a generic algorithm
fn my_generic_algorithm(x: T, y: T) {
// generic simd operations
}
```
and monomorphize it for different instruction sets:

```
let x: VecAvx;
my_generic_algorithm(x, x); // AVX version
let y: VecSSE42;
my_generic_algorithm(y, y); // SSE42 version
```

That way `input.simd_iter().map(my_generic_algorithm)` could monomorphize `my_generic_algorithm` for `SSE`, `SSE42`, `AVX`, and `AVX2`, and do run-time feature detection to detect the best that a given CPU supports at run-time, and then dispatch to that one.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.