vorner / slipstream

Nudging the compiler to auto-vectorize things
Apache License 2.0
71 stars 4 forks source link

Allow hinging the vectorize by turbofish #4

Closed vorner closed 3 years ago

vorner commented 4 years ago

Sometimes (many times) the vectorize needs a type hint to know how large vectors to return. Sometimes it is easy to do so somewhere in the code after that, eg by this:

for v in vectorize(stuff) {
    let v: u32x4 = v;
    ...
}

But this is not always comfortable/possible. Furthermore, in case of MutProxy it is even more cumbersome as it leaks the uninteresting type to the code. Using turbofish on the vectorize is also a bit gnarly, because it has bazzilion of type parameters of weird types.

Try to explore if it is possible to come up with a way to hide the other params somehow and simply hint by the desired types, both in read mode and in mutable mode, something like this:

for v in vectorize::<u32x4>(stuff) {
    ...
}

If not possible, how close can we get?

vorner commented 3 years ago

This is done for some time… https://docs.rs/slipstream/0.1.1/slipstream/fn.vectorize.html