Debian Codegraph @

external/whispercpp/common.h

raw symbols SCIP
1 #cxx . . $ `<file>/external/whispercpp/common.h`/pragma once
2
3 #include "ggml.h"cxx . . $ `<file>/external/whispercpp/ggml.h`/
4 #include "traits.h"cxx . . $ `<file>/external/whispercpp/traits.h`/
5 #include "ggml-cpu-impl.h"cxx . . $ `<file>/external/whispercpp/ggml-cpu-impl.h`/
6 #include "ggml-impl.h"cxx . . $ `<file>/external/whispercpp/ggml-impl.h`/
7 #include "simd-mappings.h"cxx . . $ `<file>/external/whispercpp/simd-mappings.h`/
8
9 #define GGML_FA_TILE_Qcxx . . $ `external/whispercpp/common.h:9:9`! 64
10 #define GGML_FA_TILE_KVcxx . . $ `external/whispercpp/common.h:10:9`! 64
11
12 #ifdef __cpluspluscxx . . $ `<built-in>:470:9`!
13
14 #include <utility>
15
16 // convenience functions/macros for use in template calls
17 // note: these won't be required after the 'traits' lookup table is used.
18 static inline ggml_fp16_t f32_to_f16cxx . . $ f32_to_f16(a7602afe0c5a7a59).(float x) {
19 return GGML_CPU_FP32_TO_FP16cxx . . $ `external/whispercpp/simd-mappings.h:144:9`!(x);
20 }
21
22 static inline float f16_to_f32cxx . . $ f16_to_f32(9a38df040a81ca35).(ggml_fp16_t x) {
23 return GGML_CPU_FP16_TO_FP32cxx . . $ `external/whispercpp/simd-mappings.h:140:9`!(x);
24 }
25
26 static inline ggml_bf16_t f32_to_bf16cxx . . $ f32_to_bf16(4b9b7da6982f80a2).(float x) {
27 return GGML_FP32_TO_BF16cxx . . $ `external/whispercpp/ggml-impl.h:570:9`!(x);
28 }
29
30 static inline float bf16_to_f32cxx . . $ bf16_to_f32(19100f69e776d75a).(ggml_bf16_t x) {
31 return GGML_BF16_TO_FP32cxx . . $ `external/whispercpp/ggml-impl.h:571:9`!(x);
32 }
33
34 static inline float i32_to_f32cxx . . $ i32_to_f32(5cde91ea12d43f46).(int32_tcxx . . $ int32_t# x) {
35 return x;
36 }
37
38 static inline int32_tcxx . . $ int32_t# f32_to_i32cxx . . $ f32_to_i32(1bb0578f3efdc255).(float x) {
39 return x;
40 }
41
42 static inline float f32_to_f32cxx . . $ f32_to_f32(fbcf3211dfe1bfd1).(float x) {
43 return x;
44 }
45
46 // TODO - merge this into the traits table, after using row-based conversions
47 template <class T>
48 struct type_conversion_tablecxx . . $ type_conversion_table#;
49
50 template <>
51 struct type_conversion_tablecxx . . $ type_conversion_table#<ggml_fp16_t> {
52 static constexpr float (*to_f32cxx . . $ type_conversion_table#to_f32.)(ggml_fp16_t) = f16_to_f32cxx . . $ f16_to_f32(9a38df040a81ca35).;
53 static constexpr ggml_fp16_t (*from_f32cxx . . $ type_conversion_table#from_f32.)(float) = f32_to_f16cxx . . $ f32_to_f16(a7602afe0c5a7a59).;
54 };
55
56 template <>
57 struct type_conversion_tablecxx . . $ type_conversion_table#<float> {
58 static constexpr float (*to_f32cxx . . $ type_conversion_table#to_f32.)(float) = f32_to_f32cxx . . $ f32_to_f32(fbcf3211dfe1bfd1).;
59 static constexpr float (*from_f32cxx . . $ type_conversion_table#from_f32.)(float) = f32_to_f32cxx . . $ f32_to_f32(fbcf3211dfe1bfd1).;
60 };
61
62 template <>
63 struct type_conversion_tablecxx . . $ type_conversion_table#<ggml_bf16_t> {
64 static constexpr float (*to_f32cxx . . $ type_conversion_table#to_f32.)(ggml_bf16_t) = bf16_to_f32cxx . . $ bf16_to_f32(19100f69e776d75a).;
65 static constexpr ggml_bf16_t (*from_f32cxx . . $ type_conversion_table#from_f32.)(float) = f32_to_bf16cxx . . $ f32_to_bf16(4b9b7da6982f80a2).;
66 };
67
68 template <>
69 struct type_conversion_tablecxx . . $ type_conversion_table#<int32_tcxx . . $ int32_t#> {
70 static constexpr float (*to_f32cxx . . $ type_conversion_table#to_f32.)(int32_tcxx . . $ int32_t#) = i32_to_f32cxx . . $ i32_to_f32(5cde91ea12d43f46).;
71 static constexpr int32_tcxx . . $ int32_t# (*from_f32cxx . . $ type_conversion_table#from_f32.)(float) = f32_to_i32cxx . . $ f32_to_i32(1bb0578f3efdc255).;
72 };
73
74 static stdcxx . . $ std/::pair<int64_tcxx . . $ int64_t#, int64_tcxx . . $ int64_t#> get_thread_rangecxx . . $ get_thread_range(9e153b0c10f4f4a0).(const struct ggml_compute_paramscxx . . $ ggml_compute_params# * params, const struct ggml_tensor * src0) {
75 const int64_tcxx . . $ int64_t# ith = params->ithcxx . . $ ggml_compute_params#ith.;
76 const int64_tcxx . . $ int64_t# nth = params->nthcxx . . $ ggml_compute_params#nth.;
77
78 const int64_tcxx . . $ int64_t# nr = ggml_nrows(src0);
79
80 // rows per thread
81 const int64_tcxx . . $ int64_t# dr = (nr + nth - 1)/nth;
82
83 // row range for this thread
84 const int64_tcxx . . $ int64_t# ir0 = dr*ith;
85 const int64_tcxx . . $ int64_t# ir1 = MINcxx . . $ `external/whispercpp/ggml-impl.h:34:13`!(ir0 + dr, nr);
86
87 return {ir0, ir1};
88 }
89
90 struct ggml_fa_tile_configcxx . . $ ggml_fa_tile_config# {
91 static constexpr size_t Qcxx . . $ ggml_fa_tile_config#Q. = GGML_FA_TILE_Qcxx . . $ `external/whispercpp/common.h:9:9`!;
92 static constexpr size_t KVcxx . . $ ggml_fa_tile_config#KV. = GGML_FA_TILE_KVcxx . . $ `external/whispercpp/common.h:10:9`!;
93 };
94
95 #endif