kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
dispatch_label.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL_HPP
2
#define KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL_HPP
3
4
#include <algorithm>
5
#include <array>
6
#include <string_view>
7
8
#include "Kokkos_Core.hpp"
9
10
namespace
Kokkos::Execution::Impl
{
11
12
template
<
size_t
N>
13
struct
FixedString
{
14
char
data
[N]{};
15
16
consteval
FixedString
(
const
char
(&str)[N])
noexcept
{
// NOLINT(google-explicit-constructor)
17
std::copy_n(str, N,
data
);
18
}
19
20
consteval
auto
size
()
const
{
21
return
N - 1;
22
}
23
24
consteval
auto
begin
()
const
{
25
return
data
;
26
}
27
consteval
auto
end
()
const
{
28
return
data
+ N - 1;
29
}
30
};
31
33
template
<Kokkos::ExecutionSpace Exec, FixedString Suffix>
34
static
constexpr
auto
dispatch_label_v
= [] {
35
constexpr
auto
prefix = Kokkos::Impl::TypeInfo<Exec>::name();
36
std::array<char, prefix.size() + Suffix.size() + 1> buf{};
37
auto
iter = buf.begin();
38
for
(
const
auto
charac: prefix)
39
*iter++ = charac;
40
for
(
const
auto
charac: Suffix)
41
*iter++ = charac;
42
return
buf;
43
}();
44
46
template
<Kokkos::ExecutionSpace Exec, FixedString Suffix>
47
consteval
std::string_view
dispatch_label
() noexcept {
48
return
{
dispatch_label_v<Exec, Suffix>
.data(),
dispatch_label_v<Exec, Suffix>
.size() - 1};
49
}
50
51
}
// namespace Kokkos::Execution::Impl
52
53
#endif
// KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL_HPP
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::dispatch_label_v
static constexpr auto dispatch_label_v
Get the dispatch label from Exec and Suffix.
Definition
dispatch_label.hpp:34
Kokkos::Execution::Impl::dispatch_label
consteval std::string_view dispatch_label() noexcept
View the dispatch label as a std::string_view.
Definition
dispatch_label.hpp:47
Kokkos::Execution::Impl::FixedString::end
consteval auto end() const
Definition
dispatch_label.hpp:27
Kokkos::Execution::Impl::FixedString::begin
consteval auto begin() const
Definition
dispatch_label.hpp:24
Kokkos::Execution::Impl::FixedString::size
consteval auto size() const
Definition
dispatch_label.hpp:20
Kokkos::Execution::Impl::FixedString::data
char data[N]
Definition
dispatch_label.hpp:14
Kokkos::Execution::Impl::FixedString::FixedString
consteval FixedString(const char(&str)[N]) noexcept
Definition
dispatch_label.hpp:16
kokkos-execution
impl
dispatch_label.hpp
Generated on
for kokkos-execution by
1.18.0