alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
tag.hpp
Go to the documentation of this file.
1/* Copyright 2024 René Widera
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
7#include "alpaka/core/PP.hpp"
8#include "alpaka/core/Tag.hpp"
10
11#include <cassert>
12#include <tuple>
13
14namespace alpaka::onAcc
15{
16 /** Origin of index domains
17 *
18 * An origin is used to query the index domain within a block or grid.
19 */
20 namespace origin
21 {
22 ALPAKA_TAG(thread);
24 ALPAKA_TAG(block);
26 } // namespace origin
27
28 /** Unit of index domains
29 *
30 * A unit is used to describe the quantity of the index domain with respect to an origin
31 */
32 namespace unit
33 {
34 ALPAKA_TAG(warps);
35 ALPAKA_TAG(threads);
36 ALPAKA_TAG(blocks);
37 } // namespace unit
38
39 namespace trait
40 {
41 template<typename T>
42 struct IsOrigin : std::false_type
43 {
44 };
45
46 template<>
47 struct IsOrigin<ALPAKA_TYPEOF(origin::warp)> : std::true_type
48 {
49 };
50
51 template<>
52 struct IsOrigin<ALPAKA_TYPEOF(origin::block)> : std::true_type
53 {
54 };
55
56 template<>
57 struct IsOrigin<ALPAKA_TYPEOF(origin::grid)> : std::true_type
58 {
59 };
60
61 template<>
62 struct IsOrigin<ALPAKA_TYPEOF(origin::thread)> : std::true_type
63 {
64 };
65
66 template<typename T>
67 struct IsUnit : std::false_type
68 {
69 };
70
71 template<>
72 struct IsUnit<ALPAKA_TYPEOF(unit::threads)> : std::true_type
73 {
74 };
75
76 template<>
77 struct IsUnit<ALPAKA_TYPEOF(unit::warps)> : std::true_type
78 {
79 };
80
81 template<>
82 struct IsUnit<ALPAKA_TYPEOF(unit::blocks)> : std::true_type
83 {
84 };
85 } // namespace trait
86
87 template<typename T>
89
90 template<typename T>
92
93 namespace concepts
94 {
95 template<typename T>
97
98 template<typename T>
99 concept Unit = isUnit_v<T>;
100 } // namespace concepts
101
102} // namespace alpaka::onAcc
#define ALPAKA_TAG(name)
Definition Tag.hpp:16
#define ALPAKA_TYPEOF(...)
Get the type of instance.
Definition common.hpp:154
Origin of index domains.
Definition tag.hpp:21
Unit of index domains.
Definition tag.hpp:33
functionality which is usable on the accelerator compute device from within a kernel.
Definition executor.hpp:38
constexpr bool isUnit_v
Definition tag.hpp:91
constexpr bool isOrigin_v
Definition tag.hpp:88