alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
Traits.hpp
Go to the documentation of this file.
1/* Copyright 2022 Jan Stephan, Andrea Bocci
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
9
10namespace alpaka
11{
13 {
14 };
15
16 namespace memory_scope
17 {
18 //! Memory fences are observed by all threads in the same block.
19 struct Block
20 {
21 };
22
23 //! Memory fences are observed by all threads in the same grid.
24 struct Grid
25 {
26 };
27
28 //! Memory fences are observed by all threads on the device.
29 struct Device
30 {
31 };
32 } // namespace memory_scope
33
34 //! The memory fence trait.
35 namespace trait
36 {
37 //! The mem_fence trait.
38 template<typename TMemFence, typename TMemScope, typename TSfinae = void>
39 struct MemFence;
40 } // namespace trait
41
42 //! Issues memory fence instructions.
43 //
44 // Issues a memory fence instruction for a given memory scope (\a memory_scope::Block or \a memory_scope::Device).
45 // This guarantees the following:
46 // * All \a LOAD instructions preceeding the fence will always occur before the LOAD instructions following the
47 // fence (\a LoadLoad coherence)
48 // * All \a STORE instructions preceeding the fence will always occur before the STORE instructions following the
49 // fence (\a LoadStore coherence). The pre-fence STORE results will be propagated to the other threads in the
50 // scope at an unknown point in time.
51 //
52 // Note that there are no further guarantees, especially with regard to \a LoadStore ordering. Users should not
53 // mistake this as a synchronization function between threads (please use syncBlockThreads() instead).
54 //
55 //! \tparam TMemFence The memory fence implementation type.
56 //! \tparam TMemScope The memory scope type.
57 //! \param fence The memory fence implementation.
58 //! \param scope The memory scope.
60 template<typename TMemFence, typename TMemScope>
61 ALPAKA_FN_ACC auto mem_fence(TMemFence const& fence, TMemScope const& scope) -> void
62 {
65 }
66} // namespace alpaka
#define ALPAKA_FN_ACC
All functions that can be used on an accelerator have to be attributed with ALPAKA_FN_ACC or ALPAKA_F...
Definition Common.hpp:38
#define ALPAKA_NO_HOST_ACC_WARNING
Disable nvcc warning: 'calling a host function from host device function.' Usage: ALPAKA_NO_HOST_ACC_...
Definition Common.hpp:82
typename detail::ImplementationBaseType< TInterface, TDerived >::type ImplementationBase
Returns the type that implements the given interface in the inheritance hierarchy.
Definition Interface.hpp:66
The alpaka accelerator library.
ALPAKA_NO_HOST_ACC_WARNING ALPAKA_FN_ACC auto mem_fence(TMemFence const &fence, TMemScope const &scope) -> void
Issues memory fence instructions.
Definition Traits.hpp:61
Memory fences are observed by all threads in the same block.
Definition Traits.hpp:20
Memory fences are observed by all threads on the device.
Definition Traits.hpp:30
Memory fences are observed by all threads in the same grid.
Definition Traits.hpp:25
The mem_fence trait.
Definition Traits.hpp:39