Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-hexagon/htp/pad-ops.h # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / src / ggml-hexagon / htp / pad-ops.h` 65 lines ยท 1905 bytes Raw Blame History 1 #ifndef HTP_PAD_OPS_H 2 #define HTP_PAD_OPS_H 3 4 #include "hex-common.h" 5 #include "hex-fastdiv.h" 6 #include "htp-vtcm.h" 7 #include 8 9 enum htp_pad_kernel_type { 10 HTP_PAD_KERNEL_HVX = 0, 11 HTP_PAD_KERNEL_HVX_DMA = 1, 12 HTP_PAD_KERNEL_HVX_CIRCULAR = 2, 13 HTP_PAD_KERNEL_HVX_CIRCULAR_DMA = 3, 14 }; 15 16 struct htp_pad_vtcm_layout { 17 size_t total_bytes; 18 size_t off_src0; 19 size_t off_dst; 20 size_t src_row_size_aligned; 21 size_t dst_row_size_aligned; 22 size_t src0_bytes_per_thread; 23 size_t dst_bytes_per_thread; 24 }; 25 26 static inline void htp_pad_vtcm_layout_build( 27 struct htp_pad_vtcm_layout * L, 28 size_t src_row_size, 29 size_t dst_row_size, 30 uint32_t n_threads 31 ) { 32 L->src_row_size_aligned = hex_round_up(src_row_size, 128); 33 L->dst_row_size_aligned = hex_round_up(dst_row_size, 128); 34 L->src0_bytes_per_thread = 2 * L->src_row_size_aligned; 35 L->dst_bytes_per_thread = 2 * L->dst_row_size_aligned; 36 37 size_t off = 0; 38 VTCM_LAYOUT_ALLOC(off, off_src0, L->src0_bytes_per_thread * n_threads); 39 VTCM_LAYOUT_ALLOC(off, off_dst, L->dst_bytes_per_thread * n_threads); 40 41 L->total_bytes = off; 42 } 43 44 struct htp_pad_kernel_params { 45 uint8_t kernel_type; 46 uint32_t n_threads; 47 uint32_t total_rows; 48 uint32_t use_dma; 49 uint32_t elem_size; 50 uint32_t vtcm_size; 51 52 struct fastdiv_values div_ne1; 53 struct fastdiv_values div_ne1_ne2; 54 struct fastdiv_values div_ne01; 55 struct fastdiv_values div_ne02; 56 struct fastdiv_values div_ne03; 57 }; 58 59 #if defined(__cplusplus) 60 static_assert(sizeof(struct htp_pad_kernel_params) <= 128, "htp_pad_kernel_params is too large for kernel_params blob"); 61 #else 62 _Static_assert(sizeof(struct htp_pad_kernel_params) <= 128, "htp_pad_kernel_params is too large for kernel_params blob"); 63 #endif 64 65 #endif // HTP_PAD_OPS_H