aboutsummaryrefslogtreecommitdiff
path: root/libffwd/platform.h
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-20 20:10:56 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-21 05:57:19 +0200
commit6b969d25ce136eaf695222bd1a10bff1ecac0220 (patch)
treec23afb50c28b9deaddae5c6526a74ee11cf2d865 /libffwd/platform.h
parentd4bdb8dae753462f621507d5fc3582e0e53da35c (diff)
downloadffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.tar.gz
ffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.zip
all: split Makefile and reorg library/tools
Diffstat (limited to 'libffwd/platform.h')
-rw-r--r--libffwd/platform.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libffwd/platform.h b/libffwd/platform.h
new file mode 100644
index 0000000..3c92c98
--- /dev/null
+++ b/libffwd/platform.h
@@ -0,0 +1,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 */