fix(ml): cuda_pipeline + trainers infra — CudaSlice throughout

- cuda_pipeline/mod.rs: all Tensor→CudaSlice, DqnGpuData/PpoGpuData GPU-native,
  d2d_subrange helper, build_state_tensor host-interleave + single HtoD
- portfolio_transformer.rs: complete rewrite with GpuLinear + cuBLAS
- trainers/tlob.rs: GpuVarStore + GpuLinear, host-side MSE/MAE
- trainers/tft: StreamTensor trait, MlDevice constructors
- trainers/liquid.rs, mamba2.rs: GpuTensor pairs, f64 loss accumulation
- training/orchestrator.rs: forward_loss(&[f32]) trait interface
- hyperopt/adapters/ppo.rs: MlDevice, PPO::new() constructor
- ml-ppo/lib.rs: fixed cuda_compat→cuda_compile re-export

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-18 10:02:18 +01:00
parent c89a1dbf29
commit a26478eca3
2 changed files with 10 additions and 10 deletions

View File

@@ -20,7 +20,7 @@
#![allow(unsafe_code)] // Required for CUDA kernel launches and cuBLAS FFI
// Re-export shared modules from ml-core for convenience
pub use ml_core::cuda_compat;
pub use ml_core::cuda_compile;
pub mod adaptive_entropy;
pub mod continuous_policy;

View File

@@ -2,7 +2,7 @@
//!
//! This module provides a trait-based abstraction for the TFT model used by TFTTrainer.
use ml_core::cuda_autograd::GpuTensor;
use ml_core::cuda_autograd::StreamTensor;
use crate::tft::{TFTConfig, TemporalFusionTransformer};
use crate::MLError;
@@ -21,11 +21,11 @@ pub trait TFTModel: Send + Sync {
/// * Quantile predictions [batch, horizon, num_quantiles]
fn forward(
&mut self,
static_features: &GpuTensor,
historical_ts: &GpuTensor,
future_ts: &GpuTensor,
static_features: &StreamTensor,
historical_ts: &StreamTensor,
future_ts: &StreamTensor,
use_checkpointing: bool,
) -> Result<GpuTensor, MLError>;
) -> Result<StreamTensor, MLError>;
/// Get configuration
fn get_config(&self) -> &TFTConfig;
@@ -39,11 +39,11 @@ pub trait TFTModel: Send + Sync {
impl TFTModel for TemporalFusionTransformer {
fn forward(
&mut self,
static_features: &GpuTensor,
historical_ts: &GpuTensor,
future_ts: &GpuTensor,
static_features: &StreamTensor,
historical_ts: &StreamTensor,
future_ts: &StreamTensor,
use_checkpointing: bool,
) -> Result<GpuTensor, MLError> {
) -> Result<StreamTensor, MLError> {
self.forward_with_checkpointing(
static_features,
historical_ts,