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
Add FEEvaluationImplHangingNodes::RunTypes::scalar #12999
Add FEEvaluationImplHangingNodes::RunTypes::scalar #12999
Conversation
template <typename T> | ||
struct UnivariateShapeDataTrait; | ||
|
||
template <> | ||
struct UnivariateShapeDataTrait<double> | ||
{ | ||
using value_type = double; | ||
}; | ||
|
||
template <> | ||
struct UnivariateShapeDataTrait<float> | ||
{ | ||
using value_type = float; | ||
}; | ||
|
||
template <typename T, std::size_t width> | ||
struct UnivariateShapeDataTrait<VectorizedArray<T, width>> | ||
{ | ||
using value_type = T; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kronbichler Do we have somewhere a functionality like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I don't think so, but it would be useful to have in a central place (read: vectorization.h
). And in general, I think you can simplify this by saying
template <typename T>
struct UnivariateShapeDataTrait
{
using value_type = T;
};
and then only a specialization for VectorizedArray<T, width>
.
f9dd536
to
38b0b56
Compare
unsigned int d, | ||
bool transpose, | ||
bool skip_borders> | ||
static inline DEAL_II_ALWAYS_INLINE void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How big is the effect of inlining this function? I am hesitant to inline this in debug
mode, but it might make sense in release
mode. Can you wrap this into an ifndef DEBUG
?
{{0, points - 1, 0, points - 1}}}}}}}}; | ||
|
||
const std:: | ||
array<std::array<std::array<std::array<unsigned int, 3>, 2>, 2>, 3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use ndarray
here and in a few other places?
return (fe_degree == -1 || fe_degree > 2) ? | ||
FEEvaluationImplHangingNodesRunnerTypes::vectorized : | ||
FEEvaluationImplHangingNodesRunnerTypes::scalar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we also run the vectorized case only if we have Number::size() > 2
, because the vectorized code path executes two sides of an interpolation, so with 2 SIMD lanes the scalar code does strictly less operations.
2421935
to
c3565f8
Compare
Can you rebase this to master to see if the code now runs? |
553ff34
to
3e188b0
Compare
/rebuild |
enum class VectorizationTypes | ||
{ | ||
/** | ||
* TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you expand these?
} | ||
|
||
template <unsigned int direction> | ||
static inline DEAL_II_ALWAYS_INLINE void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here, I would not inline in debug mode.
} | ||
|
||
template <bool do_x, bool do_y, bool do_z> | ||
inline DEAL_II_ALWAYS_INLINE void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
enum class HelperType | ||
{ | ||
/** | ||
* TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expand comment.
6d7847a
to
5d3a0f4
Compare
5d3a0f4
to
6b70043
Compare
#ifndef DEBUG | ||
inline DEAL_II_ALWAYS_INLINE | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about simplifying the call to these #ifdefs by defining (for this file only)
#ifdef DEBUG
#define DEAL_II_ALWAYS_INLINE_RELEASE
#else
#define DEAL_II_ALWAYS_INLINE_RELEASE DEAL_II_ALWAYS_INLINE
#endif
and then use this flag, and at the end of the relevant section call
#undef DEAL_II_ALWAYS_INLINE_RELEASE
I think this gives us a good intermediate state to merge for now. We can then later analyze and see if we want to make additional changes before the release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks much better now.
alternative to #12781