Skip to main content

Crate spatialrust_gpu

Crate spatialrust_gpu 

Source
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§

AoSoAAttributeReduction
CPU-visible interleaved records produced by GPU voxel aggregation.
AoSoAVoxelCentroidResult
Centroid result from the GPU-resident AoSoA voxel pipeline.
DeviceBuffer
Typed buffer allocated on a specific device.
GpuAiTensor
Device-resident planar f32 tensor with explicit optional readback.
GpuAoSoAttributeChunk
GPU storage buffer for one interleaved attribute chunk and its layout.
GpuAoSoNormals
GPU-resident (nx, ny, nz, curvature) output for AoSoA positions.
GpuAoSoRadiusGrid
Sparse GPU-resident uniform grid built directly from AoSoA positions.
GpuAoSoXyzBuffer
GPU storage buffer containing contiguous interleaved XYZ positions.
GpuAoSoXyzChunk
GPU storage buffer holding one interleaved XYZ chunk.
GpuBilateralFilter
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.
GpuBilateralOptions
Image-independent parameters for exact resident u8 bilateral filtering.
GpuBufferPool
Reusable GPU storage buffers keyed by byte length.
GpuCannyOptions
Threshold and gradient options for resident grayscale Canny.
GpuExecutionReceipt
Transfer and logical-stage receipt for one GPU frame.
GpuFpfhDescriptors
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.
GpuFpfhInput
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.
GpuFpfhNeighborhoods
Radius rows tied to one immutable FPFH input; usable by both device phases.
GpuGaussianBlurOptions
Gaussian filter parameters, checked before GPU resource allocation.
GpuGicpEquations
Downloaded GICP normal equations in the documented normalized parameter basis.
GpuGicpInput
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.
GpuGicpNormalEquations
Owned resident fixed-size normal equations/status, independent of input/pools.
GpuIcpInput
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.
GpuIcpMoments
Owned fixed-size device ICP moments. No buffer is pooled or input-borrowed.
GpuIcpStatistics
Decoded device ICP moments in physical units, with explicit transfer receipt.
GpuIcpTrimmedMoments
Owned 176-byte trimmed moments/status; no point or match readback is implicit.
GpuIcpTrimmedStatistics
Fixed-size selected moments plus the all-gated fitness denominator.
GpuImage
GPU-resident packed image backed by an rgba8uint 2D texture.
GpuImageCdf
Resident inclusive u32 cumulative counts for all 256 image byte values.
GpuImageHistogram
Resident exact 256-bin u32 counts for one logical u8 image channel.
GpuImageReceipt
Transfer accounting for GPU image uploads, device copies, and readbacks.
GpuIssInput
Explicitly uploaded ISS positions/tree/queries, reusable on one runtime. CPU tree construction is external; subsequent search and selection run on GPU.
GpuIssKeypoints
Owned resident ISS selection flags, eigenvalue/eligibility rows and validity status. No result storage is pooled. Custom consumers must inspect status.
GpuIssNeighborhoods
Two radius graphs tied to exactly one immutable uploaded ISS input.
GpuKdTree
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.
GpuMlsDiagnostics
Device counts of MLS outcomes; valid only when the first five status words are zero.
GpuMlsInput
Explicitly uploaded MLS positions/tree/queries, reusable on one runtime. CPU tree construction is external; subsequent search and surface fitting run on GPU.
GpuMlsNeighborhoods
Radius rows tied to one immutable GPU MLS input. Capacity includes self.
GpuMlsPositions
Owned resident MLS positions/modes and global status. No buffers are pooled; outputs survive input drops and other calls. GPU consumers must check status.
GpuMlsReadback
Explicit position/status download with outcome counts and payload accounting.
GpuNeighborhoodReadback
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).
GpuPlaneScore
GPU score for one RANSAC plane hypothesis.
GpuPointToPlaneEquations
Downloaded point-to-plane ICP normal equations in the documented normalized parameter basis.
GpuPointToPlaneInput
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.
GpuPointToPlaneNormalEquations
Owned resident fixed-size normal equations/status, independent of input/pools.
GpuQueryBatch
Immutable finite query positions, explicitly uploaded or generated from a tree on GPU. Reusable across trees and passes on the same runtime.
GpuResourcePoolStats
Snapshot of one pool’s retained resources and lifetime acquisition counters.
GpuSpatialFrame
Owned GPU-resident point frame with explicit schema and device identity.
GpuStageProfiler
Bounded profiler shared by GPU image chains and point-cloud frames.
GpuStageTiming
One compute pass measured by the GPU clock, in submission order.
GpuTimingReport
Explicit timestamp readback, separate from image/point payload receipts.
GpuVisionChainOptions
Configuration for the resident resize-to-AI chain.
GpuVoxelKeyBuffers
GPU buffers for per-point positions and computed voxel keys.
GpuVoxelSegments
Voxel segment metadata kept on the GPU between sort/compact and reduce passes.
VoxelApproximateFirstGpuResult
GPU-resident approximate-first downsample result.
VoxelCentroidGpuResult
GPU-resident centroid downsample result.
VoxelSegments
Sorted voxel cell segments derived from per-point grid keys.
WgpuAdapterInfo
Stable, serializable-friendly identity for the selected wgpu adapter.
WgpuDevice
Portable GPU device backed by wgpu.
WgpuRuntime
Headless wgpu runtime for compute-only workloads.
WgpuRuntimeOptions
Explicit headless selection and optional profiling requests.

Enums§

AoSoAAttributeAggregation
Aggregation policy for interleaved AoSoA voxel attributes.
GpuFrameCapability
GPU frame capabilities available to downstream algorithms.
GpuGaussianBorder
Border extrapolation for resident Gaussian filtering.
GpuIcpTrimPrecision
Arithmetic used for retained ICP moments; transform/search remain f32.
GpuImageBorder
Border extrapolation for GPU image filters.
GpuMlsMode
Per-point outcome of device MLS processing.
GpuMorphology
Single-channel morphology operation executed on a GPU texture.
GpuNeighborhoodKind
Membership and ordering of a resident neighborhood result.
WgpuBackendSelection
Explicit backend set for a headless runtime.
WgpuPowerPreference
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_GATHER2_STORAGE_BUFFERS
Minimum storage buffers required for the 2-channel gather kernel.
MULTI_GATHER4_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 source into 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 f32 value within each voxel cell on the GPU.
gather_voxel_first_f32_gpu
Uploads f32 values and gathers the first point per GPU-resident voxel segment.
gather_voxel_first_f32_gpu_buffers
Gathers the first point’s f32 value using GPU-resident segment buffers.
gather_voxel_first_f32_multi_gpu
Gathers multiple f32 channels 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 f32 storage.
reduce_voxel_attributes_aoso_chunks
Aggregates uploaded interleaved records using global GPU voxel segments.
reduce_voxel_average_f32
Averages per-point f32 values within each voxel cell on the GPU.
reduce_voxel_average_f32_gpu
Uploads f32 values and averages them within GPU-resident voxel segments.
reduce_voxel_average_f32_gpu_buffers
Averages per-point f32 values using GPU-resident segment buffers.
reduce_voxel_average_f32_multi_gpu
Uploads multiple f32 channels 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 GpuImage to a gray GpuImage using 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].