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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Optional compute backends.
//!
//! Training and prediction run on the CPU by default, exactly as they always
//! have. This module holds the opt-in accelerators:
//!
//! - [`metal`] (macOS only, `metal` feature): native Metal GPU acceleration
//! for histogram construction during training (`device = metal`) and for
//! batch prediction ([`GpuModel`](metal::GpuModel), from
//! `BoostedModel::to_gpu`).
//!
//! The backends keep the crate's determinism contract: a GPU run reproduces
//! the CPU result bit for bit (work the GPU cannot compute exactly runs on
//! the CPU; see [`metal`]), and repeats itself exactly
//! across runs and machines.
//!
//! A future `wgpu` backend will extend the same seam to Linux and Windows.
/// When the Metal backend's integer histogram sums reproduce the CPU's
/// `f64` sums (platform-independent, so its proof is tested everywhere).
/// The native Metal backend (macOS, `metal` feature).
/// The Metal backend's stand-in when it is not compiled in (any other
/// platform, or the feature off): the module exists so `backend::metal`
/// paths and doc links resolve on every platform, but holds only the
/// [`GpuModel`](self::metal::GpuModel) handle, which
/// [`BoostedModel::to_gpu`](crate::model::BoostedModel::to_gpu) then never
/// constructs — it always returns an error naming the missing feature.
///
/// These docs are the stand-in (docs.rs builds on Linux). The Metal API and
/// the backend's design, exactness bound, and limitations are documented
/// in the real module: run `cargo doc --features metal --open` on macOS.