Skip to content

E2E speed sprint: video training loader, token fast path, honest e2e reruns, CUDA self-hosted CI - #16

Merged
ALJainProjects merged 8 commits into
mainfrom
perf/e2e-speed
Aug 1, 2026
Merged

E2E speed sprint: video training loader, token fast path, honest e2e reruns, CUDA self-hosted CI#16
ALJainProjects merged 8 commits into
mainfrom
perf/e2e-speed

Conversation

@ALJainProjects

Copy link
Copy Markdown
Owner

What

Addresses the gaps/weaknesses from the system-strength assessment and pushes end-to-end training speed on all three modalities, with every number measured on real hardware (RTX 3090 + M4 Max) and reported honestly.

Image (ResNet-18 e2e)

  • Fresh 160px AND new 224px runs: 1.05–1.08x vs PyTorch, ~9% above the pure-GPU floor (earlier-run 1.17x retained with context; gap-to-floor is the stable metric). M4 MPS 224px tie documented (compute-bound, correctly).
  • New CudaPrefetcher (apex-style overlapped H2D). Honest measured result: neutral in these e2e runs — decode delivery, not H2D, binds them; docstring + docs say exactly that.

LLM tokens

  • TokenDataLoader fast path: pin_memory=True pinned ring + device='cuda' (side-stream H2D, CUDA-event-guarded reuse, ready GPU tensors). ONE seq_len+1 gather feeds x AND y.
  • 168M tok/s to device vs nanoGPT get_batch 88M (1.9x) at GPT-2 shape; e2e GPT parity (~2%) with the previous ~10% deficit gone.

Video

  • VideoDatasetLoader: labeled clip batches from root/class_x/*.mp4 — threaded PyAV decode, pts-derived seek, frame-weighted (seed, epoch)-reproducible sampling, ONE fused clip kernel launch per clip, stop-aware lifecycle.
  • First e2e video training benchmark: r3d_18 on real footage — 1.16x vs PyTorch DataLoader + PyAV (both decode-bound; caveat documented).

Platform/CI

  • Self-hosted RTX 3090 runner registered; cuda-tests.yml (workflow_dispatch ONLY — no fork-PR exposure) builds in-place and runs the CUDA suite.
  • Fixed examples/quickstart_demo.py syntax error (comma swallowed by inline comment).

Tests

  • 24 CPU + 14 CUDA-gated tests across the two new loaders (all passing on the 3090: token 8/8+1 skip, video 6/6).
  • Full docs pass: README (mermaid re-validated), E2E_TRAINING_RESULTS, benchmarks index, tokens_arrays, CHANGELOG.

Arnav Jain added 8 commits August 1, 2026 11:37
…oops

Batch k+1's host->device copy runs on a side CUDA stream while the model
computes on batch k (apex-style; wait_stream BEFORE staging the next copy —
staging first would make compute wait on the new copy and re-serialize the
transfer). Pairs with pin_memory=True; one-batch-ahead staging stays within
the pinned ring's reuse window. e2e benchmark gains a tl+prefetcher row.
One np.take of the seq_len+1 window feeds both x and the shifted target
(the numpy path gathers each separately — twice the memory traffic), cast
straight into preallocated pinned int64 tensors. device='cuda' additionally
stages H2D on a side stream with per-slot CUDA events guarding buffer reuse,
yielding device tensors with no lifetime rules for the caller. GPT example
gains a turboloader-dev pipeline; gather equivalence tested on CPU, ring
reuse/device parity/resume tested under CUDA.
…tring

3090 e2e measurement (160px AND 224px) showed CudaPrefetcher NEUTRAL — decode
delivery, not H2D, binds those epochs; docstring now says so instead of the
projected claim. New loader-only benchmark isolates the token fast path at
GPT-2 shape against the exact nanoGPT get_batch idiom (incl. pin+non_blocking).
…y (CUDA)

ImageFolder-style discovery, N PyAV decoder threads (per-thread container
cache, pts-derived seek with a counting fallback for untagged streams),
frame-weighted uniform (video, start) sampling reproducible per (seed, epoch),
aug decisions drawn in task order + results resequenced so batches are
deterministic under any worker scheduling, stop-aware queue lifecycle (no
stranded threads on early exit), flat pinned staging (a 2-D column slice would
silently unpin via .contiguous()), one fused cuda_video_clip_yuv420 launch per
clip. Plus the first e2e VIDEO training benchmark: r3d_18 on real footage
(BBB vs Jellyfish segments), TL vs PyTorch DataLoader + PyAV recipe.
…ed workflow

cuda-tests.yml runs the CUDA suite on the registered 3090-wsl runner,
workflow_dispatch ONLY (self-hosted must never execute fork-PR code).
…en by comment)

E2E_TRAINING_RESULTS gains 160/224px reruns (gap-to-floor framing), the
CudaPrefetcher neutral finding, the first video-training e2e section, and the
GPT/token numbers. README headline + which-loader updated (VideoDatasetLoader,
TokenDataLoader device=), tokens_arrays documents the fast path, CHANGELOG
[Unreleased] written. quickstart_demo.py had the DataLoader comma inside an
inline comment — a syntax error examples/ lint never covered.
@ALJainProjects
ALJainProjects merged commit 91135ac into main Aug 1, 2026
8 checks passed
@ALJainProjects
ALJainProjects deleted the perf/e2e-speed branch August 1, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant