How to rewrite this code into something not ugly
I need to call
shuffle
on a parameter mask of different lengths, the following code is the shortest that I could make. Please fill in the dots to appreciate what would happen with width 1024. Any thoughts are appreciated.
9 Replies
I have written this code as well, using shuffle to do deinterleave since that functions is broken. I think some day there will be sugar to unpack something you can slice. Or for
shuffle
to take a parameter that can be sliced. But probably not a priority.Maybe you could use
v._shuffle_list
as a workaround for now?v._shuffle_list
is an alternative, but it also has its problems. E.g., I don't know how to fill a VariadicList other than with the following method, which does not solve the inconvenience of enumerating all elements of the mask.
Yea, I also tried it and it's horrible.
Oh well, it compiles at least into something good.
Maybe we should ask how to turn a
StaticTuple
into a VariadicList
. There must be a way, as solution to such a problem is recently add to polynomial_evaluate
. See change log of 0.7, also GitHub issue 1587.Someone said that VariadicList was not intended to be created and passed around (but I can't find that quote anymore). Yes, lets ask for that, or even better to update the signatures of the shuffle methods.
Yea, I also remember that.
VariadicList
does look like a language<->data model interface type. I would expect to write the code someday simply as v.shuffle[*v]()
.GitHub
[Feature Request] Allow StaticIntTuple mask for SIMD.shuffle · Issu...
Review Mojo's priorities I have read the roadmap and priorities and I believe this request falls within the priorities. What is your request? As title. I want to build the list of indices in th...