Skip to content

Commit

Permalink
Add use_cpu_or_gpu_tracked
Browse files Browse the repository at this point in the history
  • Loading branch information
elftausend committed Nov 24, 2024
1 parent 92e1608 commit 292143b
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
use core::{cell::RefMut, fmt::Debug, ops::RangeBounds};

use crate::{
op_hint::OpHint,
range::{AsRange, CursorRange},
AnyOp, HasId, Parents, Shape, UniqueId, Unit, WrappedData, ZeroGrad, CPU,
location, op_hint::OpHint, range::{AsRange, CursorRange}, AnyOp, HasId, Parents, Shape, UniqueId, Unit, WrappedData, ZeroGrad, CPU
};

#[cfg(feature = "cached")]
Expand Down Expand Up @@ -622,6 +620,18 @@ pub trait UseGpuOrCpu {
gpu_op: impl FnMut(),
) -> GpuOrCpuInfo;

#[track_caller]
#[inline]
fn use_cpu_or_gpu_tracked(
&self,
input_lengths: &[usize],
cpu_op: impl FnMut(),
gpu_op: impl FnMut(),
) -> GpuOrCpuInfo {
let location = crate::HashLocation::from(core::panic::Location::caller());
self.use_cpu_or_gpu(location, input_lengths, cpu_op, gpu_op)
}

fn set_fork_enabled(&self, _enabled: bool);

#[inline]
Expand Down

0 comments on commit 292143b

Please sign in to comment.