singe_cuda/stream/capture.rs
1use std::{
2 cell::RefCell, collections::HashMap, hash::Hash, marker::PhantomData, mem, panic, ptr,
3 sync::Arc,
4};
5
6use num_enum::{IntoPrimitive, TryFromPrimitive};
7use singe_core::{impl_enum_display, report_cleanup_failure};
8use singe_cuda_sys::runtime;
9
10use super::{AsStream, Stream};
11use crate::{
12 error::{Error, Result},
13 graph::{ExecutableGraph, Graph, GraphDependency, GraphInstantiateFlags},
14 module::{CodeOwnerId, Module},
15 try_ffi,
16};
17
18singe_core::native_enum! {
19 /// State of a CUDA stream capture sequence.
20 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
21 #[repr(u32)]
22 #[non_exhaustive]
23 pub enum StreamCaptureStatus: runtime::cudaStreamCaptureStatus {
24 /// The stream is not capturing.
25 None = CU_STREAM_CAPTURE_STATUS_NONE,
26 /// The stream is recording work into a graph.
27 Active = CU_STREAM_CAPTURE_STATUS_ACTIVE,
28 /// A capture rule was violated.
29 /// End capture on the initiating stream before reusing it.
30 Invalidated = CU_STREAM_CAPTURE_STATUS_INVALIDATED,
31 }
32}
33
34singe_core::native_enum! {
35 /// Scope of CUDA's checks for potentially unsafe calls during stream capture.
36 ///
37 /// Calls that necessarily conflict with capture remain prohibited in every mode.
38 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
39 #[repr(u32)]
40 #[non_exhaustive]
41 pub enum StreamCaptureMode: runtime::cudaStreamCaptureMode {
42 /// Checks the local capture sequence and concurrent captures begun in global mode on other host threads.
43 Global = CU_STREAM_CAPTURE_MODE_GLOBAL,
44 /// Checks the local capture sequence without considering captures on other host threads.
45 ThreadLocal = CU_STREAM_CAPTURE_MODE_THREAD_LOCAL,
46 /// Allows potentially unsafe CUDA calls while preserving restrictions on calls that necessarily conflict with capture.
47 Relaxed = CU_STREAM_CAPTURE_MODE_RELAXED,
48 }
49}
50
51singe_core::native_enum! {
52 /// Flags for [`Stream::update_capture_dependencies`]
53 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
54 #[repr(u32)]
55 #[non_exhaustive]
56 pub enum StreamCaptureDependencyUpdate: runtime::cudaStreamUpdateCaptureDependenciesFlags {
57 /// Add new nodes to the dependency set.
58 Add = cudaStreamAddCaptureDependencies,
59 /// Replace the dependency set with the new nodes.
60 Set = cudaStreamSetCaptureDependencies,
61 }
62}
63
64/// Capture status and the native ID of an active capture sequence.
65#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
66pub struct StreamCaptureInfo {
67 /// Current capture status of the queried stream.
68 pub status: StreamCaptureStatus,
69 /// Native capture sequence ID.
70 /// Meaningful only when `status` is [`StreamCaptureStatus::Active`].
71 pub id: u64,
72}
73
74/// An active stream capture and the kernel-code owners retained by recorded operations.
75///
76/// Constructed by [`Stream::capture`].
77/// Recording does not execute producers or initialize their outputs.
78#[derive(Debug)]
79pub struct StreamCaptureScope<'scope> {
80 stream: &'scope Stream,
81 modules: RefCell<HashMap<CodeOwnerId, Module>>,
82 _not_send: PhantomData<*const ()>,
83}
84
85struct ActiveStreamCapture<'stream> {
86 stream: &'stream Stream,
87 finished: bool,
88}
89
90impl ActiveStreamCapture<'_> {
91 fn finish(mut self) -> Result<Graph> {
92 self.finished = true;
93 self.stream.end_capture()
94 }
95
96 fn discard(mut self) {
97 self.finished = true;
98 if let Err(error) = self.stream.end_capture() {
99 report_cleanup_failure("end", "cuda stream capture", &error);
100 }
101 }
102}
103
104impl Drop for ActiveStreamCapture<'_> {
105 fn drop(&mut self) {
106 if !self.finished
107 && let Err(error) = self.stream.end_capture()
108 {
109 report_cleanup_failure("end", "cuda stream capture", &error);
110 }
111 }
112}
113
114impl Stream {
115 /// Begin graph capture on stream.
116 /// When a stream is in capture mode, operations pushed into the stream are captured into a graph instead of executed.
117 /// [`Stream::end_capture`] returns the graph.
118 /// Capture may not be initiated on the legacy default stream.
119 /// Capture must be ended on the same stream in which it was initiated, and it may only be initiated if the stream is not already in capture mode.
120 /// The capture mode may be queried via [`Stream::capture_status`].
121 /// A unique id representing the capture sequence may be queried via [`Stream::capture_info`].
122 ///
123 /// If mode is not [`StreamCaptureMode::Relaxed`], [`Stream::end_capture`] must be called on this stream from the same thread.
124 ///
125 /// Kernels captured using this API must not use texture and surface references.
126 /// Reading or writing through any texture or surface reference is undefined behavior.
127 /// This restriction does not apply to texture and surface objects.
128 ///
129 /// # Errors
130 ///
131 /// Returns an error if the context cannot be bound, capture cannot begin on this stream, the capture mode is invalid for the current thread state, or a previous asynchronous launch reports an error.
132 pub fn begin_capture(&self, mode: StreamCaptureMode) -> Result<()> {
133 let _lifecycle = self.allocation_guard()?;
134 self.inner.context.bind()?;
135 // SAFETY: `self.as_raw()` is the live stream this wrapper retains, in the context bound above, and the lifecycle guard excludes concurrent deferred frees.
136 unsafe {
137 try_ffi!(runtime::cudaStreamBeginCapture(self.as_raw(), mode.into()))?;
138 }
139 Ok(())
140 }
141
142 /// Begin graph capture on stream.
143 /// When a stream is in capture mode, operations pushed into the stream are captured into a graph instead of executed.
144 /// [`Stream::end_capture`] returns the graph.
145 ///
146 /// Capture may not be initiated on the legacy default stream.
147 /// Capture must be ended on the same stream in which it was initiated, and it may only be initiated if the stream is not already in capture mode.
148 /// The capture mode may be queried via [`Stream::capture_status`].
149 /// A unique id representing the capture sequence may be queried via [`Stream::capture_info`].
150 ///
151 /// If mode is not [`StreamCaptureMode::Relaxed`], [`Stream::end_capture`] must be called on this stream from the same thread.
152 ///
153 /// Kernels captured using this API must not use texture and surface references.
154 /// Reading or writing through any texture or surface reference is undefined behavior.
155 /// This restriction does not apply to texture and surface objects.
156 ///
157 /// # Safety
158 ///
159 /// This captures into `graph`'s existing CUDA handle.
160 /// Calling [`Stream::end_capture`] after this may return that same raw handle; the caller must not wrap it as a second owned [`Graph`].
161 ///
162 /// # Errors
163 ///
164 /// Returns an error if the context cannot be bound, capture cannot begin on this stream, the graph dependencies are invalid, the capture mode is invalid for the current thread state, or a previous asynchronous launch reports an error.
165 pub unsafe fn begin_capture_to_graph(
166 &self,
167 graph: &Graph,
168 dependencies: &[GraphDependency],
169 mode: StreamCaptureMode,
170 ) -> Result<()> {
171 let _lifecycle = self.allocation_guard()?;
172 self.check_graph_context(graph)?;
173 self.check_capture_dependency_contexts(dependencies)?;
174 Self::check_capture_graph_dependencies(graph, dependencies)?;
175 self.inner.context.bind()?;
176
177 let dependencies_raw: Vec<_> = dependencies
178 .iter()
179 .map(|dependency| dependency.node.as_raw())
180 .collect();
181 let edge_data_raw: Vec<_> = dependencies
182 .iter()
183 .map(|dependency| dependency.data.into())
184 .collect();
185 let count = dependencies_raw
186 .len()
187 .try_into()
188 .map_err(|_| Error::out_of_range("capture dependency count"))?;
189 // SAFETY: the stream and graph are live in the context bound above, both dependency arrays are locals of `count` entries or null edge data, and the nodes belong to `graph` as checked above.
190 unsafe {
191 try_ffi!(runtime::cudaStreamBeginCaptureToGraph(
192 self.as_raw(),
193 graph.as_raw(),
194 dependencies_raw.as_ptr(),
195 if edge_data_raw.is_empty() {
196 ptr::null()
197 } else {
198 edge_data_raw.as_ptr()
199 },
200 count,
201 mode.into(),
202 ))?;
203 }
204 Ok(())
205 }
206
207 /// Ends capture on this stream, returning the captured graph.
208 /// Capture must have been initiated on stream via a call to [`Stream::begin_capture`].
209 /// If capture was invalidated due to a violation of the rules of stream capture, an error is returned.
210 ///
211 /// If the mode argument to [`Stream::begin_capture`] was not [`StreamCaptureMode::Relaxed`], this call must be from the same thread as [`Stream::begin_capture`].
212 ///
213 /// # Errors
214 ///
215 /// Returns an error if the context cannot be bound, capture is not active on this stream, the capture has been invalidated, or a previous asynchronous launch reports an error.
216 pub fn end_capture(&self) -> Result<Graph> {
217 self.inner.context.bind()?;
218 let mut handle = ptr::null_mut();
219 let mut cleanup = self.capture_cleanup_lock()?;
220 // SAFETY: `self.as_raw()` is the live stream this wrapper retains, in the context bound above, and `handle` is a writable local.
221 let result = unsafe {
222 try_ffi!(runtime::cudaStreamEndCapture(
223 self.as_raw(),
224 &raw mut handle
225 ))
226 };
227 // Invalidated captures also end the lifecycle; failed frees remain queued.
228 let ended =
229 result.is_ok() || matches!(self.capture_status(), Ok(StreamCaptureStatus::None));
230 let (released, cleanup_result) = if ended {
231 (
232 mem::take(&mut cleanup.owners),
233 cleanup.flush_frees(self.as_raw()),
234 )
235 } else {
236 (Vec::new(), Ok(()))
237 };
238 drop(cleanup);
239 drop(released);
240 result?;
241 // SAFETY: CUDA returned this graph for the context that the new value retains.
242 let graph = unsafe { Graph::from_raw_in_context(handle, Arc::clone(&self.inner.context)) }?;
243 cleanup_result?;
244 Ok(graph)
245 }
246
247 /// Captures stream work recorded by `f` into a CUDA graph.
248 ///
249 /// This is the scoped form of [`Stream::begin_capture`] and [`Stream::end_capture`].
250 /// This method attempts to end capture before it returns or resumes a panic.
251 /// If `f` returns an error, this method attempts to end capture to restore stream usability, destroys any graph returned by CUDA, and returns the closure error.
252 ///
253 /// The scope is `!Send`, so it cannot move to another thread while capture is active.
254 /// It retains recorded kernel-code owners in the returned graph.
255 ///
256 /// # Errors
257 ///
258 /// Returns an error if capture cannot begin, if `f` returns an error, or if capture cannot be ended successfully.
259 pub fn capture<F>(&self, mode: StreamCaptureMode, f: F) -> Result<Graph>
260 where
261 F: FnOnce(&StreamCaptureScope<'_>) -> Result<()>,
262 {
263 self.begin_capture(mode)?;
264 let capture = ActiveStreamCapture {
265 stream: self,
266 finished: false,
267 };
268
269 let scope = StreamCaptureScope {
270 stream: self,
271 modules: RefCell::new(HashMap::new()),
272 _not_send: PhantomData,
273 };
274
275 let capture_result = panic::catch_unwind(panic::AssertUnwindSafe(|| f(&scope)));
276 match capture_result {
277 Ok(Ok(())) => {
278 let graph = capture.finish()?;
279 for module in scope.modules.into_inner().into_values() {
280 graph.retain_module(&module)?;
281 }
282 Ok(graph)
283 }
284 Ok(Err(error)) => {
285 capture.discard();
286 Err(error)
287 }
288 Err(payload) => {
289 drop(capture);
290 panic::resume_unwind(payload);
291 }
292 }
293 }
294
295 /// Captures work recorded by `f` and instantiates the resulting graph with `flags`.
296 ///
297 /// Recorded kernel-code owners are retained by the executable.
298 ///
299 /// # Errors
300 ///
301 /// Propagates capture setup, closure, capture finalization, and graph-instantiation errors, including unsupported flags or invalid captured nodes.
302 pub fn capture_executable<F>(
303 &self,
304 mode: StreamCaptureMode,
305 flags: GraphInstantiateFlags,
306 f: F,
307 ) -> Result<ExecutableGraph>
308 where
309 F: FnOnce(&StreamCaptureScope<'_>) -> Result<()>,
310 {
311 let graph = self.capture(mode, f)?;
312 graph.instantiate(flags)
313 }
314
315 /// Returns the capture status of this stream.
316 /// After a successful call, the status is one of the following:
317 ///
318 /// * [`StreamCaptureStatus::None`]: The stream is not capturing.
319 /// * [`StreamCaptureStatus::Active`]: The stream is capturing.
320 /// * [`StreamCaptureStatus::Invalidated`]: The stream was capturing but an error has invalidated the capture sequence.
321 /// The capture sequence must be terminated with [`Stream::end_capture`] on the stream where it was initiated to continue using the stream.
322 ///
323 /// If this is called on the legacy default stream while a blocking stream on the same device is capturing, it returns [`crate::error::Status::StreamCaptureImplicit`].
324 /// The blocking stream capture is not invalidated.
325 ///
326 /// When a blocking stream is capturing, the legacy stream is in an unusable state until the blocking stream capture is terminated.
327 /// The legacy stream is not supported for stream capture, but attempted use would have an implicit dependency on the capturing stream(s).
328 ///
329 /// # Errors
330 ///
331 /// Returns an error if the context cannot be bound, CUDA cannot query the capture status, or a previous asynchronous launch reports an error.
332 pub fn capture_status(&self) -> Result<StreamCaptureStatus> {
333 AsStream::capture_status(self)
334 }
335
336 /// Query stream state related to stream capture.
337 ///
338 /// If called on the legacy default stream while a stream not created with [`StreamFlags::NON_BLOCKING`](super::StreamFlags::NON_BLOCKING) is capturing, returns [`crate::error::Status::StreamCaptureImplicit`].
339 ///
340 /// Valid data (other than capture status) is returned only if both of the following are true:
341 ///
342 /// * the call succeeds
343 /// * the returned capture status is [`StreamCaptureStatus::Active`]
344 ///
345 /// If there is non-zero edge data for one or more current stream dependencies and the query cannot return that data, the call returns [`crate::error::Status::LossyQuery`].
346 ///
347 /// # Errors
348 ///
349 /// Returns an error if the context cannot be bound, CUDA cannot query the capture info, the query would lose non-zero edge data, or a previous asynchronous launch reports an error.
350 pub fn capture_info(&self) -> Result<StreamCaptureInfo> {
351 self.inner.context.bind()?;
352 let mut status = runtime::cudaStreamCaptureStatus::CU_STREAM_CAPTURE_STATUS_NONE;
353 let mut id = 0;
354 // SAFETY: `self.as_raw()` is the live stream this wrapper retains, in the context bound above, `status` and `id` are writable locals, and the other outputs are null.
355 unsafe {
356 try_ffi!(runtime::cudaStreamGetCaptureInfo(
357 self.as_raw(),
358 &raw mut status,
359 &raw mut id,
360 ptr::null_mut(),
361 ptr::null_mut(),
362 ptr::null_mut(),
363 ptr::null_mut(),
364 ))?;
365 }
366 Ok(StreamCaptureInfo {
367 status: status.try_into()?,
368 id,
369 })
370 }
371
372 /// Modifies the dependency set of a capturing stream.
373 /// The dependency set is the set of nodes that the next captured node in the stream will depend on.
374 ///
375 /// `mode` is [`StreamCaptureDependencyUpdate::Add`] to add the supplied set to the existing set, or [`StreamCaptureDependencyUpdate::Set`] to replace it.
376 ///
377 /// Nodes that are removed from the dependency set by this call do not result in [`crate::error::Status::StreamCaptureUnjoined`] if they are unreachable from the stream at [`Stream::end_capture`].
378 ///
379 /// Returns [`crate::error::Status::IllegalState`] if the stream is not capturing.
380 ///
381 /// # Errors
382 ///
383 /// Returns an error if the context cannot be bound, the stream is not capturing, the supplied dependencies are invalid, or a previous asynchronous launch reports an error.
384 pub fn update_capture_dependencies(
385 &self,
386 dependencies: &[GraphDependency],
387 mode: StreamCaptureDependencyUpdate,
388 ) -> Result<()> {
389 self.check_capture_dependency_contexts(dependencies)?;
390 self.check_active_capture_graph_dependencies(dependencies)?;
391 self.inner.context.bind()?;
392
393 let mut dependencies_raw: Vec<_> = dependencies
394 .iter()
395 .map(|dependency| dependency.node.as_raw())
396 .collect();
397 let edge_data_raw: Vec<_> = dependencies
398 .iter()
399 .map(|dependency| dependency.data.into())
400 .collect();
401 let count = dependencies_raw
402 .len()
403 .try_into()
404 .map_err(|_| Error::out_of_range("capture dependency count"))?;
405 // SAFETY: the stream is live in the context bound above, both dependency arrays are locals of `count` entries or null edge data, and the nodes belong to the active capture graph as checked above.
406 unsafe {
407 try_ffi!(runtime::cudaStreamUpdateCaptureDependencies(
408 self.as_raw(),
409 dependencies_raw.as_mut_ptr(),
410 if edge_data_raw.is_empty() {
411 ptr::null()
412 } else {
413 edge_data_raw.as_ptr()
414 },
415 count,
416 mode.into(),
417 ))?;
418 }
419 Ok(())
420 }
421}
422
423impl Stream {
424 fn check_graph_context(&self, graph: &Graph) -> Result<()> {
425 if graph.context() != &self.inner.context {
426 return Err(Error::context_mismatch("graph"));
427 }
428 Ok(())
429 }
430
431 fn check_capture_dependency_contexts(&self, dependencies: &[GraphDependency]) -> Result<()> {
432 for dependency in dependencies {
433 if matches!(dependency.node.context(), Some(context) if context != &self.inner.context)
434 {
435 return Err(Error::context_mismatch("graph dependency"));
436 }
437 }
438 Ok(())
439 }
440
441 fn check_capture_graph_dependencies(
442 graph: &Graph,
443 dependencies: &[GraphDependency],
444 ) -> Result<()> {
445 for dependency in dependencies {
446 graph.check_node(&dependency.node)?;
447 }
448 Ok(())
449 }
450
451 fn check_active_capture_graph_dependencies(
452 &self,
453 dependencies: &[GraphDependency],
454 ) -> Result<()> {
455 if dependencies.is_empty() {
456 return Ok(());
457 }
458
459 self.inner.context.bind()?;
460 let mut status = runtime::cudaStreamCaptureStatus::CU_STREAM_CAPTURE_STATUS_NONE;
461 let mut graph = ptr::null_mut();
462 // SAFETY: `self.as_raw()` is the live stream this wrapper retains, in the context bound above, `status` and `graph` are writable locals, and the other outputs are null.
463 unsafe {
464 try_ffi!(runtime::cudaStreamGetCaptureInfo(
465 self.as_raw(),
466 &raw mut status,
467 ptr::null_mut(),
468 &raw mut graph,
469 ptr::null_mut(),
470 ptr::null_mut(),
471 ptr::null_mut(),
472 ))?;
473 }
474
475 if StreamCaptureStatus::try_from(status)? != StreamCaptureStatus::Active {
476 return Ok(());
477 }
478
479 if graph.is_null() {
480 return Err(Error::NullHandle);
481 }
482
483 for dependency in dependencies {
484 if !matches!(dependency.node.graph_raw(), Some(node_graph) if node_graph == graph) {
485 return Err(Error::GraphNodeMismatch);
486 }
487 }
488 Ok(())
489 }
490
491 /// Rejects active or invalidated capture before an operation that cannot be recorded.
492 ///
493 /// Call this before synchronous work or ordinary allocation so a rejected operation does not first change the capturing stream's state.
494 ///
495 /// # Errors
496 ///
497 /// Returns the native stream-capture-unsupported status for active capture or the stream-capture-invalidated status for invalidated capture.
498 /// Also propagates capture-state query and context binding errors.
499 pub fn ensure_not_capturing(&self) -> Result<()> {
500 AsStream::ensure_not_capturing(self)
501 }
502}
503
504impl<'scope> StreamCaptureScope<'scope> {
505 pub(crate) fn retain_module(&self, module: &Module) {
506 self.modules
507 .borrow_mut()
508 .entry(module.code_owner_id())
509 .or_insert_with(|| module.clone());
510 }
511
512 /// Returns the stream currently being captured.
513 pub const fn stream(&self) -> &'scope Stream {
514 self.stream
515 }
516}
517
518/// Sets the calling thread's stream capture interaction mode, returning the previous mode for the thread.
519/// To facilitate deterministic behavior across function or module boundaries, use this in a push-pop fashion.
520///
521/// During stream capture (see [`Stream::begin_capture`]), some actions, such as a call to [`DeviceMemory::alloc`](crate::memory::DeviceMemory::alloc), may be unsafe.
522/// In the case of [`DeviceMemory::alloc`](crate::memory::DeviceMemory::alloc), the operation is not enqueued asynchronously to a stream, and is not observed by stream capture.
523/// If the sequence of operations captured via [`Stream::begin_capture`] depended on the allocation being replayed whenever the graph is launched, the captured graph would be invalid.
524///
525/// Therefore, stream capture places restrictions on CUDA calls that can be made within or concurrently to a [`Stream::begin_capture`]-[`Stream::end_capture`] sequence.
526/// Control this behavior with this function and flags to [`Stream::begin_capture`].
527///
528/// A thread's mode is one of the following:
529///
530/// * [`StreamCaptureMode::Global`]: default mode.
531/// If the local thread has an ongoing capture sequence that was not initiated with [`StreamCaptureMode::Relaxed`] at [`Stream::begin_capture`], or if any other thread has a concurrent capture sequence initiated with [`StreamCaptureMode::Global`], this thread is prohibited from potentially unsafe CUDA calls.
532/// * [`StreamCaptureMode::ThreadLocal`]: If the local thread has an ongoing capture sequence not initiated with [`StreamCaptureMode::Relaxed`], it is prohibited from potentially unsafe CUDA calls.
533/// Concurrent capture sequences in other threads are ignored.
534/// * [`StreamCaptureMode::Relaxed`]: The local thread is not prohibited from potentially unsafe CUDA calls.
535/// The thread is still prohibited from CUDA calls which necessarily conflict with stream capture, for example, attempting [`Event::query`](crate::event::Event::query) on an event that was last recorded inside a capture sequence.
536///
537/// # Errors
538///
539/// Returns an error if CUDA rejects the capture-mode exchange or if a previous asynchronous launch reported an error.
540pub fn exchange_capture_mode(mode: StreamCaptureMode) -> Result<StreamCaptureMode> {
541 let mut mode_raw: runtime::cudaStreamCaptureMode = mode.into();
542 // SAFETY: `mode_raw` is a local that CUDA reads and overwrites through an exclusive pointer.
543 unsafe {
544 try_ffi!(runtime::cudaThreadExchangeStreamCaptureMode(
545 &raw mut mode_raw
546 ))?;
547 }
548 Ok(mode_raw.try_into()?)
549}
550
551impl_enum_display!(StreamCaptureStatus, {
552 StreamCaptureStatus::None => "CU_STREAM_CAPTURE_STATUS_NONE",
553 StreamCaptureStatus::Active => "CU_STREAM_CAPTURE_STATUS_ACTIVE",
554 StreamCaptureStatus::Invalidated => "CU_STREAM_CAPTURE_STATUS_INVALIDATED",
555});
556
557impl_enum_display!(StreamCaptureMode, {
558 StreamCaptureMode::Global => "CU_STREAM_CAPTURE_MODE_GLOBAL",
559 StreamCaptureMode::ThreadLocal => "CU_STREAM_CAPTURE_MODE_THREAD_LOCAL",
560 StreamCaptureMode::Relaxed => "CU_STREAM_CAPTURE_MODE_RELAXED",
561});
562
563impl_enum_display!(StreamCaptureDependencyUpdate, {
564 StreamCaptureDependencyUpdate::Add => "cudaStreamAddCaptureDependencies",
565 StreamCaptureDependencyUpdate::Set => "cudaStreamSetCaptureDependencies",
566});