924c237096bf70b99e3e8385966dbc32ce5640a0
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b45a58792d |
feat(batch7): interleaved 1F1B, attention-selective checkpointing, flash decoding
CI / Format Check (push) Failing after 6s
GPU Tests / Check GPU Availability (push) Successful in 0s
Performance Benchmarks / Run Benchmarks (push) Successful in 10s
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
CI / Clippy Check (push) Failing after 11s
Documentation / Build API Documentation (push) Failing after 14s
CI / Build (ubuntu-latest) (push) Failing after 50s
CI / Build CPU-Only (Explicit) (push) Failing after 1m2s
Documentation / Build User Guide (push) Successful in 7s
CI / Build (macos-latest) (push) Failing after 39s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 0s
GPU Tests / Metal Tests (push) Has been skipped
Interleaved 1F1B pipeline schedule (rtx-distributed):
- PipelineConfig: num_virtual_stages (default 1) + rank fields; validate()
- PipelineScheduler::generate_interleaved_schedule(): real Megatron-LM
virtual-stage assignment (mb % m) * p + rank; warmup/steady/drain phases
with SendActivation/SendGradient pairs
- bubble_ratio(): (p-1)/(p*m) interleaved vs (p-1)/p standard; p=4,m=2
reduces bubble 0.750 → 0.375; 4 new tests, 24 total pass
Attention-selective activation checkpointing (rtx-distributed):
- CheckpointPolicy::AttentionSelective { attention_patterns } — name-match
on attn/attention/self_attn/cross_attn/mha; ~40% memory savings
- CheckpointPolicy::Adaptive: replaced layer%2 stub with 3-tier heuristic
(>4096MB→sqrt(n), >1024MB→every-other, ≤1024MB→all)
- MemoryAwareCheckpointer: AtomicUsize pressure tracking, fallback-to-all
when over target; re-exported from crate root; 14 new tests, 29 total pass
Flash decoding (rtx-flash-attention):
- flash_decode_cpu(): split-K attention with log-sum-exp chunk reduction;
matches naive attention within 1e-4 for all tested configs
- FlashDecodeKernel wrapper; num_splits_for_seq_len heuristic (256 tok/chunk)
- flash_decode_forward.cu: 2-phase CUDA (per-chunk partial + reduce kernel)
- SdpaBackend::FlashDecode: score 0.97 for seq_q=1 && kv>=1024; up to 50×
speedup at 32K tokens; selected over other backends for long-context decode
- 10 unit tests + 3 doctests + 1 backend selector test; all pass
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
||
|
|
80d7c7fb6c |
feat(flash-attention): add varlen packed-sequence support
Implements variable-length (varlen) FlashAttention that processes mixed-length batches without padding waste: - New CUDA kernel flash_attention_varlen_forward with BLOCK_Q=64 / BLOCK_K=64 tiling; grid=(ceil(max_seqlen_q/64), num_heads, 1). Each block uses a linear scan over cu_seqlens_q to identify its owning sequence and exits early when past sequence end. - New Rust module flash_varlen_forward: always-compiled CPU simulation (varlen_attention_cpu) for testing + #[cfg(cuda)] FlashVarlenKernel. - SdpaBackend::VarLen variant added to backend_selector. - 8 new CPU-only tests; total test count: 50. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
082a50e3a0 |
feat(perf): GPU perf batch 1 — wire GPU execution paths for FP8, FA3, CUDA Graphs, SnapKV
CI / Build (ubuntu-latest) (push) Failing after 8s
Performance Benchmarks / Run Benchmarks (push) Successful in 8s
CI / Clippy Check (push) Failing after 8s
CI / Build CPU-Only (Explicit) (push) Failing after 8s
Documentation / Build API Documentation (push) Failing after 7s
CI / Format Check (push) Failing after 9s
GPU Tests / Check GPU Availability (push) Successful in 0s
Documentation / Build User Guide (push) Successful in 7s
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
CI / Build (macos-latest) (push) Failing after 14s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 0s
GPU Tests / Metal Tests (push) Has been skipped
FP8 GPU FFI (rtx-tensor) - `fp8_cast.rs`: replaced `not_implemented` stubs with real cudarc 0.18.2 PTX launches; `cast_bf16_to_fp8_e4m3` and `cast_fp8_e4m3_to_bf16` now dispatch to NVCC-compiled `fp8_cast.ptx` via `LazyLock` module cache, matching the `inplace_ops` pattern - `build.rs`: `create_dummy_ptx` now emits `fp8_cast.ptx` alongside `element_wise.ptx` so `include_str!` resolves cleanly when NVCC is absent FlashAttention-3 typed kernel launch (rtx-flash-attention) - `flash_v3_forward.rs`: `forward()` now takes typed `CudaSlice<bf16>` Q/K/V/O + `CudaSlice<f32>` LSE buffer; dispatches via `stream.launch_builder` with block_dim=(128,1,1), grid_dim=(ceil(seq_len/64), batch*heads, 1), shared_mem_bytes=0 (PTX metadata-resolved) - `simple.rs`: added `has_flash_v3()` + `flash_attention_v3_forward_raw()` dispatch - `Cargo.toml`: `half` added as optional cuda-gated dependency CUDA Graphs stream threading (rtx-transformers) - `training_loop.rs`: added `cuda_stream: Option<CudaStreamHandle>` field; `set_cuda_backend()` now creates a non-default capture stream; capture step calls real `begin_capture(stream)` + `end_capture(stream)`; added `set_cuda_stream()` override; replay unchanged (no stream needed) SnapKV + prefix cache BatchScheduler wiring (rtx-inference) - `scheduler.rs`: added `prefix_hit_pages: Option<Vec<PageId>>` + `evicted_positions: Vec<usize>` to `SchedulerRequest`; `BatchScheduler` gains `kv_cache` + `snapkv_eviction` fields; `submit_request` does non-blocking `try_lock` prefix lookup; added `notify_prefill_complete` (registers prefix + runs `select_evict_positions`), `set_kv_cache`, `set_snapkv_eviction`, `get_evicted_positions`, `get_prefix_hit_pages` — +5 new integration tests Test results: 22 + 42 + 75 + 102 = 241 tests, 0 failures Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
1eb89c5b2b |
feat(perf): GPU perf batch 1 — FP8, FA3 Blackwell, CUDA Graphs, SnapKV, prefix cache
CI / Build CPU-Only (Explicit) (push) Failing after 8s
CI / Clippy Check (push) Failing after 12s
GPU Tests / Check GPU Availability (push) Successful in 0s
CI / Format Check (push) Failing after 14s
Performance Benchmarks / Run Benchmarks (push) Failing after 15s
Documentation / Build User Guide (push) Successful in 6s
Documentation / Build API Documentation (push) Failing after 16s
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
CI / Build (ubuntu-latest) (push) Failing after 1m20s
CI / Build (macos-latest) (push) Failing after 1m26s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 0s
GPU Tests / Metal Tests (push) Has been skipped
Item 1 — CUDA Graphs wiring (rtx-transformers)
- Added `enable_cuda_graphs: bool` (default false) + `cuda_graph_warmup_iters: usize`
(default 3) to `TrainingConfig`
- Wired 3-phase state machine into `training_loop.rs` (warmup → capture → replay)
gated on `#[cfg(feature = "cuda")]`; stream plumbing stubbed with TODO pending
`CudaStreamHandle` threading
Item 2 — FP8 E4M3/E5M2 training infrastructure (rtx-tensor, rtx-transformers)
- `fp8_cast.cu`: dual-path CUDA kernels — SM_89+ uses `<cuda_fp8.h>` native
`__nv_cvt_*` intrinsics; older SM uses software bit-manipulation fallback
- `fp8_cast.rs`: host-side CPU casting + `#[cfg(feature = "cuda")]` GPU stubs
- `fp8_gemm.rs`: bit-accurate E4M3 decoder/encoder, BF16 round-trip utils, CPU
reference matmul with cuBLASLt GPU path documented inline; 12 unit tests
- `training_config.rs`: `fp8_training: bool`, `fp8_e4m3_forward: bool`
- `linear.rs` (modular): `fp8_mode: bool` field + forward dispatch stub
- build.rs: registers `fp8_cast.cu` alongside existing `element_wise.cu`
- 22 FP8 unit tests — all pass
Item 3 — FlashAttention-3 Blackwell (WGMMA + TMA + warp specialization)
- `flash_attention_v3_forward.cu`: SM_90+ warp-specialised producer/consumer
kernel (producer TMA-loads K/V tiles, consumers run WMMA as portable WGMMA
proxy); SM_89+ FP8 header path; SM<90 standard FA2-style WMMA fallback
- `flash_v3_forward.rs`: NVRTC wrapper (`compile_ptx` via `include_str!`),
`FlashV3ForwardKernel::new/is_supported/forward`; 6 unit tests
- `backend_selector.rs`: `SdpaBackend::FlashAttentionV3`, `for_compute_capability`,
`supports_flash_v3` (major >= 9), FA3 scoring (0.98/0.90/0.70), 2× speedup estimate
- `kernels/simple.rs`: `v3_kernel: Option<FlashV3ForwardKernel>` in `FlashCudaKernels`
- Fixed pre-existing `Device::Cpu` cfg-gate bug in `tensor/creation.rs`
- 8 new FA3 backend tests + 6 kernel unit tests; 50 total pass
Item 4 — SnapKV attention-score eviction + prefix caching (rtx-inference, rtx-serving-api)
- `prefix_index.rs`: `PrefixIndex` with 8MB Zobrist hash table (Knuth MMIX LCG seed),
`compute_hash/lookup/insert/remove/remove_page`; 10 unit tests
- `eviction.rs`: `AttentionScoreEviction` struct — `accumulate_scores` +
`select_evict_positions` (retain top keep_ratio + last recent_window); 7 unit tests
- `types.rs`: `EvictionPolicy::AttentionScore { keep_ratio, recent_window }` +
`KvCacheConfig::enable_prefix_caching`
- `paged_kv_cache.rs`: `prefix_index: Option<PrefixIndex>` + `lookup_prefix /
register_prefix / unregister_prefix_page / prefix_caching_enabled` methods
- `config.rs` (serving-api): `enable_prefix_sharing: true` (was false),
`snapkv_keep_ratio: 0.6`, `snapkv_recent_window: 32`
- Fixed 12 pre-existing test errors (spurious `.await` on sync constructors)
- 17 SnapKV/prefix tests pass
Total: 918 lib tests pass across rtx-tensor, rtx-flash-attention, rtx-transformers,
rtx-inference. Zero new failures.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
||
|
|
c82d26d6e7 |
style: rustfmt formatting pass on rtx-tensor and rtx-flash-attention
CI / Format Check (push) Failing after 13s
Performance Benchmarks / Run Benchmarks (push) Successful in 8m13s
CI / Clippy Check (push) Failing after 11s
CI / Build (ubuntu-latest) (push) Failing after 7m37s
GPU Tests / Check GPU Availability (push) Successful in 0s
Documentation / Build User Guide (push) Successful in 15s
Documentation / Build API Documentation (push) Failing after 17s
CI / Build CPU-Only (Explicit) (push) Failing after 3m21s
GPU Tests / CUDA Tests (11.8) (push) Has been skipped
GPU Tests / CUDA Tests (12.1) (push) Has been skipped
CI / Build (macos-latest) (push) Failing after 9s
CI / Test (macos-latest) (push) Has been skipped
CI / Test (ubuntu-latest) (push) Has been skipped
CI / Python Bindings (maturin) (macos-latest) (push) Has been skipped
CI / Python Bindings (maturin) (ubuntu-latest) (push) Has been skipped
CI / WASM Build + Size Check (push) Has been skipped
CI / Distributed Training Tests (push) Has been skipped
CI / CI Success (push) Failing after 1s
GPU Tests / Metal Tests (push) Has been skipped
Import reordering, long-line reformatting — no logic changes. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
c2f4796871 |
fix(rtx-flash-attention): sm_120 for Blackwell, robust nvcc path resolution
build.rs was hardcoded for sm_90 (incorrectly labelled Ada Lovelace/RTX 5090). Fix for RTX 5060 Ti (sm_120, Blackwell): - Auto-detect SM via CUDA_ARCH env var (default sm_120); compute_ prefix derived automatically so compute_120/sm_120 are no longer hardcoded. - nvcc resolution: try PATH first, then CUDA_PATH/bin/nvcc, CUDA_HOME, and common installation prefixes — no longer panics when nvcc is at /usr/local/cuda-13.1/bin but not in $PATH. - PTX version: sm_100+ → .version 8.0 (PTX ISA 8.0 for Blackwell). - No-GPU branch: remove the warning — CPU fallback is valid, there is no reason to warn every build when cuda/metal are intentionally off. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> |
||
|
|
5c2ee63d53 |
GPU Mamba forward + rtx-tensor device-pointer API + matrix exponential
Performance Benchmarks / Run Benchmarks (pull_request) Has been cancelled
CI / Format Check (pull_request) Has been cancelled
Documentation / Build User Guide (pull_request) Has been cancelled
CI / Clippy Check (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Test (macos-latest) (pull_request) Has been cancelled
CI / Test (ubuntu-latest) (pull_request) Has been cancelled
CI / Build CPU-Only (Explicit) (pull_request) Has been cancelled
CI / CI Success (pull_request) Has been cancelled
Documentation / Build API Documentation (pull_request) Has been cancelled
GPU Tests / Check GPU Availability (pull_request) Has been cancelled
GPU Tests / CUDA Tests (11.8) (pull_request) Has been cancelled
GPU Tests / CUDA Tests (12.1) (pull_request) Has been cancelled
GPU Tests / Metal Tests (pull_request) Has been cancelled
Persist accumulated WIP across rtx-tensor / rtx-transformers / rtx-runtime. Two related feature groups: GPU enablement (unblocks the Phase-3 spec §8 CUDA Mamba path): - rtx-tensor: `Tensor::cuda_device_ptr()` + storage GPU-buffer accessors (`raw_ptr.rs`) expose the raw CUdeviceptr that kernel launches need — the "rtx-tensor GPU memory access API" the Mamba CUDA kernels were blocked on. - rtx-transformers: `MambaBlock::forward_cuda` runs the four linear projections through cuBLAS on-device (in/out/x/dt_proj), keeping the selective scan + conv1d + activations on CPU; dispatched automatically from `forward` when on a CUDA device under the `cuda` feature. Updated `mamba_cuda_kernels.rs` accordingly. - supporting plumbing in rtx-runtime stream/bridge and rtx-tensor storage/conversion/concatenation/creation + rtx-flash-attention. Linear algebra (rtx-tensor): - `linalg/matrix_exp.rs`: real matrix exponential via scaling-and-squaring with a degree-13 Padé approximant (Higham 2005), f64 internally. - `complex/linalg.rs`: complex matmul/adjoint, Hermitian eigendecomposition (`ComplexEigenResult`), and the complex matrix exponential, nalgebra-backed. - tests for both. Builds verified on the CPU path (`cargo check -p rtx-tensor -p rtx-transformers -p rtx-runtime -p rtx-flash-attention` clean). The `cuda` feature and the rtx-backend-cuda NVCC build remain unbuildable on this host (CUDA/glibc header mismatch) — pre-existing and unrelated to these changes. |
||
|
|
4d88dc0584 | Initial commit |