/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/ops/common/utils.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/ops/common/utils.hpp Source File#

Composable Kernel: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-composable-kernel/checkouts/develop/include/ck_tile/ops/common/utils.hpp Source File
utils.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 
6 #include <iostream>
7 #include <string>
8 
9 #include "ck_tile/core.hpp"
10 
11 namespace ck_tile {
12 
13 // clang-format off
14 template <typename T> struct typeToStr;
15 template <> struct typeToStr<float> { static constexpr const char * name = "fp32"; };
16 template <> struct typeToStr<fp16_t> { static constexpr const char * name = "fp16"; };
17 template <> struct typeToStr<bf16_t> { static constexpr const char * name = "bf16"; };
18 template <> struct typeToStr<fp8_t> { static constexpr const char * name = "fp8"; };
19 template <> struct typeToStr<bf8_t> { static constexpr const char * name = "bf8"; };
20 template <> struct typeToStr<int8_t> { static constexpr const char * name = "int8"; };
21 template <> struct typeToStr<pk_int4_t> { static constexpr const char * name = "pk_int4"; };
22 // clang-format on
23 
24 template <typename ADataType_, typename BDataType_>
25 std::string gemm_prec_str()
26 {
27  std::string base_str = std::string(typeToStr<ADataType_>::name);
28  if(!std::is_same_v<ADataType_, BDataType_>)
29  {
30  base_str += "_" + std::string(typeToStr<BDataType_>::name);
31  }
32  return base_str;
33 }
34 
35 } // namespace ck_tile
Definition: cluster_descriptor.hpp:13
_BitInt(8) fp8_t
Definition: float8.hpp:204
_Float16 fp16_t
Definition: half.hpp:110
int8_t int8_t
Definition: int8.hpp:20
bfloat16_t bf16_t
Definition: bfloat16.hpp:113
std::string gemm_prec_str()
Definition: utils.hpp:25
unsigned _BitInt(8) bf8_t
Definition: float8.hpp:206
Definition: pk_int4.hpp:21
Definition: utils.hpp:14