4 #ifndef UTILITY_DEBUG_HPP
5 #define UTILITY_DEBUG_HPP
12 template <
typename T,
typename Enable =
void>
19 __host__ __device__
static void Print(
const T& p) { printf(
"%.3f ",
static_cast<type>(p)); }
28 printf(
"%.3f ",
static_cast<type>(p));
36 __host__ __device__
static void Print(
const T& p) { printf(
"%d ",
static_cast<type>(p)); }
48 template <
typename T, index_t element_str
ide = 1, index_t row_
bytes = 128>
51 constexpr
index_t row_elements = row_bytes /
sizeof(T);
52 static_assert((element_stride >= 1 && element_stride <= row_elements),
53 "element_stride should between [1, row_elements]");
55 index_t wgid = blockIdx.x + blockIdx.y * gridDim.x + gridDim.x * gridDim.y * blockIdx.z;
57 (threadIdx.z * (blockDim.x * blockDim.y)) + (threadIdx.y * blockDim.x) + threadIdx.x;
63 printf(
"\nWorkgroup id %d, bytes per row %d, element stride %d\n\n",
67 for(
index_t i = 0; i < num_elements; i += row_elements)
69 printf(
"elem %5d: ", i);
70 for(
index_t j = 0; j < row_elements; j += element_stride)
84 __device__
static bool is_thread_local_1d_id_idx()
87 return ((tid == Ids) || ...);
94 template <
auto... val>
95 [[deprecated(
"Help function to print value")]]
inline constexpr
void CK_PRINT()
98 template <
typename... type>
99 [[deprecated(
"Help function to print value")]]
inline constexpr
void CK_PRINT()
constexpr void CK_PRINT()
Definition: debug.hpp:95
__device__ void print_shared(T const *p_shared, index_t num_elements)
Definition: debug.hpp:49
_Float16 half_t
Definition: data_type.hpp:30
std::enable_if< B, T > enable_if
Definition: enable_if.hpp:24
int32_t index_t
Definition: ck.hpp:300
__device__ index_t get_thread_local_1d_id()
Definition: get_id.hpp:19
float type
Definition: debug.hpp:18
__host__ static __device__ void Print(const T &p)
Definition: debug.hpp:19
int type
Definition: debug.hpp:35
__host__ static __device__ void Print(const T &p)
Definition: debug.hpp:36
__host__ static __device__ void Print(const ck::half_t &p)
Definition: debug.hpp:26
float type
Definition: debug.hpp:25