Expand description
GPU runtime, device buffers, and kernel dispatch for SpatialRust.
Unsafe code is restricted to FFI and GPU interop boundaries in this crate.
Structs§
- AoSoA
Attribute Reduction - CPU-visible interleaved records produced by GPU voxel aggregation.
- AoSoA
Voxel Centroid Result - Centroid result from the GPU-resident AoSoA voxel pipeline.
- Device
Buffer - Typed buffer allocated on a specific device.
- GpuAi
Tensor - Device-resident planar
f32tensor with explicit optional readback. - GpuAo
SoAttribute Chunk - GPU storage buffer for one interleaved attribute chunk and its layout.
- GpuAo
SoNormals - GPU-resident
(nx, ny, nz, curvature)output for AoSoA positions. - GpuAo
SoRadius Grid - Sparse GPU-resident uniform grid built directly from AoSoA positions.
- GpuAo
SoXyz Buffer - GPU storage buffer containing contiguous interleaved XYZ positions.
- GpuAo
SoXyz Chunk - GPU storage buffer holding one interleaved XYZ chunk.
- GpuBilateral
Filter - Owned, runtime-bound bilateral coefficients prepared and uploaded explicitly. Reuse across image sizes with the same logical channels and options. Preparation rejects nonfinite factors/weights and positive subnormal coefficients. Filtering uses exact integer-word binary64 accumulation and CPU-compatible byte rounding; no native shader float64, image payload copy, host wait or image-sized scratch. Plan control uploads are accounted separately from each image’s transfer receipt.
- GpuBilateral
Options - Image-independent parameters for exact resident u8 bilateral filtering.
- GpuBuffer
Pool - Reusable GPU storage buffers keyed by byte length.
- GpuCanny
Options - Threshold and gradient options for resident grayscale Canny.
- GpuExecution
Receipt - Transfer and logical-stage receipt for one GPU frame.
- GpuFpfh
Descriptors - Owned resident FPFH descriptors with GPU validity status. Nonempty outputs have 33 f32 values per original point. Custom GPU consumers must reject status.bad_rows>0 before accepting any descriptor; failed outputs are zero.
- GpuFpfh
Input - Explicitly uploaded FPFH positions/unit normals and their GPU KD-tree/query batch. Original point order is retained; CPU tree construction is external. All subsequent neighborhood and descriptor computation stays on GPU.
- GpuFpfh
Neighborhoods - Radius rows tied to one immutable FPFH input; usable by both device phases.
- GpuGaussian
Blur Options - Gaussian filter parameters, checked before GPU resource allocation.
- GpuGicp
Equations - Downloaded GICP normal equations in the documented normalized parameter basis.
- GpuGicp
Input - 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.
- GpuGicp
Normal Equations - Owned resident fixed-size normal equations/status, independent of input/pools.
- GpuIcp
Input - Explicitly uploaded source and target for reusable device ICP moments. CPU target-tree construction is external. Original source points remain immutable; every evaluation applies the absolute pose to those originals.
- GpuIcp
Moments - Owned fixed-size device ICP moments. No buffer is pooled or input-borrowed.
- GpuIcp
Statistics - Decoded device ICP moments in physical units, with explicit transfer receipt.
- GpuIcp
Trimmed Moments - Owned 176-byte trimmed moments/status; no point or match readback is implicit.
- GpuIcp
Trimmed Statistics - Fixed-size selected moments plus the all-gated fitness denominator.
- GpuImage
- GPU-resident packed image backed by an
rgba8uint2D texture. - GpuImage
Cdf - Resident inclusive u32 cumulative counts for all 256 image byte values.
- GpuImage
Histogram - Resident exact 256-bin u32 counts for one logical u8 image channel.
- GpuImage
Receipt - Transfer accounting for GPU image uploads, device copies, and readbacks.
- GpuIss
Input - Explicitly uploaded ISS positions/tree/queries, reusable on one runtime. CPU tree construction is external; subsequent search and selection run on GPU.
- GpuIss
Keypoints - Owned resident ISS selection flags, eigenvalue/eligibility rows and validity status. No result storage is pooled. Custom consumers must inspect status.
- GpuIss
Neighborhoods - Two radius graphs tied to exactly one immutable uploaded ISS input.
- GpuKd
Tree - Immutable runtime-owned KD-tree uploaded explicitly and reused across batches. Construction/partitioning is on CPU; nearest-point traversal is on GPU. No device-to-host transfer is performed by upload, and no CPU search fallback is used. Public methods validate device identity before resource use.
- GpuMls
Diagnostics - Device counts of MLS outcomes; valid only when the first five status words are zero.
- GpuMls
Input - Explicitly uploaded MLS positions/tree/queries, reusable on one runtime. CPU tree construction is external; subsequent search and surface fitting run on GPU.
- GpuMls
Neighborhoods - Radius rows tied to one immutable GPU MLS input. Capacity includes self.
- GpuMls
Positions - Owned resident MLS positions/modes and global status. No buffers are pooled; outputs survive input drops and other calls. GPU consumers must check status.
- GpuMls
Readback - Explicit position/status download with outcome counts and payload accounting.
- GpuNeighborhood
Readback - CPU rows from an explicit readback, with radius-overflow information kept separate from stored neighbors. Complete access rejects any incomplete row.
- GpuNeighborhoods
- Immutable GPU-resident bounded neighborhoods. Creating this result submits GPU search without payload uploads/readbacks or a completion wait. Query/target buffers are explicitly uploaded beforehand. Outputs are owned, never pooled.
- GpuNormal
- Per-point normal estimation output:
(nx, ny, nz, curvature). - GpuPlane
Score - GPU score for one RANSAC plane hypothesis.
- GpuPoint
ToPlane Equations - Downloaded point-to-plane ICP normal equations in the documented normalized parameter basis.
- GpuPoint
ToPlane Input - Reusable explicitly uploaded positions/tree and original-order target normals. A single common normal scale preserves relative raw-normal weights; normals are never normalized individually. Source positions remain immutable.
- GpuPoint
ToPlane Normal Equations - Owned resident fixed-size normal equations/status, independent of input/pools.
- GpuQuery
Batch - Immutable finite query positions, explicitly uploaded or generated from a tree on GPU. Reusable across trees and passes on the same runtime.
- GpuResource
Pool Stats - Snapshot of one pool’s retained resources and lifetime acquisition counters.
- GpuSpatial
Frame - Owned GPU-resident point frame with explicit schema and device identity.
- GpuStage
Profiler - Bounded profiler shared by GPU image chains and point-cloud frames.
- GpuStage
Timing - One compute pass measured by the GPU clock, in submission order.
- GpuTiming
Report - Explicit timestamp readback, separate from image/point payload receipts.
- GpuVision
Chain Options - Configuration for the resident resize-to-AI chain.
- GpuVoxel
KeyBuffers - GPU buffers for per-point positions and computed voxel keys.
- GpuVoxel
Segments - Voxel segment metadata kept on the GPU between sort/compact and reduce passes.
- Voxel
Approximate First GpuResult - GPU-resident approximate-first downsample result.
- Voxel
Centroid GpuResult - GPU-resident centroid downsample result.
- Voxel
Segments - Sorted voxel cell segments derived from per-point grid keys.
- Wgpu
Adapter Info - Stable, serializable-friendly identity for the selected wgpu adapter.
- Wgpu
Device - Portable GPU device backed by wgpu.
- Wgpu
Runtime - Headless wgpu runtime for compute-only workloads.
- Wgpu
Runtime Options - Explicit headless selection and optional profiling requests.
Enums§
- AoSoA
Attribute Aggregation - Aggregation policy for interleaved AoSoA voxel attributes.
- GpuFrame
Capability - GPU frame capabilities available to downstream algorithms.
- GpuGaussian
Border - Border extrapolation for resident Gaussian filtering.
- GpuIcp
Trim Precision - Arithmetic used for retained ICP moments; transform/search remain f32.
- GpuImage
Border - Border extrapolation for GPU image filters.
- GpuMls
Mode - Per-point outcome of device MLS processing.
- GpuMorphology
- Single-channel morphology operation executed on a GPU texture.
- GpuNeighborhood
Kind - Membership and ordering of a resident neighborhood result.
- Wgpu
Backend Selection - Explicit backend set for a headless runtime.
- Wgpu
Power Preference - Adapter power preference used when creating a headless wgpu runtime.
Constants§
- DEFAULT_
GPU_ POOL_ BUDGET_ BYTES - Default retained-byte budget for each GPU resource pool (64 MiB).
- GPU_
FPFH_ DESCRIPTOR_ LEN - Three eleven-bin angular histograms per FPFH descriptor.
- MAX_
GPU_ K_ NEIGHBORS - Maximum k for the bounded GPU nearest-neighbor accumulator.
- MULTI_
GATHE R2_ STORAGE_ BUFFERS - Minimum storage buffers required for the 2-channel gather kernel.
- MULTI_
GATHE R4_ STORAGE_ BUFFERS - Minimum storage buffers required for the 4-channel gather kernel.
Traits§
- GpuDevice
- Marker trait for GPU-capable devices.
Functions§
- box_
blur_ gpu - Applies an integer mean box blur to a single-channel
GpuImage. - build_
radius_ grid_ aoso_ gpu - Builds a sparse uniform radius grid directly from retained AoSoA positions.
- build_
voxel_ segments - Builds sorted voxel segments from per-point
(ix, iy, iz)keys. - build_
voxel_ segments_ from_ positions_ gpu - Computes voxel keys on the GPU and builds sorted segments using GPU sorting.
- build_
voxel_ segments_ from_ positions_ gpu_ buffers - Builds GPU-resident voxel segments from positions without intermediate readbacks.
- build_
voxel_ segments_ gpu - Stably radix-sorts per-point voxel keys on the GPU and compacts them into segments.
- build_
voxel_ segments_ gpu_ from_ keys_ buffer - Builds GPU-resident voxel segments from a GPU keys buffer using stable radix sorting.
- canny_
gpu - Computes a CPU-compatible binary Canny edge map entirely on the device.
- canny_
gpu_ profiled - Records five (aperture 3) or six (5/7) optional GPU pass timestamps.
- clahe_
gpu - Applies CPU-compatible CLAHE to a resident one-channel u8 image.
- clahe_
gpu_ profiled - Applies resident CLAHE while recording three or four pass timestamps. Split histograms require four unused stages on the same runtime; direct histograms require three. Capacity is checked before allocating work.
- compact_
voxel_ segments_ from_ sorted - Compacts already-sorted voxel keys and point indices into segment metadata.
- compute_
voxel_ keys - Computes per-point voxel grid keys on the GPU.
- compute_
voxel_ keys_ aoso_ chunks - Computes voxel keys directly from uploaded interleaved XYZ chunks.
- compute_
voxel_ keys_ gpu_ buffers - Uploads positions and computes per-point voxel keys, keeping data on the GPU.
- copy_
gpu_ image - Copies
sourceinto a new GPU image without host transfers. - downsample_
voxel_ approximate_ first_ gpu - Runs the chained GPU approximate-first pipeline without intermediate readbacks.
- downsample_
voxel_ centroid_ aoso_ chunks - Runs global voxel centroid downsampling from uploaded AoSoA chunks.
- downsample_
voxel_ centroid_ gpu - Runs the chained GPU voxel centroid pipeline without intermediate key/segment readbacks.
- equalize_
histogram_ gpu - Equalizes a resident one-channel u8 image with CPU-compatible byte rounding.
- equalize_
histogram_ gpu_ profiled - Equalizes a grayscale image while recording exactly five GPU pass timestamps. Requires five unused stages on the same runtime before allocating work.
- estimate_
normals_ aoso_ gpu - Estimates normals directly from a retained interleaved XYZ GPU buffer.
- estimate_
normals_ gpu - Estimates per-point normals and curvature on the GPU.
- estimate_
normals_ grid_ gpu - Estimates per-point normals and curvature with a fully GPU radius neighbor search over a uniform grid.
- estimate_
normals_ radius_ grid_ aoso_ gpu - Estimates radius normals directly from a GPU-resident sparse AoSoA grid.
- estimate_
plane_ covariances_ grid_ gpu - Estimates per-point plane-regularized covariances on the GPU via a uniform grid radius neighbor search.
- estimate_
plane_ covariances_ grid_ gpu_ with_ receipt - Explicit covariance upload/readback with payload transfer accounting. Includes XYZ, sorted indices and grid offsets uploaded, and the complete padded 32-byte-per-point output downloaded; uniform controls are excluded. Grid construction remains CPU, and errors propagate without fallback.
- euclidean_
cluster_ roots_ gpu - Connected-component roots via uniform-grid union-find. Sparse-grid construction and component union/find run on the GPU.
- euclidean_
cluster_ roots_ gpu_ with_ receipt - Builds sparse cells and labels minimum-index components on the GPU. Returns roots on the host with explicit upload/readback accounting. Nonempty inputs require finite XYZ and a positive tolerance with a finite reciprocal. Positive infinity initializes one component on the device.
- euclidean_
cluster_ roots_ grid - Connected-component roots via uniform-grid union-find (minimum index per component).
- gather_
voxel_ first_ f32 - Gathers the first point’s
f32value within each voxel cell on the GPU. - gather_
voxel_ first_ f32_ gpu - Uploads
f32values and gathers the first point per GPU-resident voxel segment. - gather_
voxel_ first_ f32_ gpu_ buffers - Gathers the first point’s
f32value using GPU-resident segment buffers. - gather_
voxel_ first_ f32_ multi_ gpu - Gathers multiple
f32channels in one or more GPU dispatches. - gather_
voxel_ first_ xyz_ and_ average_ multi_ gpu - Gathers xyz and averages f32/u8 attribute channels with one GPU submit/readback.
- gather_
voxel_ first_ xyz_ and_ multi_ gpu - Gathers xyz and multiple f32/u8 attribute channels with one GPU submit/readback.
- gather_
voxel_ first_ xyz_ gpu_ buffers - Gathers xyz coordinates of the first point within each voxel cell on the GPU.
- gaussian_
blur_ gpu - Applies a separable integer Gaussian blur to 1..=4 resident logical channels.
- gaussian_
blur_ gpu_ profiled - Records two optional pass timestamps; collection remains explicit.
- histogram_
cdf_ gpu - Computes exact inclusive cumulative counts without downloading source bins.
- histogram_
cdf_ gpu_ profiled - Computes cumulative counts while recording one optional GPU pass timestamp. Requires one unused profiler stage on the original runtime before allocation.
- histogram_
u8_ gpu - Counts one logical channel (0..source.channels()) without leaving the GPU.
- histogram_
u8_ gpu_ profiled - Counts a resident channel while recording two optional GPU pass timestamps. Requires two unused profiler stages on the same runtime before allocating work.
- median_
blur_ gpu - Selects the exact per-channel median of a 3x3 or 5x5 square neighborhood. Supports all 1..=4 logical u8 channels and retains metadata. Each component, including alpha, is filtered independently. Replicate and constant-zero borders match the corresponding CPU median. One ordered device pass returns an owned image without host transfer/wait or image-sized scratch. Upload/readback remain explicit caller operations. Runtime, kernel and device limits reject before output/cache allocation.
- morphology_
gpu - Applies rectangular erosion or dilation without leaving device memory.
- pack_
ai_ chw_ gpu - Packs a resident image into normalized planar CHW
f32storage. - reduce_
voxel_ attributes_ aoso_ chunks - Aggregates uploaded interleaved records using global GPU voxel segments.
- reduce_
voxel_ average_ f32 - Averages per-point
f32values within each voxel cell on the GPU. - reduce_
voxel_ average_ f32_ gpu - Uploads
f32values and averages them within GPU-resident voxel segments. - reduce_
voxel_ average_ f32_ gpu_ buffers - Averages per-point
f32values using GPU-resident segment buffers. - reduce_
voxel_ average_ f32_ multi_ gpu - Uploads multiple
f32channels and averages them with one GPU submit/readback. - reduce_
voxel_ centroids_ xyz - Averages xyz positions within each voxel cell on the GPU.
- reduce_
voxel_ centroids_ xyz_ and_ average_ multi_ gpu - Averages xyz and multiple f32/u8 attribute channels with one GPU submit/readback.
- reduce_
voxel_ centroids_ xyz_ and_ gather_ first_ multi_ gpu - Averages xyz and gathers the first f32/u8 attribute value per voxel with one readback.
- reduce_
voxel_ centroids_ xyz_ gpu_ buffers - Averages xyz positions using GPU-resident buffers.
- resize_
nearest_ gpu - Resizes a device image with nearest-neighbor sampling without host transfer.
- rgb_
to_ gray_ gpu - Converts an RGB
GpuImageto a grayGpuImageusing BT.601 fixed-point luma. - run_
aoso_ voxel_ normal_ frame - Uploads a tensor and chains global voxel partitioning and radius normals.
- run_
aoso_ voxel_ normal_ frame_ profiled - Runs a frame with pass timestamps for both partitions and radius normals.
- run_
gpu_ vision_ chain - Runs resize → gray → blur → Sobel → morphology → planar AI packing.
- run_
gpu_ vision_ chain_ profiled - Runs the resident image chain with five to eight compute-pass timing samples.
- score_
ransac_ plane_ hypotheses_ gpu - Scores RANSAC plane hypotheses in parallel on the GPU.
- sobel_
gpu - Computes clamped L1 Sobel magnitude on a single-channel device image.
- uniform_
grid_ fits - Returns whether valid axes and cell size form a grid within the cell cap.
- upload_
spatial_ tensor_ attribute_ chunks - Packs and uploads every tensor chunk with an explicit attribute layout.
- upload_
spatial_ tensor_ xyz_ chunks - Packs and uploads every chunk in a
SpatialTensor.
Type Aliases§
- GpuCovariance
- Per-point plane-regularized covariance as 6 unique elements:
[c00, c11, c22, c01, c02, c12].