Expand description
The GPU as a Device, so the conformance machinery can score it.
Until this existed, ferrotherm’s survey of its own capabilities carried a line it had earned:
“no impl Device for a GPU, so conform cannot even score the GPU path.” The fastest sampler
in the stack was the one path the verification machinery could not reach — it could be run, and
it could not be checked against the fabric it claims to be.
What that check turns out to be about is precision. The CPU sampler is f64 throughout and the
shader is f32, because that is what WGSL storage buffers hold. Every other Device here
declares its precision honestly — D-Wave as Unstated, the fixed-point fabric as
Fixed { bits } — and the GPU had no declaration at all, so nothing downstream could reason
about it. It is Precision::Float with a 24-bit mantissa, and saying so is what lets
conform compare the two paths knowing which differences are the arithmetic and which are the
sampler.
use ferrotherm::{fabric::Device, ising::lattice2d, schedule::Schedule, ftp::Program};
use ferrotherm_gpu::GpuDevice;
let Some(mut dev) = GpuDevice::open() else { return };
let g = lattice2d(32, 1.0);
let p = Program::from_graph(&g, &Schedule::default());
assert!(dev.program(&p).is_empty());
let state = dev.run(&Schedule::constant(0.6, 200), 7).unwrap();
assert_eq!(state.len(), g.n);
// The writes are charged, which is the term the ledger's thesis rests on.
assert_eq!(dev.ledger().writes, g.n as u64);