@@ -452,7 +452,7 @@ def __cuda_stream__(self) -> tuple[int, int]:
452452 def _get_conditional_context (self ) -> driver .CUcontext :
453453 return self ._mnff .stream .context ._handle
454454
455- def create_conditional_handle (self , default_value = None ) -> int :
455+ def create_conditional_handle (self , default_value = None ) -> driver . CUgraphConditionalHandle :
456456 """Creates a conditional handle for the graph builder.
457457
458458 Parameters
@@ -462,7 +462,7 @@ def create_conditional_handle(self, default_value=None) -> int:
462462
463463 Returns
464464 -------
465- handle : int
465+ handle : driver.CUgraphConditionalHandle
466466 The newly created conditional handle.
467467
468468 """
@@ -480,10 +480,8 @@ def create_conditional_handle(self, default_value=None) -> int:
480480 if status != driver .CUstreamCaptureStatus .CU_STREAM_CAPTURE_STATUS_ACTIVE :
481481 raise RuntimeError ("Cannot create a conditional handle when graph is not being built" )
482482
483- return int (
484- handle_return (
485- driver .cuGraphConditionalHandleCreate (graph , self ._get_conditional_context (), default_value , flags )
486- )
483+ return handle_return (
484+ driver .cuGraphConditionalHandleCreate (graph , self ._get_conditional_context (), default_value , flags )
487485 )
488486
489487 def _cond_with_params (self , node_params ) -> GraphBuilder :
@@ -520,7 +518,7 @@ def _cond_with_params(self, node_params) -> GraphBuilder:
520518 ]
521519 )
522520
523- def if_cond (self , handle : int ) -> GraphBuilder :
521+ def if_cond (self , handle : driver . CUgraphConditionalHandle ) -> GraphBuilder :
524522 """Adds an if condition branch and returns a new graph builder for it.
525523
526524 The resulting if graph will only execute the branch if the conditional
@@ -530,7 +528,7 @@ def if_cond(self, handle: int) -> GraphBuilder:
530528
531529 Parameters
532530 ----------
533- handle : int
531+ handle : driver.CUgraphConditionalHandle
534532 The handle to use for the if conditional.
535533
536534 Returns
@@ -551,7 +549,7 @@ def if_cond(self, handle: int) -> GraphBuilder:
551549 node_params .conditional .ctx = self ._get_conditional_context ()
552550 return self ._cond_with_params (node_params )[0 ]
553551
554- def if_else (self , handle : int ) -> tuple [GraphBuilder , GraphBuilder ]:
552+ def if_else (self , handle : driver . CUgraphConditionalHandle ) -> tuple [GraphBuilder , GraphBuilder ]:
555553 """Adds an if-else condition branch and returns new graph builders for both branches.
556554
557555 The resulting if graph will execute the branch if the conditional handle
@@ -561,7 +559,7 @@ def if_else(self, handle: int) -> tuple[GraphBuilder, GraphBuilder]:
561559
562560 Parameters
563561 ----------
564- handle : int
562+ handle : driver.CUgraphConditionalHandle
565563 The handle to use for the if-else conditional.
566564
567565 Returns
@@ -582,7 +580,7 @@ def if_else(self, handle: int) -> tuple[GraphBuilder, GraphBuilder]:
582580 node_params .conditional .ctx = self ._get_conditional_context ()
583581 return self ._cond_with_params (node_params )
584582
585- def switch (self , handle : int , count : int ) -> tuple [GraphBuilder , ...]:
583+ def switch (self , handle : driver . CUgraphConditionalHandle , count : int ) -> tuple [GraphBuilder , ...]:
586584 """Adds a switch condition branch and returns new graph builders for all cases.
587585
588586 The resulting switch graph will execute the branch that matches the
@@ -593,7 +591,7 @@ def switch(self, handle: int, count: int) -> tuple[GraphBuilder, ...]:
593591
594592 Parameters
595593 ----------
596- handle : int
594+ handle : driver.CUgraphConditionalHandle
597595 The handle to use for the switch conditional.
598596 count : int
599597 The number of cases to add to the switch conditional.
@@ -616,7 +614,7 @@ def switch(self, handle: int, count: int) -> tuple[GraphBuilder, ...]:
616614 node_params .conditional .ctx = self ._get_conditional_context ()
617615 return self ._cond_with_params (node_params )
618616
619- def while_loop (self , handle : int ) -> GraphBuilder :
617+ def while_loop (self , handle : driver . CUgraphConditionalHandle ) -> GraphBuilder :
620618 """Adds a while loop and returns a new graph builder for it.
621619
622620 The resulting while loop graph will execute the branch repeatedly at runtime
@@ -626,7 +624,7 @@ def while_loop(self, handle: int) -> GraphBuilder:
626624
627625 Parameters
628626 ----------
629- handle : int
627+ handle : driver.CUgraphConditionalHandle
630628 The handle to use for the while loop.
631629
632630 Returns
0 commit comments