aboutsummaryrefslogtreecommitdiff
path: root/libffwd/platform.h
blob: 3c92c98194e67e84b840e2c2b21b094e04957181 (plain) (blame)
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
/* platform.h - compile-time backend selection.
 *
 * The build passes -DUSE_GPU for a GPU build. This header maps that flag and the
 * host platform to a concrete backend: Apple Silicon uses MLX, any other GPU
 * uses CUDA, and a non-GPU build is CPU. Use USE_GPU for the CPU/GPU split;
 * USE_MLX and USE_CUDA only where a specific accelerator API is called. */
#ifndef FFWD_PLATFORM_H
#define FFWD_PLATFORM_H

#if defined(USE_GPU)
#    if defined(__APPLE__)
#        define USE_MLX 1
#    else
#        define USE_CUDA 1
#    endif
#endif

/* Hardware-class label for --build-info and the startup banner. */
#if defined(USE_MLX)
#    define FFWD_BACKEND_LABEL "Apple Silicon GPU"
#elif defined(USE_CUDA)
#    define FFWD_BACKEND_LABEL "NVIDIA GPU"
#else
#    define FFWD_BACKEND_LABEL "CPU"
#endif

#endif /* FFWD_PLATFORM_H */