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/allreduce-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 / allreduce-ops.h` 63 lines ยท 1717 bytes Raw Blame History 1 #ifndef ALLREDUCE_OPS_H 2 #define ALLREDUCE_OPS_H 3 4 #include 5 #include 6 #include 7 8 #define HTP_ALLREDUCE_MAX_RANKS 4 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 enum htp_allreduce_kernel_type { 15 HTP_ALLREDUCE_KERNEL_UNSUPPORTED = 0, 16 HTP_ALLREDUCE_KERNEL_DMA_1D, 17 HTP_ALLREDUCE_KERNEL_DMA_2D, 18 }; 19 20 enum htp_allreduce_mode { 21 HTP_ALLREDUCE_FULL = 0, // all ranks reduce full tensor 22 HTP_ALLREDUCE_SHARDED_FANOUT = 1, // each rank reduces 1/N shard and fans out to all buffers 23 }; 24 25 static inline size_t htp_allreduce_vtcm_buffer_count( 26 uint32_t n_ranks, 27 uint32_t n_threads, 28 bool has_add, 29 bool is_row_bcast 30 ) { 31 return (size_t) (n_ranks + 1) * n_threads + (has_add ? (is_row_bcast ? 1 : n_threads) : 0); 32 } 33 34 struct htp_allreduce_kernel_params { 35 uint8_t kernel_type; 36 int32_t rank; 37 int32_t n_ranks; 38 int32_t n_threads; 39 int32_t block_elems; // 1D: block_elems, 2D: block_rows 40 int32_t elems_per_thread; // 1D: nelem_per_thread, 2D: nrows_per_thread 41 int32_t vtcm_size_per_thread; 42 int32_t vtcm_size; 43 int32_t ne0; 44 int32_t ne1; 45 int32_t row_size_aligned; 46 int32_t rank_elem_start; 47 int32_t rank_nelem; 48 int32_t n_dsts; 49 int32_t is_row_bcast; 50 int32_t mode; // enum htp_allreduce_mode: FULL or SHARDED_FANOUT 51 }; 52 53 #if defined(__cplusplus) 54 static_assert(sizeof(struct htp_allreduce_kernel_params) <= 128, "htp_allreduce_kernel_params is too large for kernel_params blob"); 55 #else 56 _Static_assert(sizeof(struct htp_allreduce_kernel_params) <= 128, "htp_allreduce_kernel_params is too large for kernel_params blob"); 57 #endif 58 59 #ifdef __cplusplus 60 } 61 #endif 62 63 #endif /* ALLREDUCE_OPS_H */