pub fn execute_with_fallback_timed<T, GpuFn, CpuFn>(
config: &FallbackConfig,
gpu_op: GpuFn,
cpu_op: CpuFn,
) -> GpuResult<FallbackResult<T>>Expand description
Like execute_with_fallback, but additionally checks whether the GPU op
takes longer than config.timeout_ms milliseconds. If the timeout fires
before the GPU closure returns, cpu_op is called and ExecutionPath::Cpu
is reported.
When config.timeout_ms is None this function behaves identically to
execute_with_fallback.
ยงNote
The GPU closure is executed on a background thread and its result is
forwarded over a channel. A recv_timeout call on the receiving end
implements the deadline. If the deadline fires the CPU closure is called
on the calling thread; the background GPU thread continues to completion
and its result is silently discarded.
The GPU closure must be Send + 'static so it can be moved into the
background thread.