print.hpp 718 Bytes
Newer Older
Chao Liu's avatar
Chao Liu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SPDX-License-Identifier: MIT
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.

#pragma once

namespace ck {

template <typename T>
__host__ __device__ inline void print(T t)
{
    t.Print();
}

template <>
__host__ __device__ inline void print(bool v)
{
    printf("%d", static_cast<int32_t>(v));
}

template <>
__host__ __device__ inline void print(int32_t v)
{
    printf("%d", v);
}

template <>
__host__ __device__ inline void print(int64_t v)
{
    printf("%ld", v);
}

template <>
__host__ __device__ inline void print(float v)
{
    printf("%f", v);
}

template <>
__host__ __device__ inline void print(_Float16 v)
{
    printf("%f", static_cast<float>(v));
}

} // namespace ck