Skip to content

Commit

Permalink
Merge branch 'develop' into artv3/note-on-layout-unit-stride
Browse files Browse the repository at this point in the history
  • Loading branch information
artv3 authored Oct 15, 2024
2 parents 66678df + 0edd83c commit 78d6d79
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions include/RAJA/policy/atomic_builtin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <cstdint>

#if defined(RAJA_COMPILER_MSVC) || (defined(_WIN32) && defined(__INTEL_COMPILER))
#if defined(RAJA_COMPILER_MSVC) || ((defined(_WIN32) || defined(_WIN64)) && defined(__INTEL_COMPILER))
#include <intrin.h>
#endif

Expand All @@ -48,7 +48,7 @@ struct builtin_atomic {
namespace detail {


#if defined(RAJA_COMPILER_MSVC) || (defined(_WIN32) && defined(__INTEL_COMPILER))
#if defined(RAJA_COMPILER_MSVC) || ((defined(_WIN32) || defined(_WIN64)) && defined(__INTEL_COMPILER))


/*!
Expand Down Expand Up @@ -120,11 +120,14 @@ RAJA_INLINE long builtin_atomicOr(long *acc, long value)
return _InterlockedOr(acc, value);
}

#if defined(_WIN64)

RAJA_INLINE long long builtin_atomicOr(long long *acc, long long value)
{
return _InterlockedOr64(acc, value);
}

#endif

/*!
* Atomic load using atomic or
Expand Down Expand Up @@ -155,11 +158,15 @@ RAJA_INLINE long builtin_atomicExchange(long *acc, long value)
return _InterlockedExchange(acc, value);
}

#if defined(_WIN64)

RAJA_INLINE long long builtin_atomicExchange(long long *acc, long long value)
{
return _InterlockedExchange64(acc, value);
}

#endif


/*!
* Atomic store using atomic exchange
Expand Down Expand Up @@ -190,11 +197,15 @@ RAJA_INLINE long builtin_atomicCAS(long *acc, long compare, long value)
return _InterlockedCompareExchange(acc, value, compare);
}

#if defined(_WIN64)

RAJA_INLINE long long builtin_atomicCAS(long long *acc, long long compare, long long value)
{
return _InterlockedCompareExchange64(acc, value, compare);
}

#endif


/*!
* Atomic addition using intrinsics
Expand All @@ -214,11 +225,15 @@ RAJA_INLINE long builtin_atomicAdd(long *acc, long value)
return _InterlockedExchangeAdd(acc, value);
}

#if defined(_WIN64)

RAJA_INLINE long long builtin_atomicAdd(long long *acc, long long value)
{
return _InterlockedExchangeAdd64(acc, value);
}

#endif


/*!
* Atomic subtraction using intrinsics
Expand All @@ -238,11 +253,15 @@ RAJA_INLINE long builtin_atomicSub(long *acc, long value)
return _InterlockedExchangeAdd(acc, -value);
}

#if defined(_WIN64)

RAJA_INLINE long long builtin_atomicSub(long long *acc, long long value)
{
return _InterlockedExchangeAdd64(acc, -value);
}

#endif


/*!
* Atomic and using intrinsics
Expand All @@ -262,11 +281,15 @@ RAJA_INLINE long builtin_atomicAnd(long *acc, long value)
return _InterlockedAnd(acc, value);
}

#if defined(_WIN64)

RAJA_INLINE long long builtin_atomicAnd(long long *acc, long long value)
{
return _InterlockedAnd64(acc, value);
}

#endif


/*!
* Atomic xor using intrinsics
Expand All @@ -286,11 +309,15 @@ RAJA_INLINE long builtin_atomicXor(long *acc, long value)
return _InterlockedXor(acc, value);
}

#if defined(_WIN64)

RAJA_INLINE long long builtin_atomicXor(long long *acc, long long value)
{
return _InterlockedXor64(acc, value);
}

#endif


#else // RAJA_COMPILER_MSVC

Expand Down

0 comments on commit 78d6d79

Please sign in to comment.