From cba99e88d2c42512a3775efc49de9f33a4711cdd Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Sun, 29 Jan 2023 20:40:39 -0500 Subject: [PATCH] Remove misplaced and commented host lock array code in OpenMPTarget backend --- .../OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp | 33 ------------------- .../OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp | 31 ----------------- 2 files changed, 64 deletions(-) diff --git a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp index de8e629831..81fbc56de0 100644 --- a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp +++ b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.cpp @@ -165,39 +165,6 @@ SharedAllocationRecord:: } // namespace Impl } // namespace Kokkos -/*--------------------------------------------------------------------------*/ -/*--------------------------------------------------------------------------*/ -/* -namespace Kokkos { -namespace { - const unsigned HOST_SPACE_ATOMIC_MASK = 0xFFFF; - const unsigned HOST_SPACE_ATOMIC_XOR_MASK = 0x5A39; - static int HOST_SPACE_ATOMIC_LOCKS[HOST_SPACE_ATOMIC_MASK+1]; -} - -namespace Impl { -void init_lock_array_host_space() { - static int is_initialized = 0; - if(! is_initialized) - for(int i = 0; i < static_cast (HOST_SPACE_ATOMIC_MASK+1); i++) - HOST_SPACE_ATOMIC_LOCKS[i] = 0; -} - -bool lock_address_host_space(void* ptr) { - return 0 == atomic_compare_exchange( &HOST_SPACE_ATOMIC_LOCKS[ - (( size_t(ptr) >> 2 ) & HOST_SPACE_ATOMIC_MASK) ^ -HOST_SPACE_ATOMIC_XOR_MASK] , 0 , 1); -} - -void unlock_address_host_space(void* ptr) { - atomic_exchange( &HOST_SPACE_ATOMIC_LOCKS[ - (( size_t(ptr) >> 2 ) & HOST_SPACE_ATOMIC_MASK) ^ -HOST_SPACE_ATOMIC_XOR_MASK] , 0); -} - -} -}*/ - //============================================================================== // {{{1 diff --git a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp index ca015da379..e5b33d0982 100644 --- a/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp +++ b/core/src/OpenMPTarget/Kokkos_OpenMPTargetSpace.hpp @@ -35,37 +35,6 @@ static_assert(false, #include #include -/*--------------------------------------------------------------------------*/ - -namespace Kokkos { -namespace Impl { - -/// \brief Initialize lock array for arbitrary size atomics. -/// -/// Arbitrary atomics are implemented using a hash table of locks -/// where the hash value is derived from the address of the -/// object for which an atomic operation is performed. -/// This function initializes the locks to zero (unset). -// void init_lock_array_host_space(); - -/// \brief Acquire a lock for the address -/// -/// This function tries to acquire the lock for the hash value derived -/// from the provided ptr. If the lock is successfully acquired the -/// function returns true. Otherwise it returns false. -// bool lock_address_host_space(void* ptr); - -/// \brief Release lock for the address -/// -/// This function releases the lock for the hash value derived -/// from the provided ptr. This function should only be called -/// after previously successfully acquiring a lock with -/// lock_address. -// void unlock_address_host_space(void* ptr); - -} // namespace Impl -} // namespace Kokkos - namespace Kokkos { namespace Impl {