// // GPUDiagnosticTests.swift // Metrika // // Author: Simon-Pierre Boucher // Contact: contact@spboucher.ai // Copyright © 2026 Simon-Pierre Boucher. All rights reserved. // import Foundation import Testing import ZQGPU /// Numerical regression tests for the GPU cross-product stage. These /// pin down an MLX batched-GEMM issue: small k×k outputs mis-accumulate /// (~6e-4 relative) for batch sizes ≥ 2, which the column-wise X'X /// computation in `crossProducts` works around. If these start failing, /// the workaround regressed or the kernel changed. @Suite("GPU numerics regression", .enabled(if: ZQGPUBootstrap.isAvailable)) struct GPUDiagnosticTests { let n = 200 let x: [Double] let y: [Double] init() { let generator = Philox4x32(seed: 7) let count = 200 let xs = (0..