ModularM
Modular3y ago
1 reply
Henk-Jan Lebbink

What to use for the permutation mask in SIMD.shuffle?

The following code snippet works; it is however not very convenient, especially when the SIMD width is a parameter.

fn swap[T: DType, s: StaticIntTuple[16]](v: SIMD[T, 16]) -> SIMD[T, 16]:
    let x = v.shuffle[s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15]]()
    ...


Question: does someone know what I'm supposed to pass as mask in:

 shuffle[*mask: Int](self: Self) -> Self


What other type could I use as *mask?
Was this page helpful?