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

Method check_deps_are_valid

crates/cust/src/graph.rs:264–282  ·  view source on GitHub ↗
(&mut self, func_name: &str, nodes: &[GraphNode])

Source from the content-addressed store, hash-verified

262
263impl Graph {
264 fn check_deps_are_valid(&mut self, func_name: &str, nodes: &[GraphNode]) -> CudaResult<()> {
265 // per the docs, nodes must be valid AND not duplicate.
266 for (idx, node) in nodes.iter().enumerate() {
267 if let Some(pos) = nodes
268 .iter()
269 .enumerate()
270 .position(|(cur_idx, x)| x == node && cur_idx != idx)
271 {
272 panic!("Duplicate dependency found in call to `{}`, the first instance is at index {}, the second instance is at index {}", func_name, idx, pos);
273 }
274
275 assert!(
276 self.is_valid_node(*node)?,
277 "Invalid (dropped or from another graph) node was given to `{}`",
278 func_name
279 );
280 }
281 Ok(())
282 }
283
284 /// Check if a node is valid in this graph.
285 pub fn is_valid_node(&mut self, node: GraphNode) -> CudaResult<bool> {

Callers 3

add_kernel_nodeMethod · 0.80
node_typeMethod · 0.80
kernel_node_paramsMethod · 0.80

Calls 1

iterMethod · 0.80

Tested by

no test coverage detected