Fix 3 compile errors: rtx-metal (Linux cfg), rtx-onnx (ort API), rtx-fusion (edition)

- rtx-metal: fix MetalError import in sparse/conversion.rs non-macOS stub
- rtx-onnx: update session.rs and tensor_bridge.rs for ort 2.x API changes
- rtx-fusion: fix Cargo.toml package name
- rtx-hub: fix discovery.rs type mismatch
- Full workspace (80+ crates) now compiles clean on Linux
This commit is contained in:
osobh
2026-03-15 17:33:54 -07:00
parent 4d88dc0584
commit d52d359f52
5 changed files with 23 additions and 21 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ repository.workspace = true
description = "Automatic kernel fusion for RustyTorch - stream-based fusion similar to Burn's burn-fusion" description = "Automatic kernel fusion for RustyTorch - stream-based fusion similar to Burn's burn-fusion"
keywords = ["gpu", "kernel-fusion", "deep-learning", "optimization"] keywords = ["gpu", "kernel-fusion", "deep-learning", "optimization"]
categories = ["science", "algorithms"] categories = ["science", "algorithms"]
rust-version = "1.85" rust-version = "1.92"
[dependencies] [dependencies]
# Core RTX dependencies # Core RTX dependencies
@@ -3,7 +3,7 @@
//! Provides conversions between COO, CSR, and CSC formats. //! Provides conversions between COO, CSR, and CSC formats.
use crate::device::MetalDevice; use crate::device::MetalDevice;
use crate::error::Result; use crate::error::{MetalError, Result};
use super::formats::{CsrMatrix, CooMatrix, CscMatrix}; use super::formats::{CsrMatrix, CooMatrix, CscMatrix};
/// Convert COO matrix to CSR format /// Convert COO matrix to CSR format
+5 -2
View File
@@ -616,8 +616,11 @@ impl ModelMetrics {
.iter() .iter()
.filter(|(date_str, _)| { .filter(|(date_str, _)| {
if let Ok(date) = chrono::NaiveDate::parse_from_str(date_str, "%Y-%m-%d") { if let Ok(date) = chrono::NaiveDate::parse_from_str(date_str, "%Y-%m-%d") {
let datetime = date.and_hms_opt(0, 0, 0).unwrap(); if let Some(datetime) = date.and_hms_opt(0, 0, 0) {
datetime.and_utc() >= cutoff datetime.and_utc() >= cutoff
} else {
false
}
} else { } else {
false false
} }
+15 -15
View File
@@ -7,7 +7,7 @@ use crate::execution_provider::ExecutionProviderType;
use crate::tensor_bridge::{ort_to_rtx, rtx_to_ort}; use crate::tensor_bridge::{ort_to_rtx, rtx_to_ort};
use ort::session::Session; use ort::session::Session;
use ort::session::builder::GraphOptimizationLevel as OrtGraphOptimizationLevel; use ort::session::builder::GraphOptimizationLevel as OrtGraphOptimizationLevel;
use ort::value::DynValue; use ort::value::{DynValue, TensorElementType};
use rtx_tensor::{Device, Tensor}; use rtx_tensor::{Device, Tensor};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::HashMap; use std::collections::HashMap;
@@ -82,7 +82,7 @@ pub struct IoInfo {
/// Shape (None dimensions are dynamic) /// Shape (None dimensions are dynamic)
pub shape: Vec<Option<i64>>, pub shape: Vec<Option<i64>>,
/// Data type /// Data type
pub dtype: ort::tensor::TensorElementType, pub dtype: TensorElementType,
} }
/// ONNX Runtime session wrapper /// ONNX Runtime session wrapper
@@ -122,15 +122,15 @@ impl OnnxSession {
); );
let mut builder = Session::builder() let mut builder = Session::builder()
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string()))?; .map_err(|e| OnnxError::SessionCreation(e.to_string()))?;
builder = builder builder = builder
.with_optimization_level(config.optimization_level.into()) .with_optimization_level(config.optimization_level.into())
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string()))?; .map_err(|e| OnnxError::SessionCreation(e.to_string()))?;
let session = builder let session = builder
.commit_from_memory(model_bytes) .commit_from_memory(model_bytes)
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string()))?; .map_err(|e| OnnxError::SessionCreation(e.to_string()))?;
Self::from_session(session, config) Self::from_session(session, config)
} }
@@ -138,24 +138,24 @@ impl OnnxSession {
/// Create session from file with configuration /// Create session from file with configuration
fn create_session(path: &Path, config: &OnnxSessionConfig) -> Result<Session> { fn create_session(path: &Path, config: &OnnxSessionConfig) -> Result<Session> {
let mut builder = Session::builder() let mut builder = Session::builder()
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string()))?; .map_err(|e| OnnxError::SessionCreation(e.to_string()))?;
// Set optimization level // Set optimization level
builder = builder builder = builder
.with_optimization_level(config.optimization_level.into()) .with_optimization_level(config.optimization_level.into())
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string()))?; .map_err(|e| OnnxError::SessionCreation(e.to_string()))?;
// Set thread counts if specified // Set thread counts if specified
if let Some(threads) = config.intra_op_threads { if let Some(threads) = config.intra_op_threads {
builder = builder builder = builder
.with_intra_threads(threads) .with_intra_threads(threads)
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string()))?; .map_err(|e| OnnxError::SessionCreation(e.to_string()))?;
} }
if let Some(threads) = config.inter_op_threads { if let Some(threads) = config.inter_op_threads {
builder = builder builder = builder
.with_inter_threads(threads) .with_inter_threads(threads)
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string()))?; .map_err(|e| OnnxError::SessionCreation(e.to_string()))?;
} }
// Configure execution provider // Configure execution provider
@@ -163,7 +163,7 @@ impl OnnxSession {
builder builder
.commit_from_file(path) .commit_from_file(path)
.map_err(|e: ort::Error| OnnxError::SessionCreation(e.to_string())) .map_err(|e| OnnxError::SessionCreation(e.to_string()))
} }
/// Configure the execution provider for the session /// Configure the execution provider for the session
@@ -188,7 +188,7 @@ impl OnnxSession {
.with_execution_providers([CUDAExecutionProvider::default() .with_execution_providers([CUDAExecutionProvider::default()
.with_device_id(opts.device_id) .with_device_id(opts.device_id)
.build()]) .build()])
.map_err(|e: ort::Error| OnnxError::ExecutionProvider(e.to_string())) .map_err(|e| OnnxError::ExecutionProvider(e.to_string()))
} }
#[cfg(feature = "coreml")] #[cfg(feature = "coreml")]
ExecutionProviderType::CoreML(_opts) => { ExecutionProviderType::CoreML(_opts) => {
@@ -196,7 +196,7 @@ impl OnnxSession {
debug!("Configuring CoreML execution provider"); debug!("Configuring CoreML execution provider");
builder builder
.with_execution_providers([CoreMLExecutionProvider::default().build()]) .with_execution_providers([CoreMLExecutionProvider::default().build()])
.map_err(|e: ort::Error| OnnxError::ExecutionProvider(e.to_string())) .map_err(|e| OnnxError::ExecutionProvider(e.to_string()))
} }
#[cfg(feature = "tensorrt")] #[cfg(feature = "tensorrt")]
ExecutionProviderType::TensorRT(opts) => { ExecutionProviderType::TensorRT(opts) => {
@@ -206,7 +206,7 @@ impl OnnxSession {
.with_execution_providers([TensorRTExecutionProvider::default() .with_execution_providers([TensorRTExecutionProvider::default()
.with_device_id(opts.device_id) .with_device_id(opts.device_id)
.build()]) .build()])
.map_err(|e: ort::Error| OnnxError::ExecutionProvider(e.to_string())) .map_err(|e| OnnxError::ExecutionProvider(e.to_string()))
} }
#[cfg(feature = "directml")] #[cfg(feature = "directml")]
ExecutionProviderType::DirectML(opts) => { ExecutionProviderType::DirectML(opts) => {
@@ -216,7 +216,7 @@ impl OnnxSession {
.with_execution_providers([DirectMLExecutionProvider::default() .with_execution_providers([DirectMLExecutionProvider::default()
.with_device_id(opts.device_id) .with_device_id(opts.device_id)
.build()]) .build()])
.map_err(|e: ort::Error| OnnxError::ExecutionProvider(e.to_string())) .map_err(|e| OnnxError::ExecutionProvider(e.to_string()))
} }
} }
} }
@@ -273,7 +273,7 @@ impl OnnxSession {
let ort_outputs = self let ort_outputs = self
.session .session
.run(ort_inputs) .run(ort_inputs)
.map_err(|e: ort::Error| OnnxError::Inference(e.to_string()))?; .map_err(|e| OnnxError::Inference(e.to_string()))?;
// Convert outputs to rtx tensors using into_iter to take ownership // Convert outputs to rtx tensors using into_iter to take ownership
let mut result = HashMap::new(); let mut result = HashMap::new();
@@ -3,8 +3,7 @@
//! Provides conversion functions between RustyTorch tensors and ONNX Runtime values. //! Provides conversion functions between RustyTorch tensors and ONNX Runtime values.
use crate::error::{OnnxError, Result}; use crate::error::{OnnxError, Result};
use ort::tensor::TensorElementType; use ort::value::{DynValue, Tensor as OrtTensor, TensorElementType};
use ort::value::{DynValue, Tensor as OrtTensor};
use rtx_tensor::{DType, Device, Tensor}; use rtx_tensor::{DType, Device, Tensor};
use std::collections::HashMap; use std::collections::HashMap;