From 937e9b7fce419024cf399742c3f18904b0bdd68a Mon Sep 17 00:00:00 2001 From: Russel Arbore <rarbore2@illinois.edu> Date: Mon, 24 Feb 2025 12:14:48 -0600 Subject: [PATCH] make imm refs copy --- hercules_rt/src/lib.rs | 4 +-- juno_samples/cava/benches/cava_bench.rs | 36 ++++++++++++++++--------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/hercules_rt/src/lib.rs b/hercules_rt/src/lib.rs index d19a0a5a..df53a0e9 100644 --- a/hercules_rt/src/lib.rs +++ b/hercules_rt/src/lib.rs @@ -150,7 +150,7 @@ extern "C" { fn ___cublas_sgemm(i: u64, j: u64, k: u64, c: *mut u8, a: *const u8, b: *const u8); } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Copy)] pub struct HerculesCPURef<'a> { ptr: NonNull<u8>, size: usize, @@ -165,7 +165,7 @@ pub struct HerculesCPURefMut<'a> { } #[cfg(feature = "cuda")] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Copy)] pub struct HerculesCUDARef<'a> { ptr: NonNull<u8>, size: usize, diff --git a/juno_samples/cava/benches/cava_bench.rs b/juno_samples/cava/benches/cava_bench.rs index b8dd3ce2..41b34230 100644 --- a/juno_samples/cava/benches/cava_bench.rs +++ b/juno_samples/cava/benches/cava_bench.rs @@ -25,6 +25,12 @@ fn cava_bench(c: &mut Criterion) { let (rows, cols, num_ctrl_pts, image, tstw, ctrl_pts, weights, coefs, tonemap) = prepare_hercules_inputs(&raw_image, &cam_model); let mut r = runner!(cava); + let image = image.to(); + let tstw = tstw.to(); + let ctrl_pts = ctrl_pts.to(); + let weights = weights.to(); + let coefs = coefs.to(); + let tonemap = tonemap.to(); group.bench_function("cava bench small", |b| { b.iter(|| { @@ -32,12 +38,12 @@ fn cava_bench(c: &mut Criterion) { rows as u64, cols as u64, num_ctrl_pts as u64, - image.to(), - tstw.to(), - ctrl_pts.to(), - weights.to(), - coefs.to(), - tonemap.to(), + image, + tstw, + ctrl_pts, + weights, + coefs, + tonemap, )); }) }); @@ -55,6 +61,12 @@ fn cava_bench(c: &mut Criterion) { let (rows, cols, num_ctrl_pts, image, tstw, ctrl_pts, weights, coefs, tonemap) = prepare_hercules_inputs(&raw_image, &cam_model); let mut r = runner!(cava); + let image = image.to(); + let tstw = tstw.to(); + let ctrl_pts = ctrl_pts.to(); + let weights = weights.to(); + let coefs = coefs.to(); + let tonemap = tonemap.to(); group.bench_function("cava bench full", |b| { b.iter(|| { @@ -62,12 +74,12 @@ fn cava_bench(c: &mut Criterion) { rows as u64, cols as u64, num_ctrl_pts as u64, - image.to(), - tstw.to(), - ctrl_pts.to(), - weights.to(), - coefs.to(), - tonemap.to(), + image, + tstw, + ctrl_pts, + weights, + coefs, + tonemap, )); }) }); -- GitLab