pub trait GpuMerkleHash:
Copy
+ Clone
+ Send
+ Sync
+ 'static {
type Digest: Copy + Clone + PartialEq + Send + Sync + Serialize + DeserializeOwned + BatchQueryMerkle + 'static;
// Required methods
unsafe fn compress_rows(
out: &mut DeviceBuffer<Self::Digest>,
matrix: &DeviceBuffer<F>,
width: usize,
query_stride: usize,
log_rows_per_query: usize,
device_ctx: &GpuDeviceCtx,
) -> Result<(), CudaError>;
unsafe fn compress_rows_ext(
out: &mut DeviceBuffer<Self::Digest>,
matrix: &DeviceBuffer<EF>,
width: usize,
query_stride: usize,
log_rows_per_query: usize,
device_ctx: &GpuDeviceCtx,
) -> Result<(), CudaError>;
unsafe fn compress_layer(
output: &mut DeviceBuffer<Self::Digest>,
prev_layer: &DeviceBuffer<Self::Digest>,
output_size: usize,
device_ctx: &GpuDeviceCtx,
) -> Result<(), CudaError>;
}Expand description
Dispatch trait for GPU Merkle hash kernels.
Each implementation routes the three kernel entry points
(compress_rows, compress_rows_ext, compress_layer) to the
appropriate CUDA FFI wrappers, and declares the concrete Digest type
those kernels produce.
Required Associated Types§
type Digest: Copy + Clone + PartialEq + Send + Sync + Serialize + DeserializeOwned + BatchQueryMerkle + 'static
Required Methods§
Sourceunsafe fn compress_rows(
out: &mut DeviceBuffer<Self::Digest>,
matrix: &DeviceBuffer<F>,
width: usize,
query_stride: usize,
log_rows_per_query: usize,
device_ctx: &GpuDeviceCtx,
) -> Result<(), CudaError>
unsafe fn compress_rows( out: &mut DeviceBuffer<Self::Digest>, matrix: &DeviceBuffer<F>, width: usize, query_stride: usize, log_rows_per_query: usize, device_ctx: &GpuDeviceCtx, ) -> Result<(), CudaError>
Compress rows of a base-field matrix into digest leaves.
§Safety
out must be allocated with capacity query_stride and matrix must
contain width * query_stride * (1 << log_rows_per_query) valid elements.
Sourceunsafe fn compress_rows_ext(
out: &mut DeviceBuffer<Self::Digest>,
matrix: &DeviceBuffer<EF>,
width: usize,
query_stride: usize,
log_rows_per_query: usize,
device_ctx: &GpuDeviceCtx,
) -> Result<(), CudaError>
unsafe fn compress_rows_ext( out: &mut DeviceBuffer<Self::Digest>, matrix: &DeviceBuffer<EF>, width: usize, query_stride: usize, log_rows_per_query: usize, device_ctx: &GpuDeviceCtx, ) -> Result<(), CudaError>
Compress rows of an extension-field matrix into digest leaves.
§Safety
out must be allocated with capacity query_stride and matrix must
contain width * query_stride * (1 << log_rows_per_query) valid elements.
Sourceunsafe fn compress_layer(
output: &mut DeviceBuffer<Self::Digest>,
prev_layer: &DeviceBuffer<Self::Digest>,
output_size: usize,
device_ctx: &GpuDeviceCtx,
) -> Result<(), CudaError>
unsafe fn compress_layer( output: &mut DeviceBuffer<Self::Digest>, prev_layer: &DeviceBuffer<Self::Digest>, output_size: usize, device_ctx: &GpuDeviceCtx, ) -> Result<(), CudaError>
Compress adjacent pairs of digests to build an inner Merkle layer.
§Safety
output must be allocated with capacity output_size, prev_layer must
contain at least output_size * 2 valid elements, and the two buffers
must not overlap.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".