Skip to main content

GpuGicpInput

Struct GpuGicpInput 

Source
pub struct GpuGicpInput { /* private fields */ }
Expand description

Reusable explicitly uploaded positions/tree and SPD covariances for GICP. Covariances are explicitly uploaded or prepared on GPU. Position storage shares the ICP input representation; every evaluation transforms immutable original source points.

Implementations§

Source§

impl GpuGicpInput

Source

pub fn upload_with_gpu_covariances( runtime: &WgpuRuntime, source: &KdTree, target: &KdTree, k: u32, epsilon: f32, ) -> SpatialResult<Self>

Explicitly uploads finite source/target trees and original-order positions, then computes both k-NN plane-regularized covariances entirely on GPU. Query positions and target tree are shared with the registration passes. Payload upload is 32*(S+T) + 32*(source_nodes+target_nodes) bytes; no neighborhoods/covariances are downloaded or re-uploaded. Three submissions prepare bounded neighborhoods, covariance eigenvectors and global status, without a host wait. Prepared covariance rows remain owned by this input. Both trees must be nonempty; k=3..=64 and epsilon=1e-4..=1 are supported. Eigenvectors use centered/scaled compensated f32 covariance and the CPU 32-step/physical 1e-12 Jacobi stopping convention. f32 arithmetic, ties, repeated eigenvalues and CPU raw-product rounding can change covariances. Invalid preparation makes ALL subsequent equation downloads fail (status bit 16); no CPU fallback occurs. CPU tree construction is external.

Source

pub fn upload_with_gpu_radius_covariances( runtime: &WgpuRuntime, source: &KdTree, target: &KdTree, radius: f32, capacity: u32, epsilon: f32, ) -> SpatialResult<Self>

Uploads original positions/trees and prepares complete inclusive radius neighborhoods and plane covariances on GPU, without payload readback. capacity is a positive per-point bound, including self and duplicates. Overflow invalidates both covariance sets and every equation download; rows are never silently truncated. Radius must be finite/positive with a normal f32 square; epsilon must be in 1e-4..=1. Fewer than three neighbors use epsilon*I, as in the existing grid route. Other rows use centered/scaled compensated sums and 32 max-pivot Jacobi steps with physical 1e-20 stopping on the unnormalized central sum. f32 arithmetic, traversal order and repeated eigenvalues can differ from the legacy grid’s raw means and 16 three-pivot sweeps. Transfers, ownership and CPU solve boundaries match the k-NN method.

Source§

impl GpuGicpInput

Source

pub fn upload_with_gpu_grid_covariances( runtime: &WgpuRuntime, source: (&[f32], &[f32], &[f32]), target: &KdTree, radius: f32, capacity: u32, epsilon: f32, ) -> SpatialResult<Self>

Uploads original positions/target tree and prepares radius covariances directly on GPU using CPU-built counting-sort grids. No source KD-tree, neighborhood rows or covariance readback/re-upload is needed. Capacity includes self/duplicates; overflow invalidates both sets/all equations. Dense grids must fit the existing cell/device limits; there is no automatic switch to the bounded-neighborhood or CPU paths. The existing grid’s raw f32 means, central sums and 16 three-pivot sweeps are retained, including sparse epsilonI. Numerical failure rejects. Requires nonempty finite equal-length source axes/target tree, positive capacity/radius with normal finite f32 square, epsilon=1e-4..=1, and supported reduction limits. Each dataset is bounded to 2^24 points for exact f32 support counts. CPU grid/tree preparation remains explicit. H2D is 20S+36T+32target_nodes+4*(source_cells+target_cells+2); there is no preparation D2H. Prepared inputs own covariance storage.

Source§

impl GpuGicpInput

Source

pub fn upload( runtime: &WgpuRuntime, source: &[[f32; 3]], source_covariances: &[[f32; 6]], target: &KdTree, target_covariances: &[[f32; 6]], ) -> SpatialResult<Self>

Uploads positions/tree plus original-order covariance rows packed as [xx,yy,zz,xy,xz,yz]. Covariances must be finite SPD in their f32 form. H2D payload is 48S + 64T + 32*M bytes; covariance rows are padded to 32 bytes. A normal finite target-inverse trace scale is required. Native large covariance batches use bounded CPU staging workers; each row retains its f64 SPD validation and original upload order. Small batches and WASM prepare serially, before any device upload.

Source

pub fn upload_with_gpu_gather( runtime: &WgpuRuntime, source: &[[f32; 3]], source_covariances: &[[f32; 6]], target: &KdTree, target_covariances: &[[f32; 6]], ) -> SpatialResult<Self>

Explicitly uses shared GPU gathering for target tree points/queries. Host payload is 48S + 48T + 32M bytes, compared with 48S + 64T + 32M for upload; device output bytes are 32T. Covariance validation/packing and weight scale are unchanged. Source/geometry preparation remains on CPU. Two transient inputs add 16T GPU bytes; host target packing totaling 32*T payload bytes over construction is removed. No readback or completion wait is added. Placement is explicit; small inputs may be slower and existing device requirements apply. See GpuIcpInput::upload_with_gpu_gather.

Source

pub const fn upload_transfers(&self) -> TransferStats

Payload copied at construction; GPU-generated covariances add no H2D.

Source

pub fn source_count(&self) -> u32

Original source count.

Source

pub fn equations_resident( &self, runtime: &WgpuRuntime, transform: Isometry3<f32>, max_distance: f32, ) -> SpatialResult<GpuGicpNormalEquations>

Transforms originals, runs unbounded nearest matching followed by the finite inclusive gate, prepares rotated covariance inverse weights and reduces centered/scaled normal equations and Euclidean fitness. Five passes share one submission; no payload transfer or host wait occurs. After matching, transformed queries become centered position/count rows. Private scratch is 72S + 240min(ceil(S/64),256) bytes for nonempty S. GPU Cholesky pivots <=1e-6 of covariance scale reject the whole result, rather than silently dropping ill-conditioned pairs. f32 arithmetic can change weights, matches, solutions and stopping relative to CPU f64.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,