Skip to content

Commit

Permalink
fix order
Browse files Browse the repository at this point in the history
  • Loading branch information
fnrizzi committed Oct 12, 2023
1 parent 02e6bdc commit 377b3f0
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions core/src/OpenMPTarget/Kokkos_OpenMPTarget_ParallelScan_Team.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,26 +119,6 @@ namespace Kokkos {
* final==true. Scan_val will be set to the final sum value over all vector
* lanes.
*/
template <typename iType, class FunctorType>
KOKKOS_INLINE_FUNCTION void parallel_scan(
const Impl::ThreadVectorRangeBoundariesStruct<
iType, Impl::OpenMPTargetExecTeamMember>& loop_boundaries,
const FunctorType& lambda) {
using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::SCAN,
TeamPolicy<Experimental::OpenMPTarget>,
FunctorType, void>;
using value_type = typename Analysis::value_type;

value_type scan_val = value_type();

#ifdef KOKKOS_ENABLE_PRAGMA_IVDEP
#pragma ivdep
#endif
for (iType i = loop_boundaries.start; i < loop_boundaries.end; ++i) {
lambda(i, scan_val, true);
}
}

template <typename iType, class FunctorType, class ValueType>
KOKKOS_INLINE_FUNCTION void parallel_scan(
const Impl::ThreadVectorRangeBoundariesStruct<
Expand All @@ -163,6 +143,20 @@ KOKKOS_INLINE_FUNCTION void parallel_scan(
return_val = scan_val;
}

template <typename iType, class FunctorType>
KOKKOS_INLINE_FUNCTION void parallel_scan(
const Impl::ThreadVectorRangeBoundariesStruct<
iType, Impl::OpenMPTargetExecTeamMember>& loop_boundaries,
const FunctorType& lambda) {
using Analysis = Impl::FunctorAnalysis<Impl::FunctorPatternInterface::SCAN,
TeamPolicy<Experimental::OpenMPTarget>,
FunctorType, void>;
using value_type = typename Analysis::value_type;

value_type scan_val = value_type();
parallel_scan(loop_boundaries, lambda, scan_val);
}

} // namespace Kokkos

#ifdef KOKKOS_IMPL_TEAM_SCAN_WORKAROUND
Expand Down

0 comments on commit 377b3f0

Please sign in to comment.