gemm: GPU acceptance tests vs cuBLAS + finite-diff

Forward: hand-written tiled GEMM vs cuBLAS sgemm on random matrices
(square / non-tile-aligned rect / 256³), max relative error < 1e-3, using
the row-major⟺col-major identity to drive cuBLAS without explicit
transposes. Backward: scalar loss L = sum(W∘C) (so dC = W), dA/dB from
matmul_backward checked against the finite-diff harness. Gated behind
not(no_cuda).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 15:26:58 +08:00
parent 08c88bf360
commit 1384044f27
2 changed files with 186 additions and 0 deletions

View File

@@ -7,3 +7,6 @@ edition.workspace = true
xtrain-cuda = { path = "../xtrain-cuda" }
half.workspace = true
smallvec.workspace = true
[dev-dependencies]
xtrain-autodiff = { path = "../xtrain-autodiff" }