Skip to content

Commit

Permalink
Merge pull request #5852 from rgayatri23/OpenMPTarget_intel_pvc_edits
Browse files Browse the repository at this point in the history
OpenMPTarget: Adding declare target for constexpr variables on Intel GPUs.
  • Loading branch information
crtrott authored Feb 3, 2023
2 parents e7aeb9b + 446532e commit 6f12ca2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/Kokkos_View.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,18 @@ constexpr bool is_assignable(const Kokkos::View<ViewTDst...>& dst,

namespace Kokkos {

// FIXME_OPENMPTARGET - The `declare target` is needed for the Intel GPUs with
// the OpenMPTarget backend
#if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_COMPILER_INTEL)
#pragma omp declare target
#endif

inline constexpr Kokkos::ALL_t ALL{};

#if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_COMPILER_INTEL)
#pragma omp end declare target
#endif

inline constexpr Kokkos::Impl::WithoutInitializing_t WithoutInitializing{};

inline constexpr Kokkos::Impl::AllowPadding_t AllowPadding{};
Expand Down
11 changes: 11 additions & 0 deletions core/src/impl/Kokkos_Atomic_Memory_Order.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,19 @@ struct memory_order_relaxed_t {
#endif
static constexpr auto std_constant = std::memory_order_relaxed;
};

// FIXME_OPENMPTARGET - The `declare target` is needed for the Intel GPUs with
// the OpenMPTarget backend
#if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_COMPILER_INTEL)
#pragma omp declare target
#endif

constexpr memory_order_relaxed_t memory_order_relaxed = {};

#if defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_COMPILER_INTEL)
#pragma omp end declare target
#endif

struct memory_order_acquire_t {
using memory_order = memory_order_acquire_t;
#if defined(KOKKOS_ENABLE_GNU_ATOMICS) || \
Expand Down
6 changes: 6 additions & 0 deletions core/unit_test/TestNumericTraits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,13 @@ CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, round_error);
CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, round_error);
CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(float, denorm_min);
CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(double, denorm_min);

// FIXME_OPENMPTARGET - The static_assert causes issues on Intel GPUs with the
// OpenMPTarget backend.
#if !(defined(KOKKOS_ENABLE_OPENMPTARGET) && defined(KOKKOS_COMPILER_INTEL))
CHECK_SAME_AS_NUMERIC_LIMITS_MEMBER_FUNCTION(long double, denorm_min);
#endif

// clang-format off
static_assert(Kokkos::Experimental::norm_min<float >::value == std::numeric_limits< float>::min(), "");
static_assert(Kokkos::Experimental::norm_min<double >::value == std::numeric_limits< double>::min(), "");
Expand Down

0 comments on commit 6f12ca2

Please sign in to comment.