use onnx_runtime_ep_api::{TensorMut, TensorView};
#[cfg(feature = "tracing")]
#[inline]
pub(crate) fn record_kernel_metrics(
inputs: &[TensorView<'_>],
outputs: &[TensorMut<'_>],
flops: impl FnOnce() -> u64,
) {
onnx_runtime_ep_api::record_kernel_metrics("cpu", inputs, outputs, flops);
}
#[cfg(not(feature = "tracing"))]
#[inline]
pub(crate) fn record_kernel_metrics(
_inputs: &[TensorView<'_>],
_outputs: &[TensorMut<'_>],
_flops: impl FnOnce() -> u64,
) {
}
#[cfg(feature = "tracing")]
#[inline]
pub(crate) fn worker_span(label: &'static str) -> Option<onnx_runtime_tracer::SpanGuard> {
onnx_runtime_ep_api::kernel_worker_span(label)
}
#[cfg(not(feature = "tracing"))]
#[inline]
pub(crate) fn worker_span(_label: &'static str) -> Option<()> {
None
}
pub(crate) fn product(values: impl IntoIterator<Item = usize>) -> u64 {
values
.into_iter()
.fold(1_u64, |total, value| total.saturating_mul(value as u64))
}