Skip to main content

spatialrust_gpu/
lib.rs

1//! GPU runtime, device buffers, and kernel dispatch for SpatialRust.
2//!
3//! Unsafe code is restricted to FFI and GPU interop boundaries in this crate.
4
5#![warn(missing_docs)]
6#![deny(unsafe_code)]
7
8mod buffer;
9mod device;
10
11#[cfg(feature = "gpu-wgpu")]
12mod kernels;
13
14#[cfg(feature = "gpu-wgpu")]
15mod pipeline_cache;
16
17#[cfg(feature = "gpu-wgpu")]
18mod readback;
19
20#[cfg(feature = "gpu-wgpu")]
21mod readback_planes;
22
23#[cfg(feature = "gpu-wgpu")]
24mod upload_cache;
25
26#[cfg(feature = "gpu-wgpu")]
27mod resource_cache;
28
29#[cfg(feature = "gpu-wgpu")]
30mod scratch;
31
32#[cfg(feature = "gpu-wgpu")]
33pub use resource_cache::{GpuResourcePoolStats, DEFAULT_GPU_POOL_BUDGET_BYTES};
34
35#[cfg(feature = "gpu-wgpu")]
36mod runtime;
37
38#[cfg(feature = "gpu-wgpu")]
39mod profiling;
40
41#[cfg(feature = "gpu-wgpu")]
42pub use profiling::{GpuStageProfiler, GpuStageTiming, GpuTimingReport};
43
44#[cfg(feature = "gpu-aoso-staging")]
45mod aoso_staging;
46
47#[cfg(feature = "gpu-aoso-staging")]
48mod gpu_frame;
49
50#[cfg(feature = "gpu-image")]
51mod image;
52
53pub use buffer::DeviceBuffer;
54pub use device::{GpuDevice, WgpuDevice};
55
56#[cfg(feature = "gpu-wgpu")]
57pub use kernels::{
58    GpuFpfhDescriptors, GpuFpfhInput, GpuFpfhNeighborhoods, GpuGicpEquations, GpuGicpInput,
59    GpuGicpNormalEquations, GpuIcpInput, GpuIcpMoments, GpuIcpStatistics, GpuIcpTrimPrecision,
60    GpuIcpTrimmedMoments, GpuIcpTrimmedStatistics, GpuIssInput, GpuIssKeypoints,
61    GpuIssNeighborhoods, GpuMlsDiagnostics, GpuMlsInput, GpuMlsMode, GpuMlsNeighborhoods,
62    GpuMlsPositions, GpuMlsReadback, GpuNeighborhoodKind, GpuNeighborhoodReadback,
63    GpuNeighborhoods, GpuPointToPlaneEquations, GpuPointToPlaneInput,
64    GpuPointToPlaneNormalEquations, GpuQueryBatch, GPU_FPFH_DESCRIPTOR_LEN, MAX_GPU_K_NEIGHBORS,
65};
66
67#[cfg(feature = "gpu-wgpu")]
68pub use kernels::{
69    build_voxel_segments, build_voxel_segments_from_positions_gpu,
70    build_voxel_segments_from_positions_gpu_buffers, build_voxel_segments_gpu,
71    build_voxel_segments_gpu_from_keys_buffer, compact_voxel_segments_from_sorted,
72    compute_voxel_keys, compute_voxel_keys_gpu_buffers, downsample_voxel_approximate_first_gpu,
73    downsample_voxel_centroid_gpu, estimate_normals_gpu, estimate_normals_grid_gpu,
74    estimate_plane_covariances_grid_gpu, estimate_plane_covariances_grid_gpu_with_receipt,
75    euclidean_cluster_roots_gpu, euclidean_cluster_roots_gpu_with_receipt,
76    euclidean_cluster_roots_grid, gather_voxel_first_f32, gather_voxel_first_f32_gpu,
77    gather_voxel_first_f32_gpu_buffers, gather_voxel_first_f32_multi_gpu,
78    gather_voxel_first_xyz_and_average_multi_gpu, gather_voxel_first_xyz_and_multi_gpu,
79    gather_voxel_first_xyz_gpu_buffers, reduce_voxel_average_f32, reduce_voxel_average_f32_gpu,
80    reduce_voxel_average_f32_gpu_buffers, reduce_voxel_average_f32_multi_gpu,
81    reduce_voxel_centroids_xyz, reduce_voxel_centroids_xyz_and_average_multi_gpu,
82    reduce_voxel_centroids_xyz_and_gather_first_multi_gpu, reduce_voxel_centroids_xyz_gpu_buffers,
83    score_ransac_plane_hypotheses_gpu, uniform_grid_fits, GpuCovariance, GpuKdTree, GpuNormal,
84    GpuPlaneScore, GpuVoxelKeyBuffers, GpuVoxelSegments, VoxelApproximateFirstGpuResult,
85    VoxelCentroidGpuResult, VoxelSegments,
86};
87
88#[cfg(feature = "gpu-wgpu")]
89pub use runtime::{
90    WgpuAdapterInfo, WgpuBackendSelection, WgpuPowerPreference, WgpuRuntime, WgpuRuntimeOptions,
91    MULTI_GATHER2_STORAGE_BUFFERS, MULTI_GATHER4_STORAGE_BUFFERS,
92};
93
94#[cfg(feature = "gpu-wgpu")]
95pub use upload_cache::GpuBufferPool;
96
97#[cfg(feature = "gpu-aoso-staging")]
98pub use aoso_staging::{
99    build_radius_grid_aoso_gpu, compute_voxel_keys_aoso_chunks,
100    downsample_voxel_centroid_aoso_chunks, estimate_normals_aoso_gpu,
101    estimate_normals_radius_grid_aoso_gpu, reduce_voxel_attributes_aoso_chunks,
102    upload_spatial_tensor_attribute_chunks, upload_spatial_tensor_xyz_chunks,
103    AoSoAAttributeAggregation, AoSoAAttributeReduction, AoSoAVoxelCentroidResult,
104    GpuAoSoAttributeChunk, GpuAoSoNormals, GpuAoSoRadiusGrid, GpuAoSoXyzBuffer, GpuAoSoXyzChunk,
105};
106
107#[cfg(feature = "gpu-aoso-staging")]
108pub use gpu_frame::{
109    run_aoso_voxel_normal_frame, run_aoso_voxel_normal_frame_profiled, GpuExecutionReceipt,
110    GpuFrameCapability, GpuSpatialFrame,
111};
112
113#[cfg(feature = "gpu-image")]
114pub use image::{
115    box_blur_gpu, canny_gpu, canny_gpu_profiled, clahe_gpu, clahe_gpu_profiled, copy_gpu_image,
116    equalize_histogram_gpu, equalize_histogram_gpu_profiled, gaussian_blur_gpu,
117    gaussian_blur_gpu_profiled, histogram_cdf_gpu, histogram_cdf_gpu_profiled, histogram_u8_gpu,
118    histogram_u8_gpu_profiled, median_blur_gpu, morphology_gpu, pack_ai_chw_gpu,
119    resize_nearest_gpu, rgb_to_gray_gpu, run_gpu_vision_chain, run_gpu_vision_chain_profiled,
120    sobel_gpu, GpuAiTensor, GpuBilateralFilter, GpuBilateralOptions, GpuCannyOptions,
121    GpuGaussianBlurOptions, GpuGaussianBorder, GpuImage, GpuImageBorder, GpuImageCdf,
122    GpuImageHistogram, GpuImageReceipt, GpuMorphology, GpuVisionChainOptions,
123};