feat(hslm): double-buffered batch prefetch#563
Merged
Conversation
- Add src/b2t/double_buffer.zig - Generic DoubleBufferedPrefetch(T, N): comptime-sized double buffer with swap/loadFromSlice/isBackReady - BatchPrefetcher: runtime batch loader for training data with async prefetch, swap, batch count - Overlaps data loading with training: while GPU processes buffer A, CPU prefetches into buffer B - 6 tests: swap, double swap, fail-safety, batch load, out-of-range, async prefetch+swap, batch count Closes #319
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Double-buffered batch prefetch to overlap data loading with training.
New file
src/b2t/double_buffer.zig— 229 LOCPerformance
DoubleBufferedPrefetch(T, N)for comptime-sized buffersBatchPrefetcherfor variable batch sizesFeatures
DoubleBufferedPrefetch: generic comptime double buffer with swap/load/readyBatchPrefetcher: batch-stride-aware loader with async prefetchloadBatch(): blocking load + swapprefetchAsync(): non-blocking load into back bufferswap(): switch active/back buffersbatchCount(): compute number of batches in datasetTests (6)
Closes #319