From 477c6c10a332e29d84ed60256c219889173ea088 Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Tue, 29 Aug 2023 14:36:06 +0200 Subject: [PATCH] Replace ALPAKA_DECAY_T by std::decay_t This feature was introduced as a workaround to a bug in the Intel classic compiler (see #995). Alpaka no longer supports that compiler, so the workaround is no longer necessary. --- .../atomic/AtomicUniformCudaHipBuiltIn.hpp | 4 ++-- include/alpaka/core/Decay.hpp | 21 ++----------------- .../alpaka/kernel/TaskKernelCpuOmp2Blocks.hpp | 4 ++-- .../kernel/TaskKernelCpuOmp2Threads.hpp | 2 +- include/alpaka/kernel/TaskKernelCpuSerial.hpp | 2 +- .../alpaka/kernel/TaskKernelCpuTbbBlocks.hpp | 2 +- .../kernel/TaskKernelGpuUniformCudaHipRt.hpp | 8 +++---- 7 files changed, 13 insertions(+), 30 deletions(-) diff --git a/include/alpaka/atomic/AtomicUniformCudaHipBuiltIn.hpp b/include/alpaka/atomic/AtomicUniformCudaHipBuiltIn.hpp index 78cf5ca73ee1..138cf503bde6 100644 --- a/include/alpaka/atomic/AtomicUniformCudaHipBuiltIn.hpp +++ b/include/alpaka/atomic/AtomicUniformCudaHipBuiltIn.hpp @@ -76,7 +76,7 @@ namespace alpaka T const& value) -> T { auto* const addressAsIntegralType = reinterpretAddress(addr); - using EmulatedType = ALPAKA_DECAY_T(decltype(*addressAsIntegralType)); + using EmulatedType = std::decay_t; // Emulating atomics with atomicCAS is mentioned in the programming guide too. // http://docs.nvidia.com/cuda/cuda-c-programming-guide/#atomic-functions @@ -117,7 +117,7 @@ namespace alpaka T const& value) -> T { auto* const addressAsIntegralType = reinterpretAddress(addr); - using EmulatedType = ALPAKA_DECAY_T(decltype(*addressAsIntegralType)); + using EmulatedType = std::decay_t; EmulatedType reinterpretedCompare = reinterpretValue(compare); EmulatedType reinterpretedValue = reinterpretValue(value); diff --git a/include/alpaka/core/Decay.hpp b/include/alpaka/core/Decay.hpp index 1f6fefd6d44d..6b978f563bf3 100644 --- a/include/alpaka/core/Decay.hpp +++ b/include/alpaka/core/Decay.hpp @@ -1,4 +1,4 @@ -/* Copyright 2022 Sergei Bastrakov, Jan Stephan +/* Copyright 2023 Sergei Bastrakov, Jan Stephan, Bernhard Manfred Gruber * SPDX-License-Identifier: MPL-2.0 */ @@ -8,26 +8,9 @@ #include -//! Wrapper around std::decay_t for parameter pack expansion expressions -// -// Works around PGI compiler internal error when used in empty template pack -// extension as discussed in #995. It seems not possible to make a workaround -// with pure C++ tools, like an alias template, so macro it is. Note that -// there is no known issue outside of empty parameter pack expansions, -// so the normal std::decay_t can and should be used there. -// -// The choice of macro over writing typename std::decay::type explicitly -// in parameter pack expansion expressions is to avoid warnings from diagnostic -// tools, and also for brevity. -#if BOOST_COMP_PGI -# define ALPAKA_DECAY_T(Type) typename std::decay::type -#else -# define ALPAKA_DECAY_T(Type) std::decay_t -#endif - namespace alpaka { //! Provides a decaying wrapper around std::is_same. Example: is_decayed_v returns true. template - inline constexpr auto is_decayed_v = std::is_same_v; + inline constexpr auto is_decayed_v = std::is_same_v, std::decay_t>; } // namespace alpaka diff --git a/include/alpaka/kernel/TaskKernelCpuOmp2Blocks.hpp b/include/alpaka/kernel/TaskKernelCpuOmp2Blocks.hpp index 911494f0bf16..6bf45a278f3c 100644 --- a/include/alpaka/kernel/TaskKernelCpuOmp2Blocks.hpp +++ b/include/alpaka/kernel/TaskKernelCpuOmp2Blocks.hpp @@ -807,7 +807,7 @@ namespace alpaka // Get the size of the block shared dynamic memory. auto const blockSharedMemDynSizeBytes = std::apply( - [&](ALPAKA_DECAY_T(TArgs) const&... args) + [&](std::decay_t const&... args) { return getBlockSharedMemDynSizeBytes>( m_kernelFnObj, @@ -831,7 +831,7 @@ namespace alpaka // Get the OpenMP schedule information for the given kernel and parameter types auto const schedule = std::apply( - [&](ALPAKA_DECAY_T(TArgs) const&... args) { + [&](std::decay_t const&... args) { return getOmpSchedule>( m_kernelFnObj, blockThreadExtent, diff --git a/include/alpaka/kernel/TaskKernelCpuOmp2Threads.hpp b/include/alpaka/kernel/TaskKernelCpuOmp2Threads.hpp index 8844ba87c9be..1037139fe1a6 100644 --- a/include/alpaka/kernel/TaskKernelCpuOmp2Threads.hpp +++ b/include/alpaka/kernel/TaskKernelCpuOmp2Threads.hpp @@ -64,7 +64,7 @@ namespace alpaka // Get the size of the block shared dynamic memory. auto const blockSharedMemDynSizeBytes = std::apply( - [&](ALPAKA_DECAY_T(TArgs) const&... args) + [&](std::decay_t const&... args) { return getBlockSharedMemDynSizeBytes>( m_kernelFnObj, diff --git a/include/alpaka/kernel/TaskKernelCpuSerial.hpp b/include/alpaka/kernel/TaskKernelCpuSerial.hpp index 6ca524ff7dc1..44f5d2ceca2b 100644 --- a/include/alpaka/kernel/TaskKernelCpuSerial.hpp +++ b/include/alpaka/kernel/TaskKernelCpuSerial.hpp @@ -58,7 +58,7 @@ namespace alpaka // Get the size of the block shared dynamic memory. auto const blockSharedMemDynSizeBytes = std::apply( - [&](ALPAKA_DECAY_T(TArgs) const&... args) + [&](std::decay_t const&... args) { return getBlockSharedMemDynSizeBytes>( m_kernelFnObj, diff --git a/include/alpaka/kernel/TaskKernelCpuTbbBlocks.hpp b/include/alpaka/kernel/TaskKernelCpuTbbBlocks.hpp index 264b04afc8e3..4b8f6b8bba07 100644 --- a/include/alpaka/kernel/TaskKernelCpuTbbBlocks.hpp +++ b/include/alpaka/kernel/TaskKernelCpuTbbBlocks.hpp @@ -63,7 +63,7 @@ namespace alpaka // Get the size of the block shared dynamic memory. auto const blockSharedMemDynSizeBytes = std::apply( - [&](ALPAKA_DECAY_T(TArgs) const&... args) + [&](std::decay_t const&... args) { return getBlockSharedMemDynSizeBytes>( m_kernelFnObj, diff --git a/include/alpaka/kernel/TaskKernelGpuUniformCudaHipRt.hpp b/include/alpaka/kernel/TaskKernelGpuUniformCudaHipRt.hpp index 6a7547a3ee23..7863d0173eda 100644 --- a/include/alpaka/kernel/TaskKernelGpuUniformCudaHipRt.hpp +++ b/include/alpaka/kernel/TaskKernelGpuUniformCudaHipRt.hpp @@ -219,7 +219,7 @@ namespace alpaka // Get the size of the block shared dynamic memory. auto const blockSharedMemDynSizeBytes = std::apply( - [&](remove_restrict_t const&... args) { + [&](remove_restrict_t> const&... args) { return getBlockSharedMemDynSizeBytes( task.m_kernelFnObj, blockThreadExtent, @@ -257,7 +257,7 @@ namespace alpaka // (MSVC). If not given by value, the kernel launch code does not copy the value but the pointer to the // value location. std::apply( - [&](remove_restrict_t const&... args) + [&](remove_restrict_t> const&... args) { kernelName<<< gridDim, @@ -327,7 +327,7 @@ namespace alpaka // Get the size of the block shared dynamic memory. auto const blockSharedMemDynSizeBytes = std::apply( - [&](remove_restrict_t const&... args) { + [&](remove_restrict_t> const&... args) { return getBlockSharedMemDynSizeBytes( task.m_kernelFnObj, blockThreadExtent, @@ -361,7 +361,7 @@ namespace alpaka // Enqueue the kernel execution. std::apply( - [&](remove_restrict_t const&... args) + [&](remove_restrict_t> const&... args) { kernelName<<< gridDim,