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 / diag-ops.h

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