is_known_at_compile_time.hpp Source File

is_known_at_compile_time.hpp Source File#

Composable Kernel: 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"
8#include "sequence.hpp"
9#include "tuple.hpp"
10
11namespace ck {
12
13template <typename T>
15
16template <>
18{
19 static constexpr bool value = false;
20};
21
22template <>
23struct is_known_at_compile_time<unsigned int>
24{
25 static constexpr bool value = false;
26};
27
28template <>
30{
31 static constexpr bool value = false;
32};
33
34template <typename T, T X>
36{
37 static constexpr bool value = true;
38};
39
40template <index_t... Is>
42{
43 static constexpr bool value = true;
44};
45
46template <typename... Ts>
48{
49 __host__ __device__ static constexpr bool IsKnownAtCompileTime()
50 {
51 return container_reduce(
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:268
int32_t index_t
Definition ck.hpp:299
remove_cv_t< remove_reference_t< T > > remove_cvref_t
Definition type.hpp:297
__host__ __device__ constexpr auto container_reduce(const Container &x, Reduce reduce, Init init, Number< IBegin >=Number< 0 >{}, Number< IEnd >=Number< Container::Size()>{}, Number< IStep >=Number< 1 >{})
Definition utility/container_helper.hpp:111
int64_t long_index_t
Definition ck.hpp:300
Definition utility/sequence.hpp:43
Definition utility/tuple.hpp:117
Definition utility/integral_constant.hpp:20
static constexpr bool value
Definition is_known_at_compile_time.hpp:43
static constexpr bool value
Definition is_known_at_compile_time.hpp:59
__host__ static __device__ constexpr bool IsKnownAtCompileTime()
Definition is_known_at_compile_time.hpp:49
static constexpr bool value
Definition is_known_at_compile_time.hpp:19
static constexpr bool value
Definition is_known_at_compile_time.hpp:37
static constexpr bool value
Definition is_known_at_compile_time.hpp:31
static constexpr bool value
Definition is_known_at_compile_time.hpp:25
Definition is_known_at_compile_time.hpp:14