cuda::experimental::conditional_handle#
-
struct conditional_handle#
A thin, non-owning wrapper around a
cudaGraphConditionalHandle.A conditional handle is a graph-scoped token whose value at runtime controls whether the body of an
iforwhileconditional node executes. The handle is owned by the graph — there is no destroy API — so this wrapper is trivially copyable and safe to pass by value into device kernels.Users can construct a handle directly, or let
make_if_node/make_while_nodecreate one automatically.Public Functions
- inline explicit conditional_handle(
- graph_builder_ref __graph,
- bool __default_val = true
Creates a conditional handle for the given graph.
- Parameters:
__graph – Graph in which the conditional node will be inserted.
__default_val – Initial value of the handle (true = execute body, false = skip).
- Throws:
cuda::std::cuda_error – if
cudaGraphConditionalHandleCreatefails.
-
inline void set_value(bool __value) const noexcept#
Sets the runtime value of the conditional handle from device code.
- Parameters:
__value – Non-zero to execute the body, zero to skip.
-
inline void enable() const noexcept#
Convenience: enables execution of the conditional body (sets the handle to 1).
-
inline void disable() const noexcept#
Convenience: disables execution of the conditional body (sets the handle to 0).
-
inline ::cudaGraphConditionalHandle get() const noexcept#
Returns the underlying
cudaGraphConditionalHandle.