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 upload_cache;
22
23#[cfg(feature = "gpu-wgpu")]
24mod runtime;
25
26#[cfg(feature = "gpu-aoso-staging")]
27mod aoso_staging;
28
29#[cfg(feature = "gpu-aoso-staging")]
30mod gpu_frame;
31
32#[cfg(feature = "gpu-image")]
33mod image;
34
35pub use buffer::DeviceBuffer;
36pub use device::{GpuDevice, WgpuDevice};
37
38#[cfg(feature = "gpu-wgpu")]
39pub use kernels::{
40    build_voxel_segments, build_voxel_segments_from_positions_gpu,
41    build_voxel_segments_from_positions_gpu_buffers, build_voxel_segments_gpu,
42    build_voxel_segments_gpu_from_keys_buffer, compact_voxel_segments_from_sorted,
43    compute_voxel_keys, compute_voxel_keys_gpu_buffers, downsample_voxel_approximate_first_gpu,
44    downsample_voxel_centroid_gpu, estimate_normals_gpu, estimate_normals_grid_gpu,
45    estimate_plane_covariances_grid_gpu, euclidean_cluster_roots_gpu,
46    euclidean_cluster_roots_gpu_with_receipt, euclidean_cluster_roots_grid, gather_voxel_first_f32,
47    gather_voxel_first_f32_gpu, gather_voxel_first_f32_gpu_buffers,
48    gather_voxel_first_f32_multi_gpu, gather_voxel_first_xyz_and_average_multi_gpu,
49    gather_voxel_first_xyz_and_multi_gpu, gather_voxel_first_xyz_gpu_buffers,
50    reduce_voxel_average_f32, reduce_voxel_average_f32_gpu, reduce_voxel_average_f32_gpu_buffers,
51    reduce_voxel_average_f32_multi_gpu, reduce_voxel_centroids_xyz,
52    reduce_voxel_centroids_xyz_and_average_multi_gpu,
53    reduce_voxel_centroids_xyz_and_gather_first_multi_gpu, reduce_voxel_centroids_xyz_gpu_buffers,
54    score_ransac_plane_hypotheses_gpu, uniform_grid_fits, GpuCovariance, GpuNormal, GpuPlaneScore,
55    GpuVoxelKeyBuffers, GpuVoxelSegments, VoxelApproximateFirstGpuResult, VoxelCentroidGpuResult,
56    VoxelSegments,
57};
58
59#[cfg(feature = "gpu-wgpu")]
60pub use runtime::{
61    WgpuAdapterInfo, WgpuPowerPreference, WgpuRuntime, MULTI_GATHER2_STORAGE_BUFFERS,
62    MULTI_GATHER4_STORAGE_BUFFERS,
63};
64
65#[cfg(feature = "gpu-wgpu")]
66pub use upload_cache::GpuBufferPool;
67
68#[cfg(feature = "gpu-aoso-staging")]
69pub use aoso_staging::{
70    build_radius_grid_aoso_gpu, compute_voxel_keys_aoso_chunks,
71    downsample_voxel_centroid_aoso_chunks, estimate_normals_aoso_gpu,
72    estimate_normals_radius_grid_aoso_gpu, reduce_voxel_attributes_aoso_chunks,
73    upload_spatial_tensor_attribute_chunks, upload_spatial_tensor_xyz_chunks,
74    AoSoAAttributeAggregation, AoSoAAttributeReduction, AoSoAVoxelCentroidResult,
75    GpuAoSoAttributeChunk, GpuAoSoNormals, GpuAoSoRadiusGrid, GpuAoSoXyzBuffer, GpuAoSoXyzChunk,
76};
77
78#[cfg(feature = "gpu-aoso-staging")]
79pub use gpu_frame::{
80    run_aoso_voxel_normal_frame, GpuExecutionReceipt, GpuFrameCapability, GpuSpatialFrame,
81};
82
83#[cfg(feature = "gpu-image")]
84pub use image::{
85    box_blur_gpu, copy_gpu_image, morphology_gpu, pack_ai_chw_gpu, resize_nearest_gpu,
86    rgb_to_gray_gpu, run_gpu_vision_chain, sobel_gpu, GpuAiTensor, GpuImage, GpuImageBorder,
87    GpuImageReceipt, GpuMorphology, GpuVisionChainOptions,
88};