+
    NåûjÖ	  ã                   ól   € R t ^ RIHtHtHtHtHtHt . ROt] F  t	R]
! 4       ]	,          n        K  	  A	R# )a×  Annotate kernels captured in CUDA graphs for profiler traces.

During CUDA graph capture, :func:`mark_kernels` tags the GPU work nodes
(kernels, memcpys, memsets) captured within its scope with user metadata.
The recorded annotations are keyed by the same ``graph node id`` values
that CUPTI-based profilers attach to kernel events during graph replay, so
the annotations can later be joined against a profiler trace to identify
which kernels belong to which region of the captured workload.

Annotation recording is enabled per capture via the ``enable_annotations``
argument of :class:`torch.cuda.graph`::

    import torch
    from torch.cuda.graph_annotations import mark_kernels, get_kernel_annotations

    g = torch.cuda.CUDAGraph()
    with torch.cuda.graph(g, enable_annotations=True):
        with mark_kernels("phase_A"):
            y = workload_a(x)
        with mark_kernels({"name": "phase_B", "dtype": "bf16"}):
            z = workload_b(y)

    annotations = get_kernel_annotations()

To get them into a profiler trace, export it with
``prof.export_chrome_trace(path, cuda_graph_annotations=get_kernel_annotations())``,
which bakes each annotation into the events of the graph nodes it describes. Any
mapping in that shape works, so the annotations can be filtered or edited first,
or pickled and passed to a later export -- they match a kernel event by its
``graph node id`` field.

Requires the ``cuda-bindings`` package and a CUDA driver that supports
``cudaGraphNodeGetToolsId`` (CUDA >= 13.1, or an equivalent cuda-compat
package). When unavailable, recording silently degrades to a no-op; use
:func:`is_available` to check support programmatically.

.. warning::
    This API is in prototype and may change in future releases.
)Úclear_kernel_annotationsÚdump_kernel_py_stacksÚget_kernel_annotationsÚget_kernel_py_stacksÚis_availableÚmark_kernelsztorch.cuda.graph_annotationsN)Ú__doc__Útorch.cuda._graph_annotationsr   r   r   r   r   r   Ú__all__Ú_nameÚglobalsÚ
__module__© ó    ÚXC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\cuda\graph_annotations.pyÚ<module>r      s:   ðñ&÷P÷ ò€ó €EØ"@�GƒIˆeÕÖñ â	r   