Skip to content

feat(tools): 5-item GPU fast-kernel toolkit (freesilicon/.github#1) & 7-slot Colab fleet dispatcher - #37

Merged
saariuslystoned merged 3 commits into
mainfrom
feat/colab-fleet-and-fast-kernels
Nov 26, 2026
Merged

saariuslystoned merged 3 commits into
mainfrom
feat/colab-fleet-and-fast-kernels

Conversation

@saariuslystoned

Copy link
Copy Markdown
Collaborator

Summary

Implements all 5 training & RL acceleration items tracked in freesilicon/.github#1 together with a clean-room 7-slot Google Colab fleet dispatcher, dual sync backends, and a two-stage Compute Unit governor.

What's Included

  1. tools/h100_fast_kernels.py + tools/test_h100_fast_kernels.py (stdlib-safe --help/--self-test even without PyTorch):
    • ensure_causal_conv1d(): prebuilt binary wheel preference + graceful PyTorch F.conv1d fallback.
    • configure_liger_and_checkpointing(): Inkling-2-safe liger-kernel guards (unweighted value norm, SiTU 4.0/25.0, no-RoPE, final_logit_softcapping=30.0, VRAM-gated fused CE recommendation) + VRAM-aware gradient_checkpointing toggle (auto-off >= 70 GiB).
    • pack_sft_sequences(): FFD dynamic sequence packing (2048 block-diagonal causal mask + sconv_guard=3 for mathematically 0.0 cross-example leak).
    • grouped_moe_dispatch() & patch_inkling2_experts_with_grouped_mm(): fused torch._grouped_mm 64-expert MoE + ExpertLoRA with bit-exact eager fallback.
    • FastRolloutEngine (colocated vLLM sleep-mode / torch.compile CUDA graphs + eager fallback), opt-in Hopper FP8 guard (configure_hopper_fp8), and content-addressed StartupArtifactCache.
  2. tools/colab_fleet.py + tools/test_colab_fleet.py:
    • Up to 7 concurrent slots respecting pre-existing external sessions (GPU <= 3 with H100 -> A100_HM -> A100 -> L4 -> T4_HM fallback & zero 412/503 retry hammering; TPU <= 2 V6E1 -> V5E1; High-RAM CPU workers).
    • Dual Pluggable Sync: --sync local (default, zero cloud keys on Colab) and --sync s3 (generic S3/R2/GCS HMAC via stdlib AWS SigV4 env vars, zero secrets logged).
    • Two-Stage CU Governor: sprint mode down to --floor-cu 500, then auto-throttle to --steady-daily-cap-cu 65 (~2,000 CU/mo rollover) with work-admission gating (0 idle burn).
    • Durable STATE.md, events.jsonl, heartbeat, PROOF.md, and isolated fleet-*-only teardown.
  3. docs/cloud-tpu/colab-fleet-and-fast-kernels.md & .github/workflows/ci.yml CI wiring.

Live Colab GPU Proof (NVIDIA L4, sm_89, PyTorch 2.14.1+cu130, 2.33 CU/hr)

Item Baseline (Eager BF16) Accelerated Delta Parity
1. causal-conv1d (sconv_k=4, H=2304, T=2048) 0.969 ms Graceful F.conv1d fallback (no cp313+cu130 wheel) Fail-fast, 0 build stall Exact
2a. Liger Weighted RMSNorm 1.413 ms 0.802 ms (12/12 unweighted skipped) 1.76× max_abs=0.015625
2b. Liger Fused CE (vocab=201k, softcap=30) 126.0 ms, 5,116.6 MiB 1,007.0 ms, 2,082.0 MiB -3.03 GiB VRAM (auto-recommended < 35 GiB only) loss diff = 1e-6
2c. 36-Loop gradient_checkpointing toggle 105.37 ms (GC on) 72.96 ms (GC off, auto >= 70 GiB) 1.44× loss diff = 0.0
3. Dynamic SFT Packing (128 ex → 9×2048, sconv_guard=3) 236.87 ms (69.0k tok/s) 129.30 ms (126.4k tok/s, 97.9% density) 1.83× (14.22× fewer steps) 0.0 attn/sconv leak
4. MoE GroupedGEMM (E=64, K=8, H=2304, I=1152, LoRA r=16) 119.6 ms (512) / 470.9 ms (2048) 27.5 ms (512) / 49.3 ms (2048) 4.35× → 9.54× max_err=0.0, cos=1.0
5. torch.compile decode + FP8 guard + Startup Cache 76.7 ms eager 75.7 ms compiled · sm_89 safe BF16 · 24.1 ms cache hit Exact parity & SHA-256 verified greedy_exact=true

Verification

  • python3 tools/h100_fast_kernels.py --self-test & python3 tools/test_h100_fast_kernels.py -v: 6/6 PASS
  • python3 tools/colab_fleet.py --self-test & python3 tools/test_colab_fleet.py -v: 5/5 PASS
  • Clean-room privacy audit across all tracked files: PASS (0 forbidden patterns/binaries)

…t dispatcher

Add clean-room GPU training/RL acceleration primitives (freesilicon/.github#1)
and a 7-slot headless Google Colab fleet dispatcher with dual sync and a
two-stage Compute Unit governor:

- tools/h100_fast_kernels.py & tools/test_h100_fast_kernels.py:
  1. causal-conv1d prebuilt-wheel helper with graceful PyTorch fallback
  2. Architecture-safe liger-kernel RMSNorm / softcap=30.0 fused CE guards
     plus VRAM-aware gradient_checkpointing toggle (auto-off >= 70 GiB)
  3. Dynamic SFT sequence packing (max_len=2048, 4D block-diagonal causal
     mask, sconv_guard=3 zero cross-example leak)
  4. Fused 64-expert MoE GroupedGEMM (torch._grouped_mm + ExpertLoRA,
     verified 9.54x speedup at 2048 tokens with 0.0 forward error on L4)
  5. FastRolloutEngine (colocated vLLM sleep-mode / torch.compile CUDA
     graphs + eager fallback), opt-in Hopper FP8 guard, and content-addressed
     StartupArtifactCache
- tools/colab_fleet.py & tools/test_colab_fleet.py:
  - 7-slot concurrent dispatcher (GPU <= 3 with H100->A100_HM->A100->L4->T4_HM
    fallback, TPU <= 2 V6E1->V5E1, High-RAM CPU workers) preserving pre-existing
    external sessions and enforcing fleet-* isolated teardown
  - Dual pluggable sync: --sync local (default, zero cloud keys on Colab) and
    --sync s3 (generic S3-compatible R2/GCS HMAC via stdlib SigV4 env vars)
  - Two-stage CU governor: sprint mode down to --floor-cu 500, then steady-state
    --steady-daily-cap-cu 65 with work-admission gating
- docs/cloud-tpu/colab-fleet-and-fast-kernels.md & .github/workflows/ci.yml

Ref: freesilicon/.github#1

Signed-off-by: Bobby Bones <saariuscrypto@gmail.com>
Avoid evaluating @torch.no_grad() at class definition time when PyTorch is absent on stdlib-only CI runners.

Signed-off-by: Bobby Bones <saariuscrypto@gmail.com>
Ignore Rich traceback source-context lines (e.g. 'except TooManyAssignmentsError:') when classifying HTTP 503 Service Unavailable responses so SKU fallback proceeds cleanly.

Signed-off-by: Bobby Bones <saariuscrypto@gmail.com>
@saariuslystoned
saariuslystoned merged commit 0046401 into main Nov 26, 2026
3 of 4 checks passed
@saariuslystoned
saariuslystoned deleted the feat/colab-fleet-and-fast-kernels branch November 26, 2026 23:13
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