Table of Contents

Class CudaGraphExec

Namespace
JYPPX.CudaSharp
Assembly
JYPPX.CudaSharp.dll

Managed wrapper around an executable CUDA graph. 可执行 CUDA graph 的托管封装。

public sealed class CudaGraphExec : IDisposable
Inheritance
CudaGraphExec
Implements
Inherited Members

Properties

Flags

Gets graph executable flags when supported by the CUDA runtime. 在 CUDA runtime 支持时获取 graph executable flags。

public ulong Flags { get; }

Property Value

ulong

Id

Gets the CUDA graph executable identifier when supported by the loaded CUDA runtime. 在当前 CUDA runtime 支持时获取 CUDA graph executable 标识符。

public uint Id { get; }

Property Value

uint

Methods

Dispose()

Releases the executable graph handle. 释放可执行 graph 句柄。

public void Dispose()

GetDiagnosticSnapshot(IReadOnlyList<CudaGraphNode>)

Gets copied executable-state snapshots for multiple graph nodes. 获取多个 graph node 的复制型 executable 状态快照。

public CudaGraphExecDiagnosticSnapshot GetDiagnosticSnapshot(IReadOnlyList<CudaGraphNode> nodes)

Parameters

nodes IReadOnlyList<CudaGraphNode>

The graph-owned node value tokens. graph 拥有的 node 值 token。

Returns

CudaGraphExecDiagnosticSnapshot

A copied executable diagnostic snapshot. 复制型 executable 诊断快照。

GetNodeEnabled(CudaGraphNode)

Gets whether a node is enabled in this executable graph. 获取 executable graph 中某个节点是否启用。

public bool GetNodeEnabled(CudaGraphNode node)

Parameters

node CudaGraphNode

A node token owned by the source graph. 源 graph 拥有的节点 token。

Returns

bool

True when the node is enabled. 节点启用时返回 true。

GetNodeStateSnapshot(CudaGraphNode)

Gets a copied executable-state snapshot for a graph node. 获取 graph node 在当前 executable graph 中的复制型执行状态快照。

public CudaGraphExecNodeStateSnapshot GetNodeStateSnapshot(CudaGraphNode node)

Parameters

node CudaGraphNode

A node token owned by the source graph. 源 graph 拥有的节点 token。

Returns

CudaGraphExecNodeStateSnapshot

A snapshot containing node-enabled state and executable flags. 包含节点启用状态和 executable flags 的快照。

Remarks

The returned snapshot contains copied scalar values only and does not transfer ownership of the node token. 返回的快照仅包含复制出的标量值,不转移 node token 的所有权。

Launch(CudaStream)

Launches the executable graph on a CUDA stream. 在 CUDA stream 上启动当前可执行 graph。

public void Launch(CudaStream stream)

Parameters

stream CudaStream

The stream used for graph launch. 用于 graph 启动的 stream。

SetChildGraphNodeParameters(CudaGraphNode, CudaGraph)

Replaces the parameters of a child-graph node using a managed graph owner. 使用托管 graph owner 替换 child-graph 节点参数。

public void SetChildGraphNodeParameters(CudaGraphNode node, CudaGraph childGraph)

Parameters

node CudaGraphNode

A child-graph node token from the source graph. 源 graph 中的 child-graph 节点 token。

childGraph CudaGraph

The graph supplying replacement parameters. 提供替换参数的 graph。

SetDeviceToDeviceMemcpyNodeParameters(CudaGraphNode, CudaMemory, CudaMemory, int)

Updates an executable graph memcpy node for a 1D device-to-device copy. 将 executable graph 的 memcpy 节点更新为 1D device-to-device 复制。

public void SetDeviceToDeviceMemcpyNodeParameters(CudaGraphNode node, CudaMemory destination, CudaMemory source, int count)

Parameters

node CudaGraphNode

A memcpy node token owned by the source graph. 源 graph 拥有的 memcpy 节点 token。

destination CudaMemory

The destination device memory owner. 目标设备内存所有者。

source CudaMemory

The source device memory owner. 源设备内存所有者。

count int

The byte count to copy. 要复制的字节数。

Remarks

The memory owners must remain alive while this executable graph may use the updated node. 内存所有者必须在当前 executable graph 可能使用更新节点期间保持存活。

SetDeviceToHostMemcpyNodeParameters(CudaGraphNode, CudaPinnedMemory, CudaMemory, int)

Updates an executable graph memcpy node for a 1D device-to-pinned-host copy. 将 executable graph 的 memcpy 节点更新为 1D device-to-pinned-host 复制。

