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
#if defined(__cpp_impl_reflection)
7
# include <meta>
8
#endif
9
#include <ranges>
10
#include <string_view>
11
12
#include "stdexec/__detail/__config.hpp"
13
14
#include "Kokkos_Macros.hpp"
15
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
16
import
kokkos.core;
17
# if !defined(__cpp_impl_reflection)
18
# include "Kokkos_TypeInfo.hpp"
19
# endif
20
#else
21
# include "Kokkos_Core.hpp"
22
#endif
23
24
#include "
kokkos-execution/impl/fixed_string.hpp
"
25
26
namespace
Kokkos::Execution::Impl
{
27
28
#if !defined(__cpp_impl_reflection)
29
namespace
detail
{
30
31
template
<Kokkos::ExecutionSpace Exec, FixedString Suffix>
32
consteval
auto
dispatch_label
() {
33
constexpr
std::string_view prefix = Kokkos::Impl::TypeInfo<Exec>::name();
34
std::array<char, prefix.size() + Suffix.size()> buf{};
35
std::ranges::copy(Suffix, std::ranges::copy(prefix, buf.begin()).out);
36
return
buf;
37
}
38
39
}
// namespace detail
40
42
template
<Kokkos::ExecutionSpace Exec, FixedString Suffix>
43
constexpr
auto
dispatch_label_v
=
detail::dispatch_label<Exec, Suffix>
();
44
46
template
<Kokkos::ExecutionSpace Exec, FixedString Suffix>
47
consteval
auto
dispatch_label
()
48
STDEXEC_AUTO_RETURN(std::string_view{
dispatch_label_v<Exec, Suffix>
.data(),
dispatch_label_v<Exec, Suffix>
.size()})
49
50
// NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
51
# define
KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL
(_exec_, _suffix_) \
52
Kokkos::Execution::Impl::dispatch_label<KOKKOS_IMPL_STRIP_PARENS(_exec_), _suffix_>()
53
#else
55
template
<Kokkos::ExecutionSpace Exec>
56
consteval
std::string_view
dispatch_label
(std::string_view suffix)
noexcept
{
57
return
std::define_static_string(std::views::concat(std::meta::display_string_of(^^Exec), suffix));
58
}
59
60
# define KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL(_exec_, _suffix_) \
61
Kokkos::Execution::Impl::dispatch_label<KOKKOS_IMPL_STRIP_PARENS(_exec_)>(_suffix_)
62
#endif
63
}
// namespace Kokkos::Execution::Impl
64
65
#endif
// KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL_HPP
dispatch_label
constexpr std::string dispatch_label(const Exec &, const std::string_view label)
Get the dispatch label from Exec and label.
Definition
callback_matchers.hpp:57
KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL
#define KOKKOS_EXECUTION_IMPL_DISPATCH_LABEL(_exec_, _suffix_)
Definition
dispatch_label.hpp:51
fixed_string.hpp
Kokkos::Execution::Impl::detail
Definition
dispatch_label.hpp:29
Kokkos::Execution::Impl::detail::dispatch_label
consteval auto dispatch_label()
Definition
dispatch_label.hpp:32
Kokkos::Execution::Impl
Definition
attributes.hpp:6
Kokkos::Execution::Impl::dispatch_label
consteval auto dispatch_label() noexcept(noexcept(std::string_view{dispatch_label_v< Exec, Suffix >.data(), dispatch_label_v< Exec, Suffix >.size()})) -> decltype(std::string_view{dispatch_label_v< Exec, Suffix >.data(), dispatch_label_v< Exec, Suffix >.size()})
View the dispatch label as a std::string_view.
Definition
dispatch_label.hpp:47
Kokkos::Execution::Impl::dispatch_label_v
constexpr auto dispatch_label_v
Get the dispatch label from Exec and Suffix.
Definition
dispatch_label.hpp:43
kokkos-execution
impl
dispatch_label.hpp
Generated on
for kokkos-execution by
1.18.0