From dc8cf050994fe431498f24566f1ddb366613de43 Mon Sep 17 00:00:00 2001 From: Xiaochun Tong Date: Wed, 22 Nov 2023 14:46:06 -0500 Subject: [PATCH] update submod --- luisa_compute/examples/vecadd.rs | 23 +++++++++++++++++++---- luisa_compute_sys/LuisaCompute | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/luisa_compute/examples/vecadd.rs b/luisa_compute/examples/vecadd.rs index 39ed0bf..5c1b675 100644 --- a/luisa_compute/examples/vecadd.rs +++ b/luisa_compute/examples/vecadd.rs @@ -1,9 +1,9 @@ use luisa::prelude::*; use luisa_compute as luisa; use std::env::current_exe; -#[tracked] + fn main() { - luisa::init_logger(); + luisa::init_logger_verbose(); let args: Vec = std::env::args().collect(); assert!( args.len() <= 2, @@ -29,7 +29,7 @@ fn main() { name: Some("vecadd".into()), ..Default::default() }, - &|buf_z| { + &track!(|buf_z| { // z is pass by arg let buf_x = &x; // x and y are captured let buf_y = &y; @@ -39,9 +39,24 @@ fn main() { let vx = 2.0_f32.var(); // create a local mutable variable *vx += x; // store to vx buf_z.write(tid, vx + y); - }, + }), ); kernel.dispatch([1024, 1, 1], &z); let z_data = z.view(..).copy_to_vec(); println!("{:?}", &z_data[0..16]); + { + let s = device.default_stream(); + let t = std::time::Instant::now(); + let times = 1000; + let s = s.scope(); + for _ in 0..times { + + s.submit_with_callback([], ||{ + std::hint::black_box(()); + }); + s.synchronize(); + } + let elapsed = t.elapsed().as_micros(); + println!("{} us", elapsed as f32 / times as f32); + } } diff --git a/luisa_compute_sys/LuisaCompute b/luisa_compute_sys/LuisaCompute index ea04b92..b81ab1b 160000 --- a/luisa_compute_sys/LuisaCompute +++ b/luisa_compute_sys/LuisaCompute @@ -1 +1 @@ -Subproject commit ea04b924b4686850d1100358685ee592744c7163 +Subproject commit b81ab1b10ba323622f3540bd5d313318e5f7fb4a