Can / should valarray use #pragma loop(ivdep) #1172
-
Standard mentions the intention for valarray to optimize by assuming no dependencies between elements.
However, this is not enough to perform optimizations:
This is also not enough to perform optmimizations, as argument may be a view of the same array, so assigned and source elements may overlap
Looks enough however. For this case even self-operand does not introduce inter-element dependencies. So, if this analysis is correct, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I'm not keeping up with the valarray PRs but if this was answered elsewhere could you throw the answer in here and we can mark it as accepted? |
Beta Was this translation helpful? Give feedback.
-
I can aswer myself: not in general case, as the elements of valarray can be of arbitrary types, for which this pragma isn't safe. std::valarray<std::string> v; // compiles |
Beta Was this translation helpful? Give feedback.
I can aswer myself: not in general case, as the elements of valarray can be of arbitrary types, for which this pragma isn't safe.
std::valarray<std::string> v; // compiles