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