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

Remove n_face_orientations template argument within FEEvaluation #10946

Merged
merged 2 commits into from Sep 23, 2020

Conversation

peterrum
Copy link
Member

Follow up to #10927. References #10928. Only the last commit is relevant.

@kronbichler I think this is what we have talked about.

Comment on lines -36 to -81
template bool dealii::internal::FEFaceEvaluationFactory<
deal_II_dimension,
deal_II_scalar_vectorized::value_type,
deal_II_scalar_vectorized>::
gather_evaluate<1>(
const unsigned int,
const deal_II_scalar_vectorized::value_type *,
const MatrixFreeFunctions::ShapeInfo<deal_II_scalar_vectorized> &,
const MatrixFreeFunctions::DoFInfo &,
deal_II_scalar_vectorized *,
deal_II_scalar_vectorized *,
deal_II_scalar_vectorized *,
const bool,
const bool,
const unsigned int,
const unsigned int,
const std::array<unsigned int, 1>,
const std::array<unsigned int, 1>,
const unsigned int,
const MatrixFreeFunctions::DoFInfo::DoFAccessIndex,
const std::array<unsigned int, 1>,
const Table<2, unsigned int> &);

template bool dealii::internal::FEFaceEvaluationFactory<
deal_II_dimension,
deal_II_scalar_vectorized::value_type,
deal_II_scalar_vectorized>::
integrate_scatter<1>(
const unsigned int,
deal_II_scalar_vectorized::value_type *,
const MatrixFreeFunctions::ShapeInfo<deal_II_scalar_vectorized> &,
const MatrixFreeFunctions::DoFInfo &,
deal_II_scalar_vectorized *,
deal_II_scalar_vectorized *,
deal_II_scalar_vectorized *,
deal_II_scalar_vectorized *,
const bool,
const bool,
const unsigned int,
const unsigned int,
const std::array<unsigned int, 1>,
const std::array<unsigned int, 1>,
const unsigned int,
const MatrixFreeFunctions::DoFInfo::DoFAccessIndex,
const std::array<unsigned int, 1>,
const Table<2, unsigned int> &);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key goal of this PR is get rid of these. Once we have introduced a InternalData the code should become significant simpler.

Comment on lines +3237 to +3226
if (n_face_orientations == VectorizedArrayType::size())
return fe_face_evaluation_process_and_io<VectorizedArrayType::size()>(
p);
else
return fe_face_evaluation_process_and_io<1>(p);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is now the if-statement.

@peterrum
Copy link
Member Author

@kronbichler Any idea what to do with the warning?

@kronbichler
Copy link
Member

kronbichler commented Sep 22, 2020

The compiler gets confused by the if statements in the function in question and where we actually read out the data. I believe the warning is wrong, but we really should look through the places where we fill that part. I have seen those in local development already. Maybe they get fixed by pulling in the EvaluationFlags to all places. I can have a look once #10927 is merged and this one is rebased.

@peterrum peterrum force-pushed the n_face_orientations branch 2 times, most recently from d5bb865 to 6ae56b2 Compare September 22, 2020 20:30
Comment on lines -2603 to +2584
// we allocate small amounts of data on the stack to signal the compiler
// that this temporary data is only needed for the calculations but the
// final results can be discarded and need not be written back to
// memory. For large sizes or when the dofs per face is not a
// compile-time constant, however, we want to go to the heap in the
// `scratch_data` variable to not risk a stack overflow.
constexpr unsigned int stack_array_size_threshold = 100;

VectorizedArrayType *DEAL_II_RESTRICT temp1;
VectorizedArrayType
temp_data[static_dofs_per_face < stack_array_size_threshold ?
2 * dofs_per_face :
1];
if (static_dofs_per_face < stack_array_size_threshold)
temp1 = &temp_data[0];
else
temp1 = scratch_data;
VectorizedArrayType *temp1 = scratch_data;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kronbichler Is there a reason why not to do this? You have done similar changes recently at other places.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other function we could not keep it because the allocation depended on the number of components which was turned to a run time argument. Here we still can, so the comment given above is still alive. The question is of course whether compilers got better during the last three years and can avoid some unnecessary write-back (they often write back even more than just the final result). Did you check the number of instructions executed or the run time with this change on and off?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you remove this code to make the compilation warning disappear? In any case, I believe we can restructure the code a bit to maybe avoid the warning (after this has been merged to avoid conflicts).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the last about 10 pushes are related to warnings all over the place...

@peterrum peterrum mentioned this pull request Sep 22, 2020
@peterrum peterrum force-pushed the n_face_orientations branch 2 times, most recently from a740034 to fd50917 Compare September 23, 2020 06:43
Conflicts:
	include/deal.II/matrix_free/evaluation_kernels.h
Copy link
Member

@kronbichler kronbichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good apart from a few stylistic issues.

include/deal.II/matrix_free/evaluation_kernels.h Outdated Show resolved Hide resolved
include/deal.II/matrix_free/fe_evaluation.h Outdated Show resolved Hide resolved
include/deal.II/matrix_free/fe_evaluation.h Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants