MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / add_kernel_node

Method add_kernel_node

crates/cust/src/graph.rs:375–398  ·  view source on GitHub ↗

Adds a kernel invocation node to this graph, [`KernelInvocation`] can be created using [`kernel_invocation`] which uses the same syntax as [`launch`](crate::launch). This will place the node after its dependencies (which will execute before it).

(
        &mut self,
        invocation: KernelInvocation,
        dependencies: impl AsRef<[GraphNode]>,
    )

Source from the content-addressed store, hash-verified

373 /// [`kernel_invocation`] which uses the same syntax as [`launch`](crate::launch). This will
374 /// place the node after its dependencies (which will execute before it).
375 pub fn add_kernel_node(
376 &mut self,
377 invocation: KernelInvocation,
378 dependencies: impl AsRef<[GraphNode]>,
379 ) -> CudaResult<GraphNode> {
380 let deps = dependencies.as_ref();
381 self.check_deps_are_valid("add_kernel_node", deps)?;
382 // invalidate cache because it will change.
383 self.node_cache = None;
384 unsafe {
385 let deps_ptr = deps.as_ptr().cast();
386 let mut node = MaybeUninit::<GraphNode>::uninit();
387 let params = invocation.to_raw();
388 cuda::cuGraphAddKernelNode(
389 node.as_mut_ptr().cast(),
390 self.raw,
391 deps_ptr,
392 deps.len(),
393 &params as *const _,
394 )
395 .to_result()?;
396 Ok(node.assume_init())
397 }
398 }
399
400 /// The number of edges (dependency edges) inside this graph.
401 pub fn num_edges(&mut self) -> CudaResult<usize> {

Callers

nothing calls this directly

Calls 8

check_deps_are_validMethod · 0.80
as_ptrMethod · 0.80
as_refMethod · 0.45
castMethod · 0.45
to_rawMethod · 0.45
to_resultMethod · 0.45
as_mut_ptrMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected