interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / src / ggml-hexagon / htp / cumsum-ops.h

49 lines · 1494 bytes Raw Blame History
1#ifndef HTP_CUMSUM_OPS_H
2#define HTP_CUMSUM_OPS_H
3
4#include "hex-common.h"
5#include "htp-vtcm.h"
6#include <stdint.h>
7
8struct htp_cumsum_vtcm_layout {
9 size_t total_bytes;
10 size_t off_src0;
11 size_t off_dst;
12 size_t src_row_size_aligned;
13 size_t dst_row_size_aligned;
14 size_t src0_bytes_per_thread;
15 size_t dst_bytes_per_thread;
16};
17
18static inline void htp_cumsum_vtcm_layout_build(
19 struct htp_cumsum_vtcm_layout * L,
20 size_t src_row_size,
21 size_t dst_row_size,
22 uint32_t n_threads
23) {
24 L->src_row_size_aligned = hex_round_up(src_row_size, 128);
25 L->dst_row_size_aligned = hex_round_up(dst_row_size, 128);
26 L->src0_bytes_per_thread = 2 * L->src_row_size_aligned;
27 L->dst_bytes_per_thread = 2 * L->dst_row_size_aligned;
28
29 size_t off = 0;
30 VTCM_LAYOUT_ALLOC(off, off_src0, L->src0_bytes_per_thread * n_threads);
31 VTCM_LAYOUT_ALLOC(off, off_dst, L->dst_bytes_per_thread * n_threads);
32
33 L->total_bytes = off;
34}
35
36struct htp_cumsum_kernel_params {
37 uint32_t n_threads;
38 uint32_t total_rows;
39 uint32_t use_dma;
40 uint32_t vtcm_size;
41};
42
43#if defined(__cplusplus)
44static_assert(sizeof(struct htp_cumsum_kernel_params) <= 128, "htp_cumsum_kernel_params is too large for kernel_params blob");
45#else
46_Static_assert(sizeof(struct htp_cumsum_kernel_params) <= 128, "htp_cumsum_kernel_params is too large for kernel_params blob");
47#endif
48
49#endif // HTP_CUMSUM_OPS_H