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(
8    target_arch = "spirv",
9    feature(funnel_shifts, generic_const_args, min_generic_const_args)
10)]
11#![cfg_attr(
12    not(target_arch = "spirv"),
13    feature(
14        iter_array_chunks,
15        gca_const_items,
16        gca_macroless_args,
17        gca_min_const_items,
18        portable_simd
19    )
20)]
21#![feature(generic_const_items, mut_restriction, step_trait)]
22#![expect(incomplete_features, reason = "generic_const_*")]
23#![cfg_attr(
24    all(test, not(target_arch = "spirv")),
25    feature(const_convert, const_trait_impl)
26)]
27#![cfg_attr(
28    all(test, not(any(miri, target_arch = "spirv"))),
29    feature(maybe_uninit_fill)
30)]
31// TODO: Remove if/when this is addressed:
32//  https://github.com/rust-lang/rust-clippy/issues/17524#issuecomment-5405010966
33#![cfg_attr(test, expect(clippy::manual_assert_eq, reason = "False-positive"))]
34
35#[cfg(not(target_arch = "spirv"))]
36mod host;
37// This is used for benchmarks of isolated shaders externally, not for general use
38#[doc(hidden)]
39pub mod shader;
40
41// TODO: Remove gate after https://github.com/Rust-GPU/rust-gpu/pull/249
42#[cfg(not(target_arch = "spirv"))]
43use ab_core_primitives::pos::PosProof;
44#[cfg(not(target_arch = "spirv"))]
45pub use host::{Device, GpuRecordsEncoder};
46#[cfg(not(target_arch = "spirv"))]
47pub use wgpu::{Backend, DeviceType};
48
49// TODO: Remove gate after https://github.com/Rust-GPU/rust-gpu/pull/249
50#[cfg(not(target_arch = "spirv"))]
51const _: () = {
52    assert!(PosProof::K >= 15 && PosProof::K <= 24);
53};