Files
rustytorch/crates/training/rtx-transformers/build.rs
T
Omar SobhandClaude Sonnet 4.6 ef786c0ab1
CI / Clippy Check (push) Failing after 8s
Documentation / Build User Guide (push) Successful in 7s
Documentation / Build API Documentation (push) Failing after 9s
Performance Benchmarks / Run Benchmarks (push) Successful in 1m29s
CI / Format Check (push) Failing after 15s
CI / Build (ubuntu-latest) (push) Failing after 42s
CI / Build CPU-Only (Explicit) (push) Failing after 3m17s
CI / Build (macos-latest) (push) Failing after 30s
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
feat(batch5): mid-batch injection, PagedAttn v2 defrag, fused RoPE kernel
Continuous batching (rtx-serving-api):
- ContinuousBatchingConfig: enable_mid_batch_injection (default true),
  injection_check_interval (default 1), max_injections_per_step (default 4)
- ContinuousBatchingController: inject_into_active_batch() + try_inject_pending()
  allow new sequences to join a running decode batch after each step
- BatchingError::BatchFull variant; 3 new tests

PagedAttention v2 defrag (rtx-memory):
- PageTable::fragmentation_ratio() — hole-counting (sandwiched free pages / total)
- PageTable::defragment() — in-place left-compaction of physical page metadata,
  consistent lock order (free_pages -> physical_pages -> sequences); GPU KV copy
  stub comment; DefragStats return value; re-exported from lib.rs
- 4 defrag tests; fixed 2 pre-existing compile errors in gpu_oom.rs + gpu_transfer.rs
- 192 tests pass

Fused RoPE kernel (rtx-transformers):
- build_cos_sin_table() + rope_forward_cpu() CPU reference (norm-preserving)
- RopeFusedKernel wrapper; rope_forward.cu CUDA kernel (1 block per (B,H,T),
  1 thread per dim pair, NVRTC compiled)
- Replaced apply_rope_rotation() mul_scalar(0.99) stub with real pairwise rotation
- build.rs for NVRTC kernel tracking; layers/mod.rs wired; 8 tests pass

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
2026-06-27 01:40:47 +00:00

27 lines
927 B
Rust

// build.rs for rtx-transformers
//
// When the "cuda" feature is active this build script compiles the
// `rope_forward.cu` kernel using NVRTC at *runtime* (via `cudarc`), so there
// is no hard build-time dependency on nvcc. The build script only instructs
// Cargo to re-run when the kernel source changes.
//
// If CUDA is not enabled (the default) this build script is a no-op.
fn main() {
// Only relevant when the cuda feature is active.
#[cfg(feature = "cuda")]
cuda_setup();
// Always tell Cargo to re-run if *this* script changes.
println!("cargo:rerun-if-changed=build.rs");
}
#[cfg(feature = "cuda")]
fn cuda_setup() {
// Track the kernel source so Cargo rebuilds when it changes.
println!("cargo:rerun-if-changed=src/cuda_kernels/rope_forward.cu");
// Emit the cuda feature flag for conditional compilation inside the crate.
println!("cargo:rustc-cfg=feature=\"cuda\"");
}