Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
def265b
Add MLX backend for Apple Silicon
ChinChangYang Jan 15, 2026
3540214
Optimize MLX backend with logaddexp and addmm
ChinChangYang Jan 15, 2026
2c9f18b
Skip mask ops in MLX backend when requireExactNNLen=true
ChinChangYang Jan 15, 2026
50cfcbc
Add graph compilation to MLX backend for improved throughput
ChinChangYang Jan 16, 2026
611476b
Add FP16 support to MLX backend
ChinChangYang Jan 16, 2026
b8f227b
Harden MLX backend CMake configuration
ChinChangYang Apr 22, 2026
4580a33
Add SP1 design spec: custom Winograd F(2,3) fp32 conv for MLX backend
ChinChangYang May 19, 2026
3d0c740
Add SP1 implementation plan: MLX Winograd F(2,3) fp32 conv
ChinChangYang May 19, 2026
8c08810
Add F(2,3) Winograd constants + CPU reference oracle for MLX backend
ChinChangYang May 19, 2026
5f58992
Fix Task 1 review: inline constexpr matrices, drop unused include, ti…
ChinChangYang May 19, 2026
19b12b9
Add MLX Winograd F(2,3) metal_kernel validated against CPU oracle
ChinChangYang May 19, 2026
9127f23
Fix Task 2 review: inline constexpr kWinogradSource, document tg1 SP2…
ChinChangYang May 19, 2026
a2be53c
Route 3x3 trunk convs through Winograd in MLX ConvLayer (env-var safe…
ChinChangYang May 19, 2026
c3ed737
Fix Task 3 review: skip building unused OHWI weights when Winograd ac…
ChinChangYang May 19, 2026
f55c26c
Add thermally-robust paired honest-measurement harness for MLX vs Metal
ChinChangYang May 19, 2026
9c818b0
SP1 acceptance: MLX-fp32 Winograd vs Metal paired-harness result (GAT…
ChinChangYang May 19, 2026
d22d2a7
SP1 perf fix: three-stage Winograd (input-xform + mx::matmul + output…
ChinChangYang May 19, 2026
468883f
SP1 acceptance: MLX-fp32 three-stage Winograd beats Metal (529.79±2.9…
ChinChangYang May 19, 2026
3b4a472
Add SP2 design spec — MLX Winograd autotuner
ChinChangYang May 20, 2026
c131116
Strengthen SP2 acceptance test #1
ChinChangYang May 20, 2026
e67e438
Add SP2 implementation plan
ChinChangYang May 20, 2026
6bbe07c
SP2 Task 1: split WinogradConfig into per-stage InputTransform/Output…
ChinChangYang May 20, 2026
e0e1be8
SP2 Task 2: MLXWinogradTuneParams struct + plain-text persistence
ChinChangYang May 20, 2026
5cc1145
SP2 Task 2 review fixes: improve parser diagnostics + add boundary test
ChinChangYang May 20, 2026
16aab33
SP2 Task 3: measurement primitive for tuner candidates
ChinChangYang May 20, 2026
2a2fd3c
SP2 Task 3 review fixes: warmup discipline + channel-alias bug + link…
ChinChangYang May 20, 2026
3ca7907
SP2 Task 4: grid search + loadOrAutoTune
ChinChangYang May 20, 2026
d226391
SP2 spec amendment: search-works assertion (a) calibrated to hardware…
ChinChangYang May 20, 2026
ef51a95
SP2 Task 4: grid search + loadOrAutoTune (search-works test calibrated)
ChinChangYang May 20, 2026
8c49c14
SP2 Task 4 review fixes: real seed override + comment accuracy + dedu…
ChinChangYang May 20, 2026
4712493
SP2 Task 5: wire tuner into ComputeHandle/Model/ConvLayer
ChinChangYang May 20, 2026
8d7d65b
SP2 Task 5 review fix: makeCacheKey includes actual tg0/tg1 quadruple
ChinChangYang May 20, 2026
6097808
SP2 acceptance: MLX-fp32 Winograd with tuner-cached configs >= Metal
ChinChangYang May 20, 2026
bb729a5
Add SP3 design spec — MLX Winograd fp16 with selective fp32 accumulation
ChinChangYang May 20, 2026
f011943
SP3 spec amendment: BN fp32 intermediate REQUIRED + paired-t gate
ChinChangYang May 20, 2026
87a0853
Add SP3 implementation plan
ChinChangYang May 20, 2026
09f06b4
SP3 Task 1: templatize Winograd kernels on T (fp16/fp32 dispatch)
ChinChangYang May 20, 2026
678ee7d
SP3 Task 2: BatchNormLayer fp32 intermediate (required for accuracy)
ChinChangYang May 20, 2026
e7ca5a9
SP3 Task 3: ConvLayer drops !useFP16 gate, threads dtype to Winograd
ChinChangYang May 20, 2026
6d52ed8
SP3 Task 4: tuner cache filename gains _fp16/_fp32 dtype suffix
ChinChangYang May 20, 2026
71ebdac
SP3 Task 5: ComputeHandle wires useFP16 into tuner; comments updated
ChinChangYang May 20, 2026
5c29b58
SP3 Task 6: bench harness — env-var fp16 hooks + paired-t output
ChinChangYang May 20, 2026
0f4fd12
SP3 Task 7: acceptance orchestrator (two paired-t arms + testgpuerror)
ChinChangYang May 20, 2026
1ca9ac9
SP3 Auto -> fp16 flip: mlxUseFP16 = auto now means fp16
ChinChangYang May 20, 2026
727366c
SP3 acceptance: MLX-fp16 Winograd >= Metal-fp16, > MLX-fp32 (SP2)
ChinChangYang May 20, 2026
36a8818
SP3 post-acceptance hardening: Model::apply() fp16 guard + fp16 searc…
ChinChangYang May 20, 2026
ff41df7
Add SP4 design spec — aggressive F(2,3) autotuner
ChinChangYang May 20, 2026
bbf2974
Add SP4 implementation plan
ChinChangYang May 20, 2026
8f29342
SP4 Task 1: bump tuner schema to v2 — add wpt/vw/gridOrder/matmulOrie…
ChinChangYang May 20, 2026
81ad9a1
SP4 Task 2: thread WPT/VW/GRID_ORDER/MATMUL_ORIENT template args thro…
ChinChangYang May 20, 2026
891a227
SP4 Task 3: WPT loop in both transform kernels with tail guards
ChinChangYang May 20, 2026
ee6121d
SP4 Task 4: VW (vector-width) packing in both transform kernels — Cfa…
ChinChangYang May 20, 2026
4e9794f
SP4 Task 5: gridOrder Tfast branch in both transform kernels
ChinChangYang May 20, 2026
95c0157
SP4 Task 6: matmulOrient Tpd path in kernels + host filter
ChinChangYang May 20, 2026
dc3ceb0
SP4 Task 7: expanded candidate sets + per-model validity filtering
ChinChangYang May 20, 2026
a8ef3b7
SP4 Task 8: Joint pass A — (wpt, vw) sweep with top-3 carry-through
ChinChangYang May 20, 2026
a10030e
SP4 Task 9: Joint pass B — (tg0, tg1) sweep over top-(wpt, vw) configs
ChinChangYang May 20, 2026
fc46d68
SP4 Task 10: refinement — coordinate-descent around the joint-pass wi…
ChinChangYang May 20, 2026
f01b6d7
SP4 Task 11: hierarchical driver — orient → gridOrder → joint A → joi…
ChinChangYang May 20, 2026
8a8959d
SP4 Task 12: wire matmulOrient + new tuner fields through ConvLayer /…
ChinChangYang May 20, 2026
894da25
SP4 Task 13: bad-seed convergence test — refinement moves ≥30% on at …
ChinChangYang May 20, 2026
0f12a57
SP4 Task 14: cache version-mismatch retune test
ChinChangYang May 20, 2026
6763df0
SP4 Task 15: acceptance orchestrator — SP3 vs SP4 paired-t + testgpue…
ChinChangYang May 20, 2026
e1714f1
SP4 acceptance: aggressive F(2,3) autotuner gates — all 5 PASS
ChinChangYang May 20, 2026
ee311c2
SP4 cleanup: dead struct removal + stale comments
ChinChangYang May 20, 2026
cc6ba06
Add SP5 — Winograd tuner simplification spec
ChinChangYang May 20, 2026
ec0659a
Add SP5 — Winograd tuner simplification implementation plan
ChinChangYang May 20, 2026
2f5aeae
SP5 Task 1: Add flat per-stage sweep functions (not yet wired)
ChinChangYang May 20, 2026
7c50049
SP5 Task 2: Switch loadOrAutoTune to flat sweep; delete Joint-A/B/refine
ChinChangYang May 20, 2026
a00be53
SP5 Task 3: Drop output VW (kernel + data model + tests)
ChinChangYang May 21, 2026
3bc39c2
SP5 Task 4: Drop output gridOrder (kernel + data model + tests)
ChinChangYang May 21, 2026
b16a81f
SP5 Task 5: Drop matmulOrient (enum + kernel + weight layout + backen…
ChinChangYang May 21, 2026
3703817
SP5 Task 6: Drop global gridOrder field from MLXWinogradTuneParams
ChinChangYang May 21, 2026
927ac64
SP5 Task 7: Bump cache schema to v3
ChinChangYang May 21, 2026
a35fc42
SP5 Task 8: v3 roundtrip + isValid invariant tests
ChinChangYang May 21, 2026
55d4146
SP5 Task 9: Output-kernel monomorphic smoke test
ChinChangYang May 21, 2026
f6d4450
SP5 Task 10: Gated flat-sweep convergence test
ChinChangYang May 21, 2026
4cf652d
SP5 Task 11: Replace bench_sp4_acceptance.sh with SP5 version
ChinChangYang May 21, 2026
51c9db6
SP5: Final doc/comment polish
ChinChangYang May 21, 2026
2f6daf5
chore: remove subsumed 4-field tuner roundtrip test
ChinChangYang May 21, 2026
52fef8c
Add MLX tests relocation design spec
ChinChangYang May 21, 2026
12b42bd
Add MLX tests relocation implementation plan
ChinChangYang May 21, 2026
f6e8134
Move runMLXWinotunerTests body to mlxwinotuner.cpp (not yet wired)
ChinChangYang May 21, 2026
3102323
Move runMLXWinogradTests body to mlxbackend.cpp (not yet wired)
ChinChangYang May 21, 2026
b152ab6
Relocate MLX aux tests: wire one-shot guard, revert testnn.cpp/tests.…
ChinChangYang May 21, 2026
38c0be6
Task 3 polish: add <cstdio>, fix stale forward-decl comments
ChinChangYang May 21, 2026
1199024
MLX backend: assert on ACTIVATION_MISH_SCALE8; document why Mish is F…
ChinChangYang May 21, 2026
cc9fdef
Spec: MLX tuner baked-default baseline anchor
ChinChangYang May 21, 2026
3e19cd7
Plan: MLX tuner baked-default baseline anchor
ChinChangYang May 21, 2026
c7d4e4b
MLX tuner: baseline_ms / delta_pct in flatSweepInput log line
ChinChangYang May 21, 2026
efed6de
MLX tuner: baseline_ms / delta_pct in flatSweepOutput log line
ChinChangYang May 21, 2026
72364c4
MLX tuner: gated baseline-consistency check
ChinChangYang May 21, 2026
429bd68
MLX tuner: document %+.1f ↔ regex contract and Test 2 scope
ChinChangYang May 21, 2026
723d4cf
Add MLX tuner shape-diagnostic design spec
ChinChangYang May 21, 2026
1baa4c7
Add MLX tuner shape-diagnostic implementation plan
ChinChangYang May 21, 2026
49e6dcc
Add per-slot median scoring primitives to MLX tuner
ChinChangYang May 21, 2026
f80a9df
Append per-slot median timings to MLX flat-sweep log lines
ChinChangYang May 21, 2026
10f01f9
Add conv-3x3 shape distribution formatter for MLX tuner
ChinChangYang May 21, 2026
ad7edde
Log MLX conv-3x3 shape distribution at model load
ChinChangYang May 21, 2026
67fe303
Add per-slot numeric-consistency gated test for MLX tuner
ChinChangYang May 21, 2026
88d7897
Add MLX tuner adaptive-scoring design spec
ChinChangYang May 21, 2026
2ab5bc2
Add MLX tuner adaptive-scoring implementation plan
ChinChangYang May 21, 2026
3cb2df5
Add planShapeRotation pure-function for adaptive scoring
ChinChangYang May 21, 2026
1ef276f
Extract buildConv3x3Histograms shared helper
ChinChangYang May 21, 2026
cbf329e
Add histogram fields to ModelInfoForTuning (additive)
ChinChangYang May 21, 2026
545d0f6
Rewrite MLX tuner scoring to adaptive per-shape rotation
ChinChangYang May 21, 2026
f2f93ab
Remove deprecated mid/maxConvChannels3x3 from ModelInfoForTuning
ChinChangYang May 21, 2026
c656f84
Clean up residual per-slot references after PER_SHAPE rename
ChinChangYang May 21, 2026
208dd45
Spec: MLX backend comment cleanup
ChinChangYang May 21, 2026
022acaf
Spec: expand Commit 2 scope to all SP/Task sites
ChinChangYang May 21, 2026
9c7083c
Plan: MLX backend comment cleanup
ChinChangYang May 21, 2026
5a9433b
Fix stale comments and close rounding-repair test gap
ChinChangYang May 21, 2026
a16479e
De-tag historical SP/Task references in MLX comments
ChinChangYang May 21, 2026
9e0a8c7
Rewrite MLX winograd block comments in present tense
ChinChangYang May 21, 2026
2a229c2
Remove MLX design specs, plans, and SP-named bench scripts
ChinChangYang May 21, 2026
feb5304
Eliminate -Wshadow warnings in MLX Winograd test code
ChinChangYang May 21, 2026
89f6b7f
Document batchSize=8 tuner pinning rationale
ChinChangYang May 21, 2026
4f0ed4b
Strip internal codenames and dangling spec references from MLX files
ChinChangYang May 22, 2026
39e94b0
Move runMLXWinogradTests into dedicated mlxtests.cpp
ChinChangYang May 22, 2026
845f0d3
Move runMLXWinotunerTests into mlxtests.cpp
ChinChangYang May 22, 2026
fb302fc
Strip sp5/task10 codenames from mlxtests temp-file paths
ChinChangYang May 22, 2026
a854ce6
List MLX and METAL in the dummy-backend warning
ChinChangYang May 22, 2026
0717fcc
Hoist MLX minimum version into MLX_MIN_VERSION variable
ChinChangYang May 22, 2026
446910d
Tighten MLX platform/arch validation error messages
ChinChangYang May 22, 2026
89eedbc
Remove unverified MLX python-fallback discovery path
ChinChangYang May 22, 2026
890b857
Clean up MLX backend CMake version and deployment-target config
ChinChangYang May 22, 2026
d7b0cd0
Document mlxUseFP16 in analysis/match/contribute configs
ChinChangYang May 22, 2026
874bce6
Drop host-specific FP16 throughput numbers from MLX config comments
ChinChangYang May 22, 2026
db6c01b
Fix MLX batched pass-policy stride for human-SL nets
ChinChangYang May 22, 2026
c9bf1a8
Remove bench_mlx_honest.sh paired-benchmark helper
ChinChangYang May 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Compiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ As also mentioned in the instructions below but repeated here for visibility, if
* CMake with a minimum version of 3.18.2: `brew install cmake`.
* AppleClang and Swift compilers: `xcode-select --install`.
* If using the Metal backend, [Ninja](https://ninja-build.org): `brew install ninja`
* If using the MLX backend (Apple Silicon only): install via `brew install mlx` or `python3 -m pip install "mlx>=0.18"`. Requires CMake ≥3.27 and macOS 13.3+. KataGo finds MLX via CMake's default search (Homebrew installs it at `/opt/homebrew/share/cmake/MLX/`), falling back to `python3 -m mlx --cmake-dir` for pip-only installs; override with `-DMLX_ROOT=/path/to/mlx/cmake` if needed.
* libzip: `brew install libzip`.
* If you want to do self-play training and research, probably Google perftools `brew install gperftools` for TCMalloc or some other better malloc implementation. For unknown reasons, the allocation pattern in self-play with large numbers of threads and parallel games causes a lot of memory fragmentation under glibc malloc that will eventually run your machine out of memory, but better mallocs handle it fine.
* If compiling to contribute to public distributed training runs, OpenSSL is required (`brew install openssl`).
* Clone this repo:
* `git clone https://github.com/lightvector/KataGo.git`
* Compile using CMake and make in the cpp directory:
* `cd KataGo/cpp`
* `cmake . -G Ninja -DUSE_BACKEND=METAL` or `cmake . -DUSE_BACKEND=OPENCL` or `cmake . -DUSE_BACKEND=EIGEN` depending on which backend you want.
* `cmake . -G Ninja -DUSE_BACKEND=METAL` or `cmake . -DUSE_BACKEND=MLX` or `cmake . -DUSE_BACKEND=OPENCL` or `cmake . -DUSE_BACKEND=EIGEN` depending on which backend you want.
* Specify also `-DUSE_TCMALLOC=1` if using TCMalloc.
* Compiling will also call git commands to embed the git hash into the compiled executable, specify also `-DNO_GIT_REVISION=1` to disable it if this is causing issues for you.
* Specify `-DUSE_AVX2=1` to also compile Eigen with AVX2 and FMA support, which will make it incompatible with old CPUs but much faster. Intel-based Macs with new processors support AVX2, but Apple Silicon Macs do not support AVX2 natively. (If you want to go further, you can also add `-DCMAKE_CXX_FLAGS='-march=native'` which will specialize to precisely your machine's CPU, but the exe might not run on other machines at all).
Expand Down
53 changes: 51 additions & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
cmake_minimum_required(VERSION 3.18.2)

# Pre-project MLX setup. KataGo's MLX path enforces CMake 3.27 via the guard
# below (MLX itself requires only 3.25 - 3.27 is chosen to match
# cmake_policy(VERSION 3.27)); the global cmake_minimum_required stays at
# 3.18.2 so non-MLX backends keep building on older CMake.
#
# The OSX deployment target is deliberately NOT pinned here. KataGo links
# Homebrew's prebuilt libmlx.dylib, whose minos reflects the macOS it was
# bottled on - that dylib, not this build, sets the real minimum macOS.
# Pinning a lower value only stamps a misleading minos on the executable and
# triggers a "linking with dylib built for newer version" linker warning;
# letting CMake default the target to the build host keeps minos honest.
if(USE_BACKEND STREQUAL "MLX")
if(CMAKE_VERSION VERSION_LESS 3.27)
message(FATAL_ERROR "KataGo's USE_BACKEND=MLX path requires CMake 3.27 or newer. You have ${CMAKE_VERSION}. Install via: brew install cmake")
endif()
cmake_policy(VERSION 3.27)
endif()

if(USE_BACKEND STREQUAL "METAL")
project(katago LANGUAGES CXX Swift)
else()
Expand Down Expand Up @@ -32,7 +51,7 @@ endif()
set(BUILD_DISTRIBUTED 0 CACHE BOOL "Build with http support for contributing to distributed training")
set(USE_BACKEND CACHE STRING "Neural net backend")
string(TOUPPER "${USE_BACKEND}" USE_BACKEND)
set_property(CACHE USE_BACKEND PROPERTY STRINGS "" CUDA TENSORRT OPENCL EIGEN)
set_property(CACHE USE_BACKEND PROPERTY STRINGS "" CUDA TENSORRT OPENCL EIGEN MLX METAL)

set(USE_TCMALLOC 0 CACHE BOOL "Use TCMalloc")
set(NO_GIT_REVISION 0 CACHE BOOL "Disable embedding the git revision into the compiled exe")
Expand Down Expand Up @@ -140,8 +159,35 @@ elseif(USE_BACKEND STREQUAL "EIGEN")
set(NEURALNET_BACKEND_SOURCES
neuralnet/eigenbackend.cpp
)
elseif(USE_BACKEND STREQUAL "MLX")
message(STATUS "-DUSE_BACKEND=MLX, using MLX backend for Apple Silicon.")

if(NOT APPLE)
message(FATAL_ERROR "USE_BACKEND=MLX is only supported on macOS. Detected: ${CMAKE_SYSTEM_NAME}")
endif()
if(CMAKE_OSX_ARCHITECTURES)
if(NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
message(FATAL_ERROR "USE_BACKEND=MLX requires arm64. Got: ${CMAKE_OSX_ARCHITECTURES}")
endif()
elseif(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
message(FATAL_ERROR "USE_BACKEND=MLX requires Apple Silicon (arm64). Detected: ${CMAKE_SYSTEM_PROCESSOR}")
endif()

set(MLX_MIN_VERSION "0.18")
set(MLX_ROOT "" CACHE PATH "Optional path to MLX's CMake package; leave empty to use CMake's default search (e.g. Homebrew's /opt/homebrew/share/cmake/MLX/)")

# Homebrew installs MLX's CMake config to /opt/homebrew/share/cmake/MLX/, which is
# on CMake's default search path. MLX_ROOT, when set, is added as an extra hint.
find_package(MLX ${MLX_MIN_VERSION} CONFIG REQUIRED HINTS "${MLX_ROOT}")
message(STATUS "Found MLX ${MLX_VERSION} at ${MLX_LIBRARY}")

set(NEURALNET_BACKEND_SOURCES
neuralnet/mlxbackend.cpp
neuralnet/mlxwinotuner.cpp
neuralnet/mlxtests.cpp
)
elseif(USE_BACKEND STREQUAL "")
message(WARNING "${ColorBoldRed}WARNING: Using dummy neural net backend, intended for non-neural-net testing only, will fail on any code path requiring a neural net. To use neural net, specify -DUSE_BACKEND=CUDA or -DUSE_BACKEND=TENSORRT or -DUSE_BACKEND=OPENCL or -DUSE_BACKEND=EIGEN to compile with the respective backend.${ColorReset}")
message(WARNING "${ColorBoldRed}WARNING: Using dummy neural net backend, intended for non-neural-net testing only, will fail on any code path requiring a neural net. To use neural net, specify -DUSE_BACKEND=CUDA or -DUSE_BACKEND=TENSORRT or -DUSE_BACKEND=OPENCL or -DUSE_BACKEND=EIGEN or -DUSE_BACKEND=MLX or -DUSE_BACKEND=METAL to compile with the respective backend.${ColorReset}")
set(NEURALNET_BACKEND_SOURCES neuralnet/dummybackend.cpp)
else()
message(FATAL_ERROR "Unrecognized backend: " ${USE_BACKEND})
Expand Down Expand Up @@ -443,6 +489,9 @@ elseif(USE_BACKEND STREQUAL "EIGEN")
endif()
endif()
endif()
elseif(USE_BACKEND STREQUAL "MLX")
target_compile_definitions(katago PRIVATE USE_MLX_BACKEND)
target_link_libraries(katago mlx)
endif()

if(USE_BIGGER_BOARDS_EXPENSIVE)
Expand Down
3 changes: 3 additions & 0 deletions cpp/command/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ int MainCmds::benchmark(const vector<string>& args) {
#endif
#ifdef USE_EIGEN_BACKEND
cout << "You are currently using the Eigen (CPU) version of KataGo. Due to having no GPU, it may be slow." << endl;
#endif
#ifdef USE_MLX_BACKEND
cout << "Your GTP config is currently set to mlxUseFP16 = " << nnEval->getUsingFP16Mode().toString() << endl;
#endif
cout << endl;
cout << "Your GTP config is currently set to use numSearchThreads = " << params.numThreads << endl;
Expand Down
12 changes: 12 additions & 0 deletions cpp/configs/analysis_example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,18 @@ nnRandomize = true
# It defaults to min(numAnalysisThreads * numSearchThreadsPerAnalysisThread, numCPUCores).
# numEigenThreadsPerModel = X

# ------------------------------
# MLX-specific settings
# ------------------------------
# These only apply when using the MLX backend (Apple Silicon).

# Whether to use FP16 (half precision) for neural net evaluation on MLX.
# FP16 is faster than FP32 on Apple Silicon via the MLX Winograd path.
# Set `false` for bit-exact FP32 reproducibility.
#
# Default: auto (resolves to fp16 on MLX).
# mlxUseFP16 = auto


# Misc Behavior --------------------

Expand Down
12 changes: 12 additions & 0 deletions cpp/configs/contribute_example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,15 @@ watchOngoingGameInFileName = watchgame.txt
# This is the number of CPU threads for evaluating the neural net on the Eigen backend.
# It defaults to numSearchThreads.
# numEigenThreadsPerModel = X

# ------------------------------
# MLX-specific settings
# ------------------------------
# These only apply when using the MLX backend (Apple Silicon).

# Whether to use FP16 (half precision) for neural net evaluation on MLX.
# FP16 is faster than FP32 on Apple Silicon via the MLX Winograd path.
# Set `false` for bit-exact FP32 reproducibility.
#
# Default: auto (resolves to fp16 on MLX).
# mlxUseFP16 = auto
12 changes: 12 additions & 0 deletions cpp/configs/gtp_example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,18 @@ searchFactorWhenWinningThreshold = 0.95
# Default: numSearchThreads
# numEigenThreadsPerModel = X

# ------------------------------
# MLX-specific settings
# ------------------------------
# These only apply when using the MLX backend (Apple Silicon).

# Whether to use FP16 (half precision) for neural net evaluation on MLX.
# FP16 is faster than FP32 on Apple Silicon via the MLX Winograd path.
# Set `false` for bit-exact FP32 reproducibility.
#
# Default: auto (resolves to fp16 on MLX).
# mlxUseFP16 = auto

# ===========================================================================
# Root move selection and biases
# ===========================================================================
Expand Down
12 changes: 12 additions & 0 deletions cpp/configs/match_example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,18 @@ numNNServerThreadsPerModel = 1
# It defaults to numSearchThreads.
# numEigenThreadsPerModel = X

# ------------------------------
# MLX-specific settings
# ------------------------------
# These only apply when using the MLX backend (Apple Silicon).

# Whether to use FP16 (half precision) for neural net evaluation on MLX.
# FP16 is faster than FP32 on Apple Silicon via the MLX Winograd path.
# Set `false` for bit-exact FP32 reproducibility.
#
# Default: auto (resolves to fp16 on MLX).
# mlxUseFP16 = auto


# Root move selection and biases------------------------------------------------------------------------------
# Uncomment and edit any of the below values to change them from their default.
Expand Down
4 changes: 4 additions & 0 deletions cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ string Version::getKataGoVersionFullInfo() {
out << "Using OpenCL backend" << endl;
#elif defined(USE_EIGEN_BACKEND)
out << "Using Eigen(CPU) backend" << endl;
#elif defined(USE_MLX_BACKEND)
out << "Using MLX backend" << endl;
#else
out << "Using dummy backend" << endl;
#endif
Expand Down Expand Up @@ -284,6 +286,8 @@ string Version::getGitRevisionWithBackend() {
s += "-opencl";
#elif defined(USE_EIGEN_BACKEND)
s += "-eigen";
#elif defined(USE_MLX_BACKEND)
s += "-mlx";
#else
s += "-dummy";
#endif
Expand Down
Loading