This would translate both np.transpose(a) and a.T, by doing some pattern match on incoming IR (usually an assignment).
I think we can extend it further to incorporate array analysis too. So in the end we build two dictionaries that map function names (or getattr) to its corresponding (1) shape analysis, and (2) parfor translation. Eventually I'd see it merged into @lower_builtin so that all related handling of a single numpy call would sit in one place, but that is perhaps quite a stretch.
The overall approach is very useful. In terms of details, I think we can write actual functions similar to @lower_builtin instead of things like mk_loopnest. prange can help with this.
I'm thinking maybe we could build facilities similar to
@lower_builtin
to help translating various numpy functions to parfor. Here is an idea:This would translate both
np.transpose(a)
anda.T
, by doing some pattern match on incoming IR (usually an assignment).I think we can extend it further to incorporate array analysis too. So in the end we build two dictionaries that map function names (or getattr) to its corresponding (1) shape analysis, and (2) parfor translation. Eventually I'd see it merged into
@lower_builtin
so that all related handling of a single numpy call would sit in one place, but that is perhaps quite a stretch.What do you think? @ehsantn @DrTodd13