/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/docs-6.4.3/include/ck/utility/is_known_at_compile_time.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/docs-6.4.3/include/ck/utility/is_known_at_compile_time.hpp Source File#

Composable Kernel: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/docs-6.4.3/include/ck/utility/is_known_at_compile_time.hpp Source File
is_known_at_compile_time.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: MIT
2 // Copyright (c) 2018-2024, Advanced Micro Devices, Inc. All rights reserved.
3 
4 #pragma once
5 
6 #include "ck/ck.hpp"
7 #include "integral_constant.hpp"
8 #include "sequence.hpp"
9 #include "tuple.hpp"
10 
11 namespace ck {
12 
13 template <typename T>
15 
16 template <>
18 {
19  static constexpr bool value = false;
20 };
21 
22 template <>
23 struct is_known_at_compile_time<unsigned int>
24 {
25  static constexpr bool value = false;
26 };
27 
28 template <>
30 {
31  static constexpr bool value = false;
32 };
33 
34 template <typename T, T X>
36 {
37  static constexpr bool value = true;
38 };
39 
40 template <index_t... Is>
42 {
43  static constexpr bool value = true;
44 };
45 
46 template <typename... Ts>
48 {
49  __host__ __device__ static constexpr bool IsKnownAtCompileTime()
50  {
51  return container_reduce(
52  Tuple<Ts...>{},
53  [](auto x, bool r) {
54  return is_known_at_compile_time<remove_cvref_t<decltype(x)>>::value & r;
55  },
56  true);
57  }
58 
59  static constexpr bool value = IsKnownAtCompileTime();
60 };
61 
62 } // namespace ck
Definition: ck.hpp:264
int64_t long_index_t
Definition: ck.hpp:290
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Definition: type.hpp:300
int32_t index_t
Definition: ck.hpp:289
__host__ constexpr __device__ auto container_reduce(const Container &x, Reduce reduce, Init init, Number< IBegin >=Number< 0 >{}, Number< IEnd >=Number< Container::Size()>{}, Number< IStep >=Number< 1 >{})
Definition: container_helper.hpp:111
Definition: sequence.hpp:43
Definition: tuple.hpp:117
Definition: integral_constant.hpp:10
__host__ static constexpr __device__ bool IsKnownAtCompileTime()
Definition: is_known_at_compile_time.hpp:49
Definition: is_known_at_compile_time.hpp:14