Skip to content

Commit

Permalink
#728: Overload templates rather than instantiating in default argumen…
Browse files Browse the repository at this point in the history
…t to avoid ICE in Intel 19.x
  • Loading branch information
PhilMiller committed Dec 4, 2020
1 parent dd40cd9 commit ebe7cc6
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 17 deletions.
88 changes: 80 additions & 8 deletions src/vt/collective/reduce/reduce.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,33 @@ struct Reduce : virtual collective::tree::Tree {
template <
typename OpT,
typename MsgT,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
ActiveTypedFnType<MsgT> *f
>
PendingSendType reduce(
NodeType const& root, MsgT* msg, Callback<MsgT> cb,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
);
template <
typename OpT,
typename MsgT
>
PendingSendType reduce(
NodeType const& root, MsgT* msg, Callback<MsgT> cb,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
)
{
return reduce<
OpT,
MsgT,
MsgT::template msgHandler<
MsgT,
OpT,
collective::reduce::operators::ReduceCallback<MsgT>
>
>(root, msg, cb, id, num_contrib);
}

/**
* \brief Reduce a message up the tree
Expand All @@ -203,15 +221,33 @@ struct Reduce : virtual collective::tree::Tree {
template <
typename OpT,
typename MsgT,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
ActiveTypedFnType<MsgT> *f
>
detail::ReduceStamp reduceImmediate(
NodeType const& root, MsgT* msg, Callback<MsgT> cb,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
);
template <
typename OpT,
typename MsgT
>
detail::ReduceStamp reduceImmediate(
NodeType const& root, MsgT* msg, Callback<MsgT> cb,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
)
{
return reduceImmediate<
OpT,
MsgT,
MsgT::template msgHandler<
MsgT,
OpT,
collective::reduce::operators::ReduceCallback<MsgT>
>
>(root, msg, cb, id, num_contrib);
}

/**
* \brief Reduce a message up the tree with a target function on the root node
Expand All @@ -227,13 +263,31 @@ struct Reduce : virtual collective::tree::Tree {
typename OpT,
typename FunctorT,
typename MsgT,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<MsgT, OpT, FunctorT>
ActiveTypedFnType<MsgT> *f
>
PendingSendType reduce(
NodeType const& root, MsgT* msg,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
);
template <
typename OpT,
typename FunctorT,
typename MsgT
>
PendingSendType reduce(
NodeType const& root, MsgT* msg,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
)
{
return reduce<
OpT,
FunctorT,
MsgT,
MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(root, msg, id, num_contrib);
}

/**
* \brief Reduce a message up the tree with a target function on the root node
Expand All @@ -249,13 +303,31 @@ struct Reduce : virtual collective::tree::Tree {
typename OpT,
typename FunctorT,
typename MsgT,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<MsgT, OpT, FunctorT>
ActiveTypedFnType<MsgT> *f
>
detail::ReduceStamp reduceImmediate(
NodeType const& root, MsgT* msg,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
);
template <
typename OpT,
typename FunctorT,
typename MsgT
>
detail::ReduceStamp reduceImmediate(
NodeType const& root, MsgT* msg,
detail::ReduceStamp id = detail::ReduceStamp{},
ReduceNumType const& num_contrib = 1
)
{
return reduceImmediate<
OpT,
FunctorT,
MsgT,
MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(root, msg, id, num_contrib);
}

/**
* \internal \brief Combine in a new message for a given reduction
Expand Down
42 changes: 37 additions & 5 deletions src/vt/objgroup/proxy/proxy_objgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,30 @@ struct Proxy {
template <
typename OpT = collective::None,
typename MsgPtrT,
typename MsgT = typename util::MsgPtrType<MsgPtrT>::MsgType,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
typename MsgT,
ActiveTypedFnType<MsgT> *f
>
PendingSendType reduce(
MsgPtrT msg, Callback<MsgT> cb, ReduceStamp stamp = ReduceStamp{}
) const;
template <
typename OpT = collective::None,
typename MsgPtrT,
typename MsgT = typename util::MsgPtrType<MsgPtrT>::MsgType
>
PendingSendType reduce(
MsgPtrT msg, Callback<MsgT> cb, ReduceStamp stamp = ReduceStamp{}
) const
{
return reduce<
OpT,
MsgPtrT,
MsgT,
MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
>(msg, cb, stamp);
}

/**
* \brief Reduce over the objgroup instances on each node with a functor
Expand All @@ -172,9 +188,25 @@ struct Proxy {
typename FunctorT,
typename MsgPtrT,
typename MsgT = typename util::MsgPtrType<MsgPtrT>::MsgType,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<MsgT, OpT, FunctorT>
ActiveTypedFnType<MsgT> *f
>
PendingSendType reduce(MsgPtrT msg, ReduceStamp stamp = ReduceStamp{}) const;
template <
typename OpT = collective::None,
typename FunctorT,
typename MsgPtrT,
typename MsgT = typename util::MsgPtrType<MsgPtrT>::MsgType
>
PendingSendType reduce(MsgPtrT msg, ReduceStamp stamp = ReduceStamp{}) const
{
return reduce<
OpT,
FunctorT,
MsgPtrT,
MsgT,
MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(msg, stamp);
}

/**
* \brief Reduce over the objgroup instance on each node with target specified
Expand Down
36 changes: 32 additions & 4 deletions src/vt/vrt/collection/reducable/reducable.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,49 @@ struct Reducable : BaseProxyT {
template <
typename OpT = collective::None,
typename MsgT,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
ActiveTypedFnType<MsgT> *f
>
messaging::PendingSend reduce(
MsgT *const msg, Callback<MsgT> cb, ReduceStamp stamp = ReduceStamp{}
) const;
template <
typename OpT = collective::None,
typename MsgT
>
messaging::PendingSend reduce(
MsgT *const msg, Callback<MsgT> cb, ReduceStamp stamp = ReduceStamp{}
) const
{
return reduce<
OpT,
MsgT,
MsgT::template msgHandler<
MsgT, OpT, collective::reduce::operators::ReduceCallback<MsgT>
>
>(msg, cb, stamp);
}

template <
typename OpT,
typename FunctorT,
typename MsgT,
ActiveTypedFnType<MsgT> *f = MsgT::template msgHandler<MsgT, OpT, FunctorT>
ActiveTypedFnType<MsgT> *f
>
messaging::PendingSend reduce(MsgT *const msg, ReduceStamp stamp = ReduceStamp{}) const;
template <
typename OpT,
typename FunctorT,
typename MsgT
>
messaging::PendingSend reduce(MsgT *const msg, ReduceStamp stamp = ReduceStamp{}) const
{
return reduce<
OpT,
FunctorT,
MsgT,
MsgT::template msgHandler<MsgT, OpT, FunctorT>
>(msg, stamp);
}

template <typename MsgT, ActiveTypedFnType<MsgT> *f>
messaging::PendingSend reduce(
Expand Down

0 comments on commit ebe7cc6

Please sign in to comment.