public void SetDeviceToHostMemcpyNodeParameters(CudaGraphNode node, CudaPinnedMemory destination, CudaMemory source, int count)

Parameters

node CudaGraphNode

A memcpy node token owned by the source graph. 源 graph 拥有的 memcpy 节点 token。

destination CudaPinnedMemory

The destination pinned host memory owner. 目标 pinned host memory 所有者。

source CudaMemory

The source device memory owner. 源设备内存所有者。

count int

The byte count to copy. 要复制的字节数。

Remarks

The memory owners must remain alive while this executable graph may use the updated node. 内存所有者必须在当前 executable graph 可能使用更新节点期间保持存活。

SetEventRecordNodeEvent(CudaGraphNode, CudaEvent)

Updates an executable graph event-record node to use a caller-owned CUDA event. 将 executable graph 的 event-record 节点更新为使用调用方拥有的 CUDA event。

public void SetEventRecordNodeEvent(CudaGraphNode node, CudaEvent eventHandle)

Parameters

node CudaGraphNode

A node token owned by the source graph. 源 graph 拥有的节点 token。

eventHandle CudaEvent

The caller-owned CUDA event. 调用方拥有的 CUDA event。

Remarks

The event must remain alive while this executable graph may use the updated node. 该 event 必须在当前 executable graph 可能使用更新节点期间保持存活。

SetEventWaitNodeEvent(CudaGraphNode, CudaEvent)

Updates an executable graph event-wait node to use a caller-owned CUDA event. 将 executable graph 的 event-wait 节点更新为使用调用方拥有的 CUDA event。

public void SetEventWaitNodeEvent(CudaGraphNode node, CudaEvent eventHandle)

Parameters

node CudaGraphNode

A node token owned by the source graph. 源 graph 拥有的节点 token。

eventHandle CudaEvent

The caller-owned CUDA event. 调用方拥有的 CUDA event。

Remarks

The event must remain alive while this executable graph may use the updated node. 该 event 必须在当前 executable graph 可能使用更新节点期间保持存活。

SetHostToDeviceMemcpyNodeParameters(CudaGraphNode, CudaMemory, CudaPinnedMemory, int)

Updates an executable graph memcpy node for a 1D pinned-host-to-device copy. 将 executable graph 的 memcpy 节点更新为 1D pinned-host-to-device 复制。

public void SetHostToDeviceMemcpyNodeParameters(CudaGraphNode node, CudaMemory destination, CudaPinnedMemory source, int count)

Parameters

node CudaGraphNode

A memcpy node token owned by the source graph. 源 graph 拥有的 memcpy 节点 token。

destination CudaMemory

The destination device memory owner. 目标设备内存所有者。

source CudaPinnedMemory

The source pinned host memory owner. 源 pinned host memory 所有者。

count int

The byte count to copy. 要复制的字节数。

Remarks

The memory owners must remain alive while this executable graph may use the updated node. 内存所有者必须在当前 executable graph 可能使用更新节点期间保持存活。

SetMemsetNodeParameters(CudaGraphNode, CudaMemory, byte, int)

Replaces a one-dimensional memset node using a managed device-memory owner. 使用托管设备内存 owner 替换一维 memset 节点参数。

public void SetMemsetNodeParameters(CudaGraphNode node, CudaMemory destination, byte value, int count)

Parameters

node CudaGraphNode
destination CudaMemory
value byte
count int

Remarks

The destination must remain alive while this executable graph may use the node. 当 executable graph 可能使用该节点时,destination 必须保持存活。

SetNodeEnabled(CudaGraphNode, bool)

Sets whether a node is enabled in this executable graph. 设置 executable graph 中某个节点是否启用。

public void SetNodeEnabled(CudaGraphNode node, bool enabled)

Parameters

node CudaGraphNode

A node token owned by the source graph. 源 graph 拥有的节点 token。

enabled bool

Whether the node should be enabled. 节点是否启用。

Update(CudaGraph)

Attempts to update this executable graph and returns copied result metadata. 尝试更新当前 executable graph,并返回复制出的结果元数据。

public CudaGraphExecUpdateSnapshot Update(CudaGraph graph)

Parameters

graph CudaGraph

The graph containing updated parameters. 包含更新参数的 graph。

Returns

CudaGraphExecUpdateSnapshot

A pointer-free update snapshot. 不含指针的更新快照。

Upload(CudaStream)

Uploads this executable graph to a CUDA stream before launch. 在 launch 前将当前可执行 graph 上传到 CUDA stream。

public void Upload(CudaStream stream)

Parameters

stream CudaStream

The stream used for graph upload. 用于 graph upload 的 stream。