fix(cuda): add missing imports and required-features test guard for rtx-backend-cuda
P0 fixes: - Add [[test]] required-features=["cuda"] to Cargo.toml so backend_parity_tests only compile when the cuda feature is enabled (avoids E0425 compile errors) - Add missing Lazy/OnceCell/RwLock/Arc/HashMap imports to device.rs - Add missing Arc import to tensor.rs - Add missing Backend/BoolU8/DeviceId/DeviceOps imports to lib.rs All 16 backend parity tests now pass with --features cuda.
This commit is contained in:
@@ -49,3 +49,7 @@ path = "src/lib.rs"
|
|||||||
|
|
||||||
[lints]
|
[lints]
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "backend_parity_tests"
|
||||||
|
required-features = ["cuda"]
|
||||||
|
|||||||
@@ -6,6 +6,18 @@
|
|||||||
use cudarc::cublas::CudaBlas;
|
use cudarc::cublas::CudaBlas;
|
||||||
#[cfg(feature = "cuda")]
|
#[cfg(feature = "cuda")]
|
||||||
use cudarc::driver::{CudaContext, CudaStream};
|
use cudarc::driver::{CudaContext, CudaStream};
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use crate::CudaBackend;
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use rtx_backend::{DeviceId, DeviceOps};
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use once_cell::sync::{Lazy, OnceCell};
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use parking_lot::RwLock;
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use std::collections::HashMap;
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{CudaError, CudaResult};
|
use crate::{CudaError, CudaResult};
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ pub use device::CudaDevice;
|
|||||||
pub use error::{CudaError, CudaResult};
|
pub use error::{CudaError, CudaResult};
|
||||||
pub use tensor::CudaTensorPrimitive;
|
pub use tensor::CudaTensorPrimitive;
|
||||||
|
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use rtx_backend::{Backend, BoolU8, DeviceId, DeviceOps};
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
/// CUDA backend for RustyTorch++.
|
/// CUDA backend for RustyTorch++.
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
use crate::CudaDevice;
|
use crate::CudaDevice;
|
||||||
#[cfg(feature = "cuda")]
|
#[cfg(feature = "cuda")]
|
||||||
use cudarc::driver::CudaSlice;
|
use cudarc::driver::CudaSlice;
|
||||||
|
#[cfg(feature = "cuda")]
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[cfg(feature = "cuda")]
|
#[cfg(feature = "cuda")]
|
||||||
/// CUDA tensor primitive - GPU memory storage for tensors.
|
/// CUDA tensor primitive - GPU memory storage for tensors.
|
||||||
|
|||||||
Reference in New Issue
Block a user