pub struct GpuBackend<D: GpuDevice> { /* private fields */ }Expand description
silvic_core::Backend over any GpuDevice.
Implementations§
Source§impl<D: GpuDevice> GpuBackend<D>
impl<D: GpuDevice> GpuBackend<D>
Trait Implementations§
Source§impl<D: GpuDevice> Backend for GpuBackend<D>
impl<D: GpuDevice> Backend for GpuBackend<D>
Source§fn partition_and_histogram(
&mut self,
leaf: LeafRange,
split: &BinSplit,
side: Side,
quantized: bool,
out: &mut [f64],
) -> Result<u32>
fn partition_and_histogram( &mut self, leaf: LeafRange, split: &BinSplit, side: Side, quantized: bool, out: &mut [f64], ) -> Result<u32>
Partition and the child’s histogram in one command buffer: the histogram kernel takes the child’s rows from the device-side left count, so the host waits once.
Source§fn name(&self) -> String
fn name(&self) -> String
Human-readable device name for logs (
cpu (14 threads), Apple M4 Pro (metal)).Source§fn load(
&mut self,
train: &BinnedDataset,
valid: &[&BinnedDataset],
objective: &ObjectiveSetup,
) -> Result<()>
fn load( &mut self, train: &BinnedDataset, valid: &[&BinnedDataset], objective: &ObjectiveSetup, ) -> Result<()>
Takes the training set and validation sets; called once, before anything else.
Source§fn init_scores(&mut self, dataset: usize, value: f64) -> Result<()>
fn init_scores(&mut self, dataset: usize, value: f64) -> Result<()>
Sets every score of
dataset to value.Source§fn compute_gradients(&mut self) -> Result<GradientStats>
fn compute_gradients(&mut self) -> Result<GradientStats>
Computes f32 gradients and hessians of the training scores; returns their local maxima.
Source§fn quantize(&mut self, spec: &QuantSpec) -> Result<()>
fn quantize(&mut self, spec: &QuantSpec) -> Result<()>
Quantizes the gradients and hessians with
spec (quantize::quantize_row, keyed by global row id).Source§fn reset_partition(&mut self, bag: &BagSpec) -> Result<u32>
fn reset_partition(&mut self, bag: &BagSpec) -> Result<u32>
Refills the partition with the bagged training rows in ascending order; returns their count.
Source§fn histogram(
&mut self,
leaf: LeafRange,
quantized: bool,
out: &mut [f64],
) -> Result<()>
fn histogram( &mut self, leaf: LeafRange, quantized: bool, out: &mut [f64], ) -> Result<()>
Histogram of the rows of
leaf into out (2 * total_bins, overwritten): quantized units when quantized,
else float sums of gradients and hessians.Source§fn partition(&mut self, leaf: LeafRange, split: &BinSplit) -> Result<u32>
fn partition(&mut self, leaf: LeafRange, split: &BinSplit) -> Result<u32>
Stable in-place partition of
leaf’s rows by split; returns the number of rows going left.Source§fn leaf_sums(
&mut self,
leaves: &[LeafRange],
grad_scale: f32,
hess_scale: f32,
) -> Result<Vec<[i64; 2]>>
fn leaf_sums( &mut self, leaves: &[LeafRange], grad_scale: f32, hess_scale: f32, ) -> Result<Vec<[i64; 2]>>
Exact fixed-point sums
[sum rint(g * scale), sum rint(h * scale)] of each leaf’s float gradients
(quantize::to_fixed), for leaf renewal.Source§fn add_tree(&mut self, tree: &DeviceTree) -> Result<()>
fn add_tree(&mut self, tree: &DeviceTree) -> Result<()>
Adds
tree to the scores of every dataset, traversing binned rows.Source§fn set_thread_pool(&mut self, pool: Arc<ThreadPool>)
fn set_thread_pool(&mut self, pool: Arc<ThreadPool>)
The pool host-side parallel work runs on when
num_threads is set; backends without host-side parallelism
ignore it. Called before load.Source§fn set_histogram_features(&mut self, used: &[bool])
fn set_histogram_features(&mut self, used: &[bool])
Histograms from now on only need the bins of the features with
used[feature] (LightGBM is_feature_used:
the tree’s feature mask and the parent’s splittable features); the other bins may hold anything. Every rank
passes the same mask. Backends may ignore it.Auto Trait Implementations§
impl<D> Forget for GpuBackend<D>
impl<D> Freeze for GpuBackend<D>
impl<D> Move for GpuBackend<D>
impl<D> RefUnwindSafe for GpuBackend<D>
impl<D> Send for GpuBackend<D>
impl<D> Sync for GpuBackend<D>
impl<D> Unpin for GpuBackend<D>
impl<D> UnsafeUnpin for GpuBackend<D>
impl<D> UnwindSafe for GpuBackend<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more