/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/core/utility/print.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/core/utility/print.hpp Source File#

Composable Kernel: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/core/utility/print.hpp Source File
print.hpp
Go to the documentation of this file.
1 // SPDX-License-Identifier: MIT
2 // Copyright (c) 2025, Advanced Micro Devices, Inc. All rights reserved.
3 
4 #pragma once
5 
7 
8 namespace ck_tile {
9 
12 template <typename T>
13 CK_TILE_HOST_DEVICE void print(const T&)
14 {
15  static_assert(sizeof(T) == 0,
16  "No print implementation available for this type. Please specialize "
17  "ck_tile::print for your type.");
18 }
19 
21 template <>
23 {
24  printf("%d", value);
25 }
26 
28 template <>
29 CK_TILE_HOST_DEVICE void print(const float& value)
30 {
31  printf("%f", value);
32 }
33 
35 template <>
36 CK_TILE_HOST_DEVICE void print(const double& value)
37 {
38  printf("%f", value);
39 }
40 
42 template <>
43 CK_TILE_HOST_DEVICE void print(const long& value)
44 {
45  printf("%ld", value);
46 }
47 
49 template <>
50 CK_TILE_HOST_DEVICE void print(const unsigned int& value)
51 {
52  printf("%u", value);
53 }
54 
56 template <>
57 CK_TILE_HOST_DEVICE void print(const char& value)
58 {
59  printf("%c", value);
60 }
61 
63 template <typename T, size_t N>
64 CK_TILE_HOST_DEVICE void print(const T (&value)[N])
65 {
66  printf("[");
67  for(size_t i = 0; i < N; ++i)
68  {
69  if(i > 0)
70  printf(", ");
71  print(value[i]); // Recursively call print for each element
72  }
73  printf("]");
74 }
75 
76 } // namespace ck_tile
#define CK_TILE_HOST_DEVICE
Definition: config.hpp:42
Definition: cluster_descriptor.hpp:13
CK_TILE_HOST_DEVICE void print(const tile_distribution_encoding_pattern_2d< BlockSize, YPerTile, XPerTile, VecSize, DistributionPattern, NumWaveGroups > &)
Definition: static_encoding_pattern.hpp:342
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1350