Repository navigation
Critical GPU training bug fixes from independent Fable 5.1 audit. 9 findings fixed, 3 regressions caught and resolved during revalidation.
Fixed
- Autodiff backward root —
tape.Backwardnow roots at the loss tensor, not the last recorded op. Operations after loss (metrics, logging) no longer corrupt gradients - AutodiffBackend cache invalidation — forwards
ClearInputBufferCache()to inner backend through autodiff wrapper - GPU buffer deferred release —
clearInputBufferCacheusesDeferReleaseGPUBufferinstead of immediateRelease(), preventing panic with pending GPU commands - SetTensor ownership — takes ownership without Clone/AddRef, preventing GPU memory leak every training step
- materializeForCPU — reads GPU buffer via
ReadGPUBufferwithoutRealize()side-effect, preventing stack overflow on chained backward ops - Clone+AddRef lifecycle —
RawTensor.Clone()callsAddRef()throughBackendDataRefCounterinterface;ReclaimMemoryusesForceRelease()for all non-persistent entries - ReleaseGradients public API — accepts optional backend parameter, actually releases GPU gradient buffers
- MSELoss gradient flow — uses
backend.Sum+backend.DivScalarinstead of CPU.AsFloat32()loop - RoPE gradient flow —
applyRotationrewritten with Chunk/Mul/Sub/Add/Cat tensor ops, all on autodiff tape - Conv2D/MaxPool2D backward GPU — CPU fallback instead of
panic("not implemented")
Added
- Sum, Expand, Cast autodiff ops — recorded on tape with proper backward;
loss = y.Sum()now produces correct gradients - One-hot identity cache —
sync.Mapcache per(numClasses, dtype), caches the C×C identity per process (C×C-free one-hot via Gather still open) - Fable regression tests —
TestRV_TrainingLoopMemory,TestRV_DiamondGraph,TestRV_Conv2DBackwardGPU
Changed
- gogpu deps — wgpu v0.30.35→v0.34.4, gputypes v0.5.1→v0.8.0, naga v0.18.0→v0.19.0, gpucontext v0.24.0→v0.31.3
Full Changelog: v0.9.23...v0.9.24
💚 Sponsor Born ML: https://opencollective.com/born-ml