Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure lmul! and rmul! for Givens rotations are inlined. #28138

Merged
merged 1 commit into from
Jul 17, 2018

Conversation

andreasnoack
Copy link
Member

Stop using simd macro since it is not generally valid.

@andreasnoack andreasnoack merged commit b475814 into master Jul 17, 2018
@andreasnoack andreasnoack deleted the an/givens2 branch July 17, 2018 14:32
@Jutho
Copy link
Contributor

Jutho commented Jul 19, 2018

Out of curiosity, why was simd invalid, and why is inlining necessary?

@andreasnoack
Copy link
Member Author

I removed @simd because of #27482 but hadn't realized that after #27670 it is probably safe to keep them. I had to add the inline annotations because Julia's inlining heuristic didn't conder them inline worthy. However, when using SubArrays, inlining is critical because Julia will be able to avoid the creation of the SubArray in e.g. lmul!(G, view(A, :, 1:5)) only when lmul! is inlined. It made a quite big difference in https://github.com/andreasnoack/GenericLinearAlgebra.jl/blob/c24566d1588ec19e1d928b737133218bba833618/src/eigenGeneral.jl#L173.

@Jutho
Copy link
Contributor

Jutho commented Jul 20, 2018

Thanks for the detailed answer. I am interested as I share your interest for writing linear algeba functions in native Julia. Forcing inlining to get rid of the subarray allocations is a nice trick, but but of course points to the deeper lying problem of not having a non-allocating view. In principle, the inliner's judgement is correct: this function contains a loop that runs over all the entries of a possibly large vector, and will therefore take significant amount of time/flops so that it should not be inlined.

@andreasnoack
Copy link
Member Author

Unfortunately, the only option right now is to abuse @inline. The same is the case if you want constant propagation to work. Either you @inline everything or it is unpredictable if a constant will actually get propagated. #25303 stalled because of that.

@Jutho
Copy link
Contributor

Jutho commented Jul 20, 2018

Thanks for the pointers; that's very helpful information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants