ggml
[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)
Brought by drakestapleton
ggml / src / ggml-sycl / base.hpp
| 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 | |
| 19 | extern int g_ggml_sycl_debug; |
| 20 | extern 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 |