Expand description
Backend-neutral numeric boundary conversions. Backend-neutral numeric boundary conversions.
Concrete GPU backends cross the same host/API boundaries: host sizes become
API u64s, high-resolution timers become telemetry u64s, and device
timestamp deltas arrive as rounded floating-point nanoseconds. This module is
the single policy for those lossy or fallible conversions; backend crates add
only the backend label that makes the diagnostic actionable.
Structs§
- Backend
Numeric Policy - Backend-bound numeric conversion policy.
Constants§
- BASIS_
POINTS_ DENOMINATOR - Integer basis-point denominator: 10_000 bps = 100%.
Functions§
- align_
up_ u64 - Align
valueupward toalignment, after applyingmin_value. - align_
up_ usize - Align
valueupward toalignment, after applyingmin_value. - checked_
ceil_ div_ u64 - Compute
ceil(value / divisor)inu64, returningNonefor zero divisors or arithmetic overflow. - checked_
compose_ basis_ points_ u64 - Compose two basis-point multipliers as
(left * right) / 10_000, returningNonerather than saturating when the composed value cannot fitu64. - checked_
dim_ product_ u32 - Multiply three
u32dimensions into au32without wraparound. - checked_
dim_ product_ u64 - Multiply three
u32dimensions into au64without wraparound. - compose_
basis_ points_ u32 - Compose two basis-point multipliers as
(left * right) / 10_000, with widened arithmetic and loudu32overflow pinning. - elapsed_
nanos_ u64 - Convert elapsed wall-clock time to telemetry nanoseconds.
- finite_
f64_ ratio_ basis_ points_ round - Convert a finite floating-point ratio into rounded basis points, with separate policies for invalid numerators and denominators.
- finite_
f64_ ratio_ basis_ points_ trunc - Convert a finite floating-point ratio into floor basis points, with separate policies for invalid numerators and denominators.
- finite_
f64_ to_ u32_ round - Convert a finite non-negative floating-point telemetry value to
u32after rounding to the nearest integer, with loud saturation on invalid input. - finite_
f64_ to_ u32_ trunc - Convert a finite non-negative floating-point telemetry value to
u32by truncating toward zero, with loud saturation on invalid or oversized input. - finite_
f64_ unit_ basis_ points_ trunc - Convert a finite scalar where
1.0 == 10_000 bpsinto floor basis points. - ratio_
basis_ points_ u64 - Compute
part / wholeas floor basis points with explicit zero-denominator policy and saturating telemetry overflow. - ratio_
basis_ points_ u64_ wide - Compute
part / wholeas floor basis points in au64telemetry domain with explicit zero-denominator policy and loud overflow pinning. - ratio_
parts_ per_ million_ u64 - Compute
part / wholeas floor parts-per-million with explicit zero-denominator policy and loudu32overflow pinning. - rounded_
f64_ to_ u64 - Round a finite floating-point nanosecond value into telemetry storage.
- scale_
u64_ by_ basis_ points_ floor_ min - Apply a basis-point multiplier to a
u64with floor rounding and an output lower bound. - scale_
u64_ by_ basis_ points_ round_ clamped - Apply a basis-point multiplier to a
u64with nearest-integer rounding, optional high clamp, and explicit zero-scale policy. - u128_
to_ u64 - Convert a wide counter to telemetry
u64. - usize_
to_ u64 - Convert a host
usizeto a backend/APIu64. - weighted_
u64_ by_ basis_ points_ u128 - Weight a
u64cost by basis points into a widened exactu128domain.