char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Max Krasnyanskyhexagon: new vtcm layouts and improved pipelines for MUL_MAT, MUL_MAT_ID and FLASH_ATTN_EXT (#25425)81ff7abe5

char/aliceai-t5-moe
684 B19 linesraw
1#ifndef HTP_VTCM_H
2#define HTP_VTCM_H
3
4#include <stddef.h>
5#include <stdint.h>
6
7static inline uint8_t *vtcm_seq_alloc(uint8_t **vtcm_ptr, size_t size) {
8    uint8_t *p = *vtcm_ptr;
9    *vtcm_ptr += size;
10    return p;
11}
12
13#define VTCM_LAYOUT_ALLOC(off, field, sz) do { (L)->field = (off); (off) += (sz); } while (0)
14#define VTCM_LAYOUT_ALLOC_OPTIONAL(off, field, sz, cond) do { if (cond) { VTCM_LAYOUT_ALLOC(off, field, sz); } else { (L)->field = 0; } } while (0)
15
16#define VTCM_LAYOUT_PTR(type, base, offset) ((type *)((uint8_t *)(base) + (offset)))
17#define VTCM_LAYOUT_PTR_OPTIONAL(type, base, offset, cond) ((cond) ? VTCM_LAYOUT_PTR(type, base, offset) : NULL)
18
19#endif // HTP_VTCM_H