Naive O(N²) forward Discrete Fourier Transform, the reference the GPU
radix-2 FFT is differentially checked against. Complex data is interleaved
f32: element j is (input[2*j], input[2*j+1]) = (real, imag), so both the
input slice and the returned vector hold 2*N f32.
Cross-backend differential-oracle evaluation of the affine kernel against
affine_cpu (plan §7). Generic over OracleContext, so the same code runs
on wgpu (via WgpuComputeContext) and CUDA (via CudaComputeContext); the
backend only differs inside OracleContext::run_kernel. The CPU-reference
vectors, bindings, dispatch sizing and tolerance are identical to what the
wgpu-inline and evaluate_affine_cuda paths used before unification.
Diagnostic: cooperative-matrix load→store round-trip (no multiply). Loads a
as a role-C fragment and stores it to c; c must equal a. This verifies
coopLoadT/coopStoreT work on the adapter (they do — the coopMultiplyAdd
path is the one currently blocked on the experimental backend).
Cross-backend differential-oracle evaluation for the fused FFN against
ffn_cpu (plan §7). Generic over OracleContext — the same code runs on
wgpu and CUDA; only OracleContext::run_kernel differs. One workgroup-thread
per output element; the output buffer is output_size. Tensors, bindings,
dispatch sizing and tolerance are identical to the prior wgpu/evaluate_ffn_cuda
paths.
Differential-oracle evaluation of the radix-2 FFT (out = forward DFT(in))
against dft_cpu. One workgroup of n = schedule.workgroup_size threads
(one complex element per thread; n must be a power of two), mirroring the
single-workgroup dispatch of evaluate_topk(): element_count = n with
workgroup_size = n launches exactly one workgroup. The input/output buffers
hold 2*n interleaved f32.
Differential-oracle evaluation for the dense GEMM against gemm_cpu. One
workgroup-thread per output element; the output buffer is m * n elements.
Row-major C[M×N] = A[M×K] · B[K×N], all f32.
Differential-oracle evaluation for the dense GEMV against gemv_cpu. One
workgroup-thread per output ROW; the output buffer is m elements. Row-major
y[M] = A[M×N] · x[N], all f32.
Differential-oracle evaluation of the cooperative-matrix (tensor-core) 8x8
GEMM tile C = A * B against matmul_cpu. All-f32 — the only coopmat
configuration wgpu/naga 29 implements (see crate::numerical::emit::coopmat).
One subgroup (32-lane NVIDIA warp) cooperatively computes the tile; the
row-major loads/store reproduce the row-major CPU reference, so agreement is
to f32 precision (a tiny tolerance covers tensor-core accumulation order).
Differential-oracle evaluation of the ray-query (ray-probe) kernel: builds a
BLAS+TLAS for rayprobe_scene, dispatches the emitted ray_probe WGSL over
rayprobe_rays on the GPU, and checks the committed hit distances against
rayprobe_cpu. Requires a ray-query-capable adapter (RT cores).
Cross-backend differential-oracle evaluation for the top-k kernel against
topk_cpu (plan §7). Generic over OracleContext — the same code runs on
wgpu and CUDA; only OracleContext::run_kernel differs.
CPU reference for the fused FFN, matching the emitted kernel’s op order
exactly (hidden outer, input inner) so GPU/CPU agree within tolerance:
out[o] = sum_h w2[o,h] * gelu(sum_i w1[h,i] * input[i]).
Deterministic complex test signal as interleaved f32 (2*n values), drawn
from the same xorshift stream as every other oracle vector so it is
reproducible. Both the real and imaginary parts land in [-1, 1].
Row-major general dense GEMM reference, the bit-for-bit mirror of the emitted
gemm kernel: C[M×N] = A[M×K] · B[K×N], i.e.
C[i][j] = sum_{k<K} A[i*K + k] * B[k*N + j]. The inner-sum order (k ascending)
matches the kernel’s kk loop so GPU/CPU agree to f32 summation precision.
Deterministic GEMM test tensors: A (M×K) and B (K×N), both drawn from the same
xorshift stream as every other oracle vector and scaled by 1/sqrt(K) so the
length-K dot products stay O(1) and GPU/CPU agree within a tight tolerance.
Row-major dense GEMV reference, the bit-for-bit mirror of the emitted gemv
kernel: y[M] = A[M×N] · x[N], i.e. y[i] = sum_{j<N} A[i*N + j] * x[j]. The
inner-sum order (j ascending) matches the kernel’s j loop so GPU/CPU agree to
f32 summation precision.
Deterministic GEMV test tensors: A (M×N) and x (N), both drawn from the same
xorshift stream as every other oracle vector and scaled by 1/sqrt(N) so the
length-N dot products stay O(1) and GPU/CPU agree within a tight tolerance.
CPU reference for the ray-probe kernel: for each ray, the nearest committed
triangle hit t within [t_min, t_max], or -1.0 on a miss — matching the
emitter’s hits[i] = committed.t else -1.0.
The fixed ray set as the 8-float-per-ray layout the emitter expects
(origin.xyz, dir.xyz, t_min, t_max). All rays originate at z = -1 and point
along +z; hit rays target clear triangle interiors (away from edges) so GPU
BVH traversal and the CPU reference agree, and miss rays point well outside.
The fixed ray-probe scene: three world-space triangles as a flat f32 list
(9 floats/triangle = 3 verts × xyz). Two coplanar triangles tile the quad
[0,2]² at z = 2; a third sits behind them at z = 4, so rays through the
lower-left region hit two triangles and must commit the nearer one (t at z=2).
Deterministic ternary-GEMV test tensors: the activation vector x (length K),
the 2-bit-packed ternary weights (M * ceil(K/16) words), and the per-row
scales (length M). Codes are drawn from the xorshift stream and reduced into
{0,1,2} so the weights only ever decode to {0, +1, -1} (never the unused
3), keeping the GPU and CPU paths bit-identical.
CPU reference for the per-block top-k: the k largest values of each
block_size-element block, in descending order. Blocks shorter than
block_size (the tail) are padded with the sentinel, mirroring the GPU
kernel’s out-of-range loads.