Skip to main content

GpuDevice

Struct GpuDevice 

Source
pub struct GpuDevice { /* private fields */ }
Expand description

A Device backed by the native WGSL sampler.

Separate from Gpu rather than implemented on it, because Gpu is a handle to an adapter and holds no problem: Device is a stateful loader-and-runner, and merging the two would make every Gpu carry a program it may never be given.

Implementations§

Source§

impl GpuDevice

Source

pub fn open() -> Option<GpuDevice>

Open the default adapter, or None where this machine exposes none.

None means not found here, never “impossible” — the same contract as Gpu::new, and worth preserving because a headless CI runner is the common case and every test around this skips rather than fails on it.

Source

pub fn with(gpu: Gpu) -> GpuDevice

Wrap an adapter already opened, so a caller that enumerated once does not enumerate again.

Source

pub fn adapter(&self) -> &AdapterInfo

What the driver reports, for a caller that needs to know whether this is real silicon.

Source

pub fn is_hardware(&self) -> bool

True when the adapter is hardware rather than a software rasteriser.

Trait Implementations§

Source§

impl Device for GpuDevice

Source§

fn run(&mut self, schedule: &Schedule, seed: u64) -> Result<Vec<i8>, String>

Run the schedule and return the BEST state seen, not the last one.

The trait’s wording says “the final state” and every implementation here returns the best: Cpu delegates to tempering::anneal_scheduled, which tracks the minimum over every sweep, and sbm calls the same thing a best-so-far readout. That is not pedantry about wording. An anneal’s last state is wherever the coldest stage happened to stop, and this returned it – which conform caught the moment it could reach this path at all, scoring -57 against variable elimination’s exact -59 while the CPU on the same ladder found -59. Nothing was wrong with the sampler; it was being asked the wrong question at the end.

Tracked per STAGE rather than per sweep, and that difference is real: scoring a state means reading it back off the device, so per-sweep tracking would put a round trip between every sweep and spend the throughput the GPU exists for. The conformance ladder is 80 stages, so the minimum is taken over 80 checkpoints against the CPU’s 3,200.

Source§

fn fabric(&self) -> Fabric

What this backend can do. Callers check against it before submitting.
Source§

fn program(&mut self, p: &Program) -> Vec<Unsupported>

Load a program. Returns every reason it cannot run, empty on success. Read more
Source§

fn ledger(&self) -> Ledger

Operations charged so far, for the ledger.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,