char-fork/llama.cpp

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

Neo Zhangsycl : Fix get mem error (#28227)b6b003d2c

char/aliceai-t5-moe
1.3 KiB43 linesraw
1#ifndef GGML_SYCL_BASE_HPP
2#define GGML_SYCL_BASE_HPP
3
4/**
5 * Module: base
6 *
7 * Description:
8 * Provides zero-dependency, foundational primitives, core abstractions,
9 * and low-level system interfaces. This module acts as the lowest layer
10 * of the architecture and is consumed globally across all subsystems.
11 *
12 * Constraints:
13 * - STRICTLY zero upstream dependencies (leaf module).
14 * - High stability and backward compatibility required.
15 */
16
17#include <cstdio>
18
19extern int g_ggml_sycl_debug;
20extern int g_ggml_sycl_dev_debug;
21
22#if defined(__clang__) && __has_builtin(__builtin_expect)
23// Hint the optimizer to pipeline the more likely following instruction in branches
24#    define LIKELY(expr)   __builtin_expect(expr, true)
25#    define UNLIKELY(expr) __builtin_expect(expr, false)
26#else
27#    define LIKELY(expr)   (expr)
28#    define UNLIKELY(expr) (expr)
29#endif
30
31#define GGML_SYCL_DEBUG(...)              \
32    do {                                  \
33        if (UNLIKELY(g_ggml_sycl_debug))  \
34            fprintf(stderr, __VA_ARGS__); \
35    } while (0)
36
37#define GGML_SYCL_DEV_DEBUG(...)          \
38    do {                                  \
39        if (UNLIKELY(g_ggml_sycl_dev_debug))  \
40            fprintf(stderr, __VA_ARGS__); \
41    } while (0)
42
43#endif  // GGML_SYCL_BASE_HPP