Simplify the pattern matching logic in the cuda backend.

This commit is contained in:
laurent
2023-06-29 09:21:11 +01:00
parent eda46d2df2
commit 122e334d0c
5 changed files with 78 additions and 89 deletions

View File

@ -9,11 +9,11 @@ pub enum Storage {
}
impl Storage {
pub fn try_clone(&self) -> Result<Self> {
pub fn try_clone(&self, layout: &Layout) -> Result<Self> {
match self {
Self::Cpu(storage) => Ok(Self::Cpu(storage.clone())),
Self::Cuda(storage) => {
let storage = storage.try_clone()?;
let storage = storage.try_clone(layout)?;
Ok(Self::Cuda(storage))
}
}