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

Warnings about vectorization #8406

Closed
bangerth opened this issue Jul 23, 2019 · 6 comments
Closed

Warnings about vectorization #8406

bangerth opened this issue Jul 23, 2019 · 6 comments
Assignees
Milestone

Comments

@bangerth
Copy link
Member

Compiling ASPECT yesterday with the then-current deal.II sources yielded these warnings:

/home/bangerth/p/deal.II/1/install/include/deal.II/base/symmetric_tensor.h: In instantiation of ‘constexpr dealii::SymmetricTensor<rank_, dim, typename dealii::ProductType<Number, typename dealii::EnableIfScalar<OtherNumber>::type>::type> dealii::operator*(const dealii::SymmetricTensor<rank, dim, Number>&, const OtherNumber&) [with int rank_ = 2; int dim = 2; Number = dealii::VectorizedArray<double, 2>; OtherNumber = double; typename dealii::ProductType<Number, typename dealii::EnableIfScalar<OtherNumber>::type>::type = dealii::VectorizedArray<double, 2>]’:
/home/bangerth/p/deal.II/1/install/include/deal.II/base/symmetric_tensor.h:3582:13:   required from ‘void aspect::StokesMatrixFreeHandler<dim>::correct_stokes_rhs() [with int dim = 2]’
/home/bangerth/p/deal.II/1/projects/aspect/source/simulator/stokes_matrix_free.cc:1663:3:   required from here
/home/bangerth/p/deal.II/1/projects/aspect/source/simulator/stokes_matrix_free.cc:1055:52:   in constexpr expansion of ‘dealii::operator*<2, 2, double, dealii::VectorizedArray<double, 2> >(-1.0e+0, sym_grad_u)’
/home/bangerth/p/deal.II/1/install/include/deal.II/base/vectorization.h:2329:7: note: ‘using product_type = using type = using type = class dealii::VectorizedArray<double, 2> {aka class dealii::VectorizedArray<double, 2>}’ has no user-provided default constructor
 class VectorizedArray<double, 2>
       ^~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                         
/home/bangerth/p/deal.II/1/install/include/deal.II/base/vectorization.h:2514:11: note: and the implicitly-defined constructor does not initialize ‘__m128d dealii::VectorizedArray<double, 2>::data’                                                                                
   __m128d data;                                                                                                                          
           ^~~~                                                                                                                           
/home/bangerth/p/deal.II/1/install/include/deal.II/base/symmetric_tensor.h: In instantiation of ‘constexpr dealii::SymmetricTensor<rank_, dim, typename dealii::ProductType<Number, typename dealii::EnableIfScalar<OtherNumber>::type>::type> dealii::operator*(const dealii::SymmetricTensor<rank, dim, Number>&, const OtherNumber&) [with int rank_ = 2; int dim = 3; Number = dealii::VectorizedArray<double, 2>; OtherNumber = double; typename dealii::ProductType<Number, typename dealii::EnableIfScalar<OtherNumber>::type>::type = dealii::VectorizedArray<double, 2>]’:                                                                                                                               
/home/bangerth/p/deal.II/1/install/include/deal.II/base/symmetric_tensor.h:3582:13:   required from ‘void aspect::StokesMatrixFreeHandler<dim>::correct_stokes_rhs() [with int dim = 3]’
/home/bangerth/p/deal.II/1/projects/aspect/source/simulator/stokes_matrix_free.cc:1663:3:   required from here
/home/bangerth/p/deal.II/1/projects/aspect/source/simulator/stokes_matrix_free.cc:1055:52:   in constexpr expansion of ‘dealii::operator*<2, 3, double, dealii::VectorizedArray<double, 2> >(-1.0e+0, sym_grad_u)’
/home/bangerth/p/deal.II/1/install/include/deal.II/base/vectorization.h:2329:7: note: ‘using product_type = using type = using type = class dealii::VectorizedArray<double, 2> {aka class dealii::VectorizedArray<double, 2>}’ has no user-provided default constructor
 class VectorizedArray<double, 2>
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bangerth/p/deal.II/1/install/include/deal.II/base/vectorization.h:2514:11: note: and the implicitly-defined constructor does not initialize ‘__m128d dealii::VectorizedArray<double, 2>::data’
   __m128d data;
           ^~~~

I'm not sure what to do with this -- any ideas?

@kronbichler
Copy link
Member

This due to some constexpr Tensor changes. I've seen it as well. When I have some time I will look into it.

@masterleinad
Copy link
Member

The code in question is

template <typename Number, int width>
inline DEAL_II_ALWAYS_INLINE VectorizedArray<Number, width>
                             operator*(const Number &u, const VectorizedArray<Number, width> &v)
{
  VectorizedArray<Number, width> tmp;
  tmp = u;
  return tmp *= v;
}

I guess we agreed to finally provide a constructor from a scalar and can then improve it.

@bangerth
Copy link
Member Author

Hm. I must admit that I don't know what I need to do for this. Alternatively, could I just initialize tmp with {} here?

@masterleinad
Copy link
Member

I have a PR in preparation for cleaning up the constexpr annotations and the related warnings/notes.

@masterleinad masterleinad self-assigned this Aug 6, 2019
@peterrum
Copy link
Member

@bangerth @masterleinad is this still an issue after introducing the constructor?

@masterleinad
Copy link
Member

Should be OK after #8443, but I let @bangerth decide to close this issue.

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

No branches or pull requests

5 participants