Skip to main content

ab_proof_of_space_gpu/
lib.rs

1//! Proof of space plotting utilities for GPU (Vulkan/Metal).
2//!
3//! Similarly to `ab-proof-of-space`, max supported `K` within range `15..=24` due to internal data
4//! structures used (`ab-proof-of-space` also supports `K=25`, but this crate doesn't for now).
5
6#![cfg_attr(target_arch = "spirv", no_std)]
7#![cfg_attr(not(target_arch = "spirv"), feature(macroless_generic_const_args))]
8#![feature(
9    funnel_shifts,
10    generic_const_args,
11    generic_const_items,
12    min_generic_const_args,
13    mut_restriction,
14    step_trait
15)]
16#![expect(incomplete_features, reason = "generic_const_*")]
17#![cfg_attr(
18    all(test, not(target_arch = "spirv")),
19    feature(const_convert, const_trait_impl)
20)]
21#![cfg_attr(
22    all(test, not(any(miri, target_arch = "spirv"))),
23    feature(maybe_uninit_fill)
24)]
25// TODO: Remove if/when this is addressed:
26//  https://github.com/rust-lang/rust-clippy/issues/17524#issuecomment-5405010966
27#![cfg_attr(test, expect(clippy::manual_assert_eq, reason = "False-positive"))]
28// TODO: Remove once https://github.com/gfx-rs/wgpu/pull/9953 is released
29#![recursion_limit = "256"]
30
31#[cfg(not(target_arch = "spirv"))]
32mod host;
33// This is used for benchmarks of isolated shaders externally, not for general use
34#[doc(hidden)]
35pub mod shader;
36
37// TODO: Remove gate after https://github.com/Rust-GPU/rust-gpu/pull/249
38#[cfg(not(target_arch = "spirv"))]
39pub use crate::shader::find_proofs::ProofsHost;
40#[cfg(not(target_arch = "spirv"))]
41pub use host::{Device, GpuRecordsEncoderInstance, ProofsHostWrapper, RecordEncodingError};
42#[cfg(not(target_arch = "spirv"))]
43use subspace_core_primitives::pos::PosProof;
44#[cfg(not(target_arch = "spirv"))]
45pub use wgpu::{Backend, DeviceType};
46
47// TODO: Remove gate after https://github.com/Rust-GPU/rust-gpu/pull/249
48#[cfg(not(target_arch = "spirv"))]
49const _: () = {
50    assert!(PosProof::K >= 15 && PosProof::K <= 24);
51};