ModularM
Modular2y ago
3 replies
asosoman

SIMD Troubles ( SIMD[Bool,32] to Int32? and Getting a bit from every byte from SIMD)

Totally newbie with Mojo here. And totally newbie with SIMD too. So, sorry if I'm getting some definitions not really perfect.
I decided to try the 1BRC and now I'm on the optimization part of it... I want to check how fast I can go and learn SIMD/Mojo at the same time.

Got it working on a non really optimized way. And I've got stuck on some of the SIMD.

If I compare a SIMD[uint8,32] to the ASCII new line value, I get back a SIMD[Bool,32], is there a way to cast this type into a int32?
Would be great to use ctlz to get the first occurence index.

Other option, is using a mask and getting a SIMD[uint8,32] , but then would be great to know if is possible to get a int32 constructed from a bit from every byte on the SIMD. (something equivalent to _mm_movemask_epi8 I guess).

Sorry if something doesn't make all that sense... Is quite the learning trip...
Was this page helpful?