File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ where
105105 |b, array| {
106106 b. iter_custom ( |iters| {
107107 let timed = TimedLaunchStrategy :: default ( ) ;
108- let timer = Arc :: clone ( & timed. total_time_ns ) ;
108+ let timer = timed. timer ( ) ;
109109
110110 let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
111111 . vortex_expect ( "failed to create execution context" )
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ where
119119 |b, array| {
120120 b. iter_custom ( |iters| {
121121 let timed = TimedLaunchStrategy :: default ( ) ;
122- let timer = Arc :: clone ( & timed. total_time_ns ) ;
122+ let timer = timed. timer ( ) ;
123123
124124 let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
125125 . vortex_expect ( "failed to create execution context" )
@@ -164,7 +164,7 @@ where
164164 |b, array| {
165165 b. iter_custom ( |iters| {
166166 let timed = TimedLaunchStrategy :: default ( ) ;
167- let timer = Arc :: clone ( & timed. total_time_ns ) ;
167+ let timer = timed. timer ( ) ;
168168
169169 let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
170170 . vortex_expect ( "failed to create execution context" )
Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ pub struct TimedLaunchStrategy {
1616 pub total_time_ns : Arc < AtomicU64 > ,
1717}
1818
19+ impl TimedLaunchStrategy {
20+ /// Returns a shared handle to the accumulated kernel time, for reading after launches complete.
21+ pub fn timer ( & self ) -> Arc < AtomicU64 > {
22+ Arc :: clone ( & self . total_time_ns )
23+ }
24+ }
25+
1926impl LaunchStrategy for TimedLaunchStrategy {
2027 fn event_flags ( & self ) -> CUevent_flags {
2128 // using blocking_sync to make sure all events flush before we complete.
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ fn benchmark_datetimeparts(c: &mut Criterion) {
6464 |b, dtp_array| {
6565 b. iter_custom ( |iters| {
6666 let timed = TimedLaunchStrategy :: default ( ) ;
67- let timer = Arc :: clone ( & timed. total_time_ns ) ;
67+ let timer = timed. timer ( ) ;
6868
6969 let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
7070 . vortex_expect ( "failed to create execution context" )
Original file line number Diff line number Diff line change 9292 |b, dict_array| {
9393 b. iter_custom ( |iters| {
9494 let timed = TimedLaunchStrategy :: default ( ) ;
95- let timer = Arc :: clone ( & timed. total_time_ns ) ;
95+ let timer = timed. timer ( ) ;
9696
9797 let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
9898 . vortex_expect ( "failed to create execution context" )
Original file line number Diff line number Diff line change 8383 |b, for_array| {
8484 b. iter_custom ( |iters| {
8585 let timed = TimedLaunchStrategy :: default ( ) ;
86- let timer = Arc :: clone ( & timed. total_time_ns ) ;
86+ let timer = timed. timer ( ) ;
8787
8888 let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
8989 . vortex_expect ( "failed to create execution context" )
@@ -121,7 +121,7 @@ where
121121 |b, for_array| {
122122 b. iter_custom ( |iters| {
123123 let timed = TimedLaunchStrategy :: default ( ) ;
124- let timer = Arc :: clone ( & timed. total_time_ns ) ;
124+ let timer = timed. timer ( ) ;
125125
126126 let mut cuda_ctx = CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
127127 . vortex_expect ( "failed to create execution context" )
Original file line number Diff line number Diff line change 7777 |b, runend_array| {
7878 b. iter_custom ( |iters| {
7979 let timed = TimedLaunchStrategy :: default ( ) ;
80- let timer = Arc :: clone ( & timed. total_time_ns ) ;
80+ let timer = timed. timer ( ) ;
8181
8282 let mut cuda_ctx =
8383 CudaSession :: create_execution_ctx ( & VortexSession :: empty ( ) )
You can’t perform that action at this time.
0 commit comments