pub struct NaturalGradientPolicy {
pub temperature_ns: u64,
}Expand description
Natural-gradient policy for choosing the next autotune probe from measured latency samples.
The policy treats the candidate set as a discrete distribution over
launch configurations. Latency samples become a softmax over
-elapsed_ns / temperature_ns; the supplied inverse-Fisher square-root
matrix preconditions that probability/gradient vector before the driver
picks the next candidate. CUDA/self-substrate can produce the same
fixed-point matrix through the primitive-backed natural-gradient path.
Fields§
§temperature_ns: u64Softmax temperature in nanoseconds. Larger values explore more.
Implementations§
Source§impl NaturalGradientPolicy
impl NaturalGradientPolicy
Sourcepub fn suggest(
&self,
measurements: &[TuningMeasurement],
fisher_inv_sqrt_q16: &[u32],
) -> Result<NaturalGradientTuningStep, NaturalGradientTuningError>
pub fn suggest( &self, measurements: &[TuningMeasurement], fisher_inv_sqrt_q16: &[u32], ) -> Result<NaturalGradientTuningStep, NaturalGradientTuningError>
Suggest the next workgroup-size candidate from latency samples and an inverse-Fisher square-root matrix.
fisher_inv_sqrt_q16 is row-major n x n, 16.16 fixed-point. Passing
an identity matrix makes the policy reduce to the softmax-gradient
candidate. Non-identity blocks let the runtime bias exploration by the
local latency manifold instead of blindly reusing the single fastest
point.
§Errors
Returns NaturalGradientTuningError when the measurement set is
empty, temperature is zero, or the Fisher matrix shape does not match.
Trait Implementations§
Source§impl Clone for NaturalGradientPolicy
impl Clone for NaturalGradientPolicy
Source§fn clone(&self) -> NaturalGradientPolicy
fn clone(&self) -> NaturalGradientPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NaturalGradientPolicy
Source§impl Debug for NaturalGradientPolicy
impl Debug for NaturalGradientPolicy
Source§impl Default for NaturalGradientPolicy
impl Default for NaturalGradientPolicy
impl Eq for NaturalGradientPolicy
Source§impl PartialEq for NaturalGradientPolicy
impl PartialEq for NaturalGradientPolicy
Source§fn eq(&self, other: &NaturalGradientPolicy) -> bool
fn eq(&self, other: &NaturalGradientPolicy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for NaturalGradientPolicy
Auto Trait Implementations§
impl Freeze for NaturalGradientPolicy
impl RefUnwindSafe for NaturalGradientPolicy
impl Send for NaturalGradientPolicy
impl Sync for NaturalGradientPolicy
impl Unpin for NaturalGradientPolicy
impl UnsafeUnpin for NaturalGradientPolicy
impl UnwindSafe for NaturalGradientPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.