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    step_trait
14)]
15#![expect(incomplete_features, reason = "generic_const_*")]
16#![cfg_attr(
17    all(test, not(target_arch = "spirv")),
18    feature(const_convert, const_trait_impl)
19)]
20#![cfg_attr(
21    all(test, not(any(miri, target_arch = "spirv"))),
22    feature(maybe_uninit_fill)
23)]
24// TODO: Remove if/when this is addressed:
25//  https://github.com/rust-lang/rust-clippy/issues/17524#issuecomment-5405010966
26#![cfg_attr(test, expect(clippy::manual_assert_eq, reason = "False-positive"))]
27// TODO: Remove once https://github.com/gfx-rs/wgpu/pull/9953 is released
28#![recursion_limit = "256"]
29
30#[cfg(not(target_arch = "spirv"))]
31mod host;
32// This is used for benchmarks of isolated shaders externally, not for general use
33#[doc(hidden)]
34pub mod shader;
35
36// TODO: Remove gate after https://github.com/Rust-GPU/rust-gpu/pull/249
37#[cfg(not(target_arch = "spirv"))]
38pub use crate::shader::find_proofs::ProofsHost;
39#[cfg(not(target_arch = "spirv"))]
40pub use host::{Device, GpuRecordsEncoderInstance, ProofsHostWrapper, RecordEncodingError};
41#[cfg(not(target_arch = "spirv"))]
42use subspace_core_primitives::pos::PosProof;
43#[cfg(not(target_arch = "spirv"))]
44pub use wgpu::{Backend, DeviceType};
45
46// TODO: Remove gate after https://github.com/Rust-GPU/rust-gpu/pull/249
47#[cfg(not(target_arch = "spirv"))]
48const _: () = {
49    assert!(PosProof::K >= 15 && PosProof::K <= 24);
50};