aboutsummaryrefslogtreecommitdiff
path: root/libffwd/platform.h
blob: 7d1c7ee826ae8f1319f84dd3a5c43f67ac5074f4 (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
28
29
/* Compile-time backend selection.
 *
 * The build passes -DUSE_GPU for a GPU build. This header maps that flag and the
 * host platform to a backend:
 * 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

/* Accelerator label for --build-info and the startup banner; empty on CPU. */
#if defined(USE_MLX)
#    define FFWD_BACKEND_LABEL "Apple Metal"
#elif defined(USE_CUDA)
#    define FFWD_BACKEND_LABEL "NVIDIA CUDA"
#else
#    define FFWD_BACKEND_LABEL ""
#endif

#endif /* FFWD_PLATFORM_H */