* enhance get mem info by l0 an SYCL API * remove debug code, format the code * update SYCL.md for GGML_SYCL_GET_MEM_API
37 lines
1.0 KiB
C++
37 lines
1.0 KiB
C++
#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;
|
|
|
|
#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)
|
|
|
|
#endif // GGML_SYCL_BASE_HPP
|