+
    Nåûj7•  ã                  ó€  € ^ RI Ht ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt ^ RIt^ RIHtHtHtHtHtHtHt . R%Ot^ tR
^ R^/tRt]P<                  R R l4       tR R lt R R lt!R R lt"R R lt#R R lt$R R lt%R&R R llt&R&R R llt'R R  lt(R! R" lt) ! R# R	4      t* ! R$ R4      t+R# )'é    )ÚannotationsN)ÚSequence)ÚbyrefÚc_int)ÚAny)Ú
deprecated)Ú_check_cudaÚ_check_cuda_bindingsÚ_cuda_bindings_driverÚ_cuda_bindings_runtimeÚ_ensure_cuda_bindings_versionÚ_get_cuda_libraryÚ_HAS_CUDA_BINDINGSÚGreenContextÚSMPartitionÚ
device_ctxÚbalancedzª`GreenContext.set_context` and `GreenContext.pop_context` are deprecated. Please create a stream with `GreenContext.Stream()` and use `torch.cuda.stream(stream)` instead.c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚint© )Úformats   "ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\cuda\green_contexts.pyÚ__annotate__r   0   s   € ÷ ñ ˜Sñ ó    c                 óÎ   €  \        4       p \        4       p\	        T P                  \        T4      4      4       TP                  #   \         d   p\        R T 24      ThRp?ii ; i)z)CUDA driver library could not be loaded: N)r   ÚOSErrorÚRuntimeErrorr   r	   ÚcuDriverGetVersionr   Úvalue)ÚdriverÚeÚversions      r   Ú_get_driver_versionr&   /   sd   € ðSÜ"Ó$ˆô ‹g€GÜ�×)Ñ)¬%°«.Ó9Ô:Ø�=‰=Ðøô	 ô SÜÐFÀqÀcÐJÓKÐQRÐRûðSús   ‚
A ÁA$ÁAÁA$c               ó$   € V ^8„  d   QhRRRRRR/# )r   r%   r   ÚmessageÚstrr   ÚNoner   )r   s   "r   r   r   ;   s!   € ÷ 4ñ 4 #ð 4°ð 4¸ñ 4r   c                óP   € \        4       V 8  d   \        V4      h\        W4       R # ©N)r&   r    r   )r%   r(   s   &&r   Ú_ensure_cuda_versionr-   ;   s    € ÜÓ˜wÔ&Ü˜7Ó#Ð#Ü! 'Ö3r   c               ó   € V ^8„  d   QhRR/# ©r   r   r*   r   )r   s   "r   r   r   A   s   € ÷ 	ñ 	˜4ñ 	r   c                 ó  € \         P                  P                  e   \         P                  P                  e   \	        R4      h\
        P                  R8X  d   \	        R4      h\        '       g   \	        R4      h\        RR4       R # )Nz.Green Context is only supported on Nvidia CUDAÚwin32z)Green Context is not supported on Windowsz/GreenContext requires the cuda.bindings packagei0/  z:Green Context requires CUDA driver and cuda.bindings 12.8+)	Útorchr%   ÚcudaÚhipr    ÚsysÚplatformr   r-   r   r   r   Ú_ensure_supportedr7   A   se   € Ü‡}�}×ÑÒ!¤U§]¡]×%6Ñ%6Ò%BÜÐKÓLÐLÜ
‡|�|�wÔÜÐFÓGÐGßÓÜÐLÓMÐMÜØÐKör   c               ó   € V ^8„  d   QhRR/# r/   r   )r   s   "r   r   r   M   s   € ÷ ñ  Tñ r   c                 ó   € \        R R4       R# )éÒ2  zDWorkqueue configuration requires CUDA driver and cuda.bindings 13.1+N©r-   r   r   r   Ú_ensure_workqueue_supportedr<   M   s   € ÜØÐUör   c               ó   € V ^8„  d   QhRR/# r/   r   )r   s   "r   r   r   S   s   € ÷ )ñ ) Dñ )r   c                 ó"   € R p \        RV 4       R# )z<Locality domains require CUDA driver and cuda.bindings 13.4+éð2  Nr;   )r(   s    r   Ú_ensure_locality_supportedr@   S   s   € ØL€GÜ˜ Ö(r   c               ó   € V ^8„  d   QhRR/# )r   r   Úboolr   )r   s   "r   r   r   X   s   € ÷ ñ ¨ñ r   c                 ó  € \         P                  P                  e>   \         P                  P                  f"   \        P
                  R8X  g   \        '       g   R# \        4       R8  d   R#  \        RR4       R#   \         d     R# i ; i)Nr1   Fr?   z'Locality domains require bindings 13.4+T)
r2   r%   r3   r4   r5   r6   r   r&   r   r    r   r   r   Ú_is_locality_software_supportedrD   X   sn   € ä�‰×ÑÒ"Ü�=‰=×ÑÒ(Ü�<‰<˜7Ô"ß!Ó!áÜÓ˜uÔ$ÙðÜ% eÐ-VÔWñ øô ô Úðús   Á.A< Á<BÂ
Bc               ó    € V ^8„  d   QhRRRR/# )r   Údevicer   r   r   )r   s   "r   r   r   i   s   € ÷ ñ  sð ¨sñ r   c                óÐ   € \        4       p\        P                  P                  p\	        \        4       P                  \        V4      VP                  V 4      4       VP                  # r,   )	r   Ú_drvÚCUdevice_attributeÚ)CU_DEVICE_ATTRIBUTE_LOCALITY_DOMAIN_COUNTr	   r   ÚcuDeviceGetAttributer   r"   )rF   ÚcountÚ	attributes   &  r   Ú_get_locality_domain_countrN   i   sL   € Ü‹G€Eä×'Ñ'×QÑQ€IÜÜÓ×0Ñ0´°u³¸y¿¹ÐPVÓWôð �;‰;Ðr   c               ó    € V ^8„  d   QhRRRR/# ©r   Ú	device_idú
int | Noner   r   r   )r   s   "r   r   r   s   s   € ÷ 4ñ 4¨
ð 4¸cñ 4r   c                ó8  € \        4       '       g   ^# V f   \        P                  P                  4       p \	        4       p\        VP                  ^ 4      4       \        4       p\        VP                  \        V4      V 4      4       \        VP                  4      # )a6  Return the device's locality-domain count reported by CUDA.

Returns ``1`` when the required software is unavailable. With CUDA driver
and bindings 13.4+, initializes the CUDA driver and queries the count.
This query does not create a context when ``device_id`` is specified;
invalid devices and failed driver queries raise an error.
Initializing the driver can prevent CUDA use in subsequently forked children.

Args:
    device_id (int, optional): Device index. When ``None``, uses the current
        PyTorch device, initializing PyTorch CUDA state if necessary.
)rD   r2   r3   Úcurrent_devicer   r	   ÚcuInitr   ÚcuDeviceGetr   rN   r"   )rQ   r#   rF   s   &  r   Úget_num_locality_domainsrW   s   sp   € ô +×,Ò,ÙØÒÜ—J‘J×-Ñ-Ó/ˆ	ÜÓ €FÜ�—‘˜aÓ Ô!Ü‹W€FÜ�×"Ñ"¤5¨£=°)Ó<Ô=Ü% f§l¡lÓ3Ð3r   c               ó    € V ^8„  d   QhRRRR/# )r   rQ   rR   r   rB   r   )r   s   "r   r   r   ‹   s   € ÷ "8ñ "8¨ð "8¸tñ "8r   c                óà  € \        4       '       g   R# V fE   \        P                  P                  4       '       d   \        P                  P	                  4       M^ p \        4       p\        4       P                  \        V4      V 4      pV\        P                  P                  P                  8X  d   \        V 4      pVf   \        R4      hV# \        V4       \!        VP                  4      ^8„  # )aù  Return whether the software supports localization on a multi-domain GPU.

Returns ``False`` when the required software is unavailable or the device
has at most one locality domain. Before driver initialization, attempts a
best-effort NVML capability check based on architecture and system
configuration, raising if NVML cannot determine support. Once the driver
is initialized, queries CUDA directly; invalid devices and failed queries
raise. This function does not initialize the driver or a context and does
not poison subsequent forks. Splitting and context creation always use CUDA
to validate the actual resources.

Args:
    device_id (int, optional): Device index. Default: current PyTorch device
        if PyTorch CUDA is initialized, otherwise ``0``.
Fz‚Cannot determine locality-domain support through NVML without initializing CUDA. Initialize CUDA explicitly before querying again.)rD   r2   r3   Úis_initializedrT   r   r   rV   r   rH   ÚCUresultÚCUDA_ERROR_NOT_INITIALIZEDr"   Ú_is_localization_supported_nvmlr    r	   rN   )rQ   rF   ÚresultÚ	supporteds   &   r   Úis_localization_supportedr`   ‹   s¾   € ô  +×,Ò,ÙØÒÜ38·:±:×3LÑ3L×3NÒ3N”E—J‘J×-Ñ-Ô/ÐTUˆ	Ü‹W€Fô Ó ×,Ñ,¬U°6«]¸IÓF€Fà”—‘×9Ñ9×?Ñ?Ô?Ü3°IÓ>ˆ	ØÒÜðWóð ð ÐÜ�ÔÜ% f§l¡lÓ3°aÑ7Ð7r   c               ó    € V ^8„  d   QhRRRR/# )r   rQ   r   r   zbool | Noner   )r   s   "r   r   r   °   s   € ÷ Qñ Q¨sð Q°{ñ Qr   c                ó–	  € ^ RI HpHpHpHpHpHp \        ;QJ d*    R \        P                   4       F  '       g   K   RM	  RM! R \        P                   4       4      '       g;   \        ;QJ d    R R
 4       F  '       g   K   RM	  RM! R R
 4       4      '       d   R#  ^ T u;8:  d&   \        P                  P                  4       8  g    R#  R# \        P                  P                  4       pV! R4      pVP                  4       ^ 8w  d   R#  V! ^P4      p	VP                  V	\!        V	4      4      ^ 8w  d    VP#                  4        R# V	P$                  P'                  R^4      ^ ,          p
V
P)                  4       '       g    VP#                  4        R# \+        V
4      R	8  d    VP#                  4        R# \-        V^ ,          \.        4      '       d"   \        P                  P1                  V 4      .pMKV! 4       pVP3                  V! V4      4      ^ 8w  d    VP#                  4        R# \5        VP$                  4      p. pV EF  pV! 4       pVP7                  Wá! V4      4      ^ 8w  d    VP#                  4        R# V! 4       V! 4       ppVP9                  Wñ! V4      V! V4      4      ^ 8w  d    VP#                  4        R# VP$                  ^
8  g   VP$                  ^8X  d   VP;                  R4       K³  VP$                  ^
8w  d    VP#                  4        R# V! 4       pVP=                  Wñ! V4      4      ^ 8w  d    VP#                  4        R# VP$                  ^8X  d   VP;                  R4       EK2  VP$                  ^ 8w  d    VP#                  4        R# V! 4       V! 4       ppVP?                  Wñ! V4      V! V4      4      ^ 8w  d    VP#                  4        R# VP$                  ^ 8w  d    VP#                  4        R# V! 4       pVPA                  Wñ! V4      4      ^8w  d    VP#                  4        R# VP;                  R4       EK  	  \!        \C        V4      4      ^8X  d   V^ ,          VP#                  4        #  VP#                  4        R#   TP#                  4        i ; i  \D        \F        \H        3 d     R# i ; i)r   )r   r   Úc_uintÚc_void_pÚCDLLÚcreate_string_bufferc              3  óB   "  € T F  qP                  R 4      x € K  	  R# 5i)Ú	CUDA_MPS_N)Ú
startswith)Ú.0Únames   & r   Ú	<genexpr>Ú2_is_localization_supported_nvml.<locals>.<genexpr>´   s   é € Ð
?±J¨D�?‰?˜;×'Ð'³Jùs   ‚TFc              3  ó`   "  € T F$  p\         P                  P                  V4      x € K&  	  R # 5ir,   )ÚosÚpathÚexists)rj   rp   s   & r   rl   rm   ´   s%   é € ð GÙ)O Œ�‰�‰�t×ÐÓ)Oùs   ‚,.Nzlibnvidia-ml.so.1ó   .iD  )z/tmp/nvidia-mpsz/run/nvidia-mps)%Úctypesr   r   rc   rd   re   rf   Úanyro   Úenvironr2   r3   Ú_device_count_nvmlÚ_parse_visible_devicesÚnvmlInit_v2ÚnvmlSystemGetDriverVersionÚlenÚnvmlShutdownr"   ÚsplitÚisdigitr   Ú
isinstancer)   Ú_get_nvml_device_indexÚnvmlDeviceGetCount_v2ÚrangeÚnvmlDeviceGetHandleByIndex_v2Ú"nvmlDeviceGetCudaComputeCapabilityÚappendÚnvmlDeviceGetVirtualizationModeÚnvmlDeviceGetMigModeÚnvmlDeviceGetNumaNodeIdÚsetÚAttributeErrorr   r    )rQ   r   r   rc   rd   re   rf   ÚvisibleÚnvmlr%   ÚbranchÚindicesrL   ÚsupportÚindexÚhandleÚmajorÚminorÚvirtualizationÚcurrentÚpendingÚ	numa_nodes   &                     r   r]   r]   °   s  € ßQ×Q÷ ƒsÑ
?´B·J²JÓ
?‡s‡s‚sÑ
?´B·J²JÓ
?×?Ò?Ç3Ã3ñ GÙ)OóGÇ3Ç3Â3ñ GÙ)OóG÷ Dò Dñ ðIØ�IÖ?¤§
¡
× =Ñ =Ó ?Õ?Ùð @ÙÜ—*‘*×3Ñ3Ó5ˆÙÐ'Ó(ˆØ×ÑÓ Ô"Ùð@	 Ù*¨2Ó.ˆGØ×.Ñ.¨w¼¸G»ÓEÈÔJØðz ×ÑÖðy —]‘]×(Ñ(¨¨qÓ1°!Õ4ˆFØ—>‘>×#Ò#Øðt ×ÑÖôs �6‹{˜SÔ Øðp ×ÑÖôo ˜' !�*¤c×*Ò*Ü Ÿ:™:×<Ñ<¸YÓGÐH‘ñ ›�Ø×-Ñ-©e°E«lÓ;¸qÔ@Øð` ×ÑÖô_   §¡Ó,�ØˆGÜ �Ù!›�Ø×5Ñ5°e¸UÀ6»]ÓKÈqÔPØðT ×ÑÖñS  %›w©«�u�à×;Ñ;Ø  e£©e°E«lóð ôð
  ðD ×ÑÖðC —;‘; Ô# u§{¡{°bÔ'8Ø—N‘N 5Ô)ÙØ—;‘; "Ô$Øð: ×ÑÖñ9 "(£�à×8Ñ8¸ÀÀ~ÓAVÓWØôð  ð. ×ÑÖð- "×'Ñ'¨1Ô,Ø—N‘N 5Ô)ÚØ!×'Ñ'¨1Ô,Øð$ ×ÑÖñ# $*£8©V«X˜�à×-Ñ-¨f°e¸G³nÁeÈGÃnÓUØôð  ð ×ÑÖð —=‘= AÔ%Øð ×ÑÖñ #›H�	à×/Ñ/°¸¸iÓ8HÓIÈQÔNØð ×ÑÖð —‘˜t×$ñQ !ôR ”3�w“<Ó  AÔ%Ø˜q•zð ×ÑÕð à×ÑÖøˆD×ÑÕûÜœG¤\Ð2ô ÚðúsÏ   Â$,R. ÃR. Ã;R. Ä(R Ä<R. Å8R ÆR. ÆR Æ+R. Æ=A!R ÈR. È1AR É2R. Ê2R Ê6R. ËAR ÌR. Ì!$R ÍR. Í7R ÎR. Î 2R ÏR. Ï$R Ï6R. Ð$R Ð,R. Ð>7R Ñ5R. ÒR. ÒR+Ò+R. Ò.SÓSc               ó    € V ^8„  d   QhRRRR/# )r   Úworkqueue_scopeú
str | Noner   rR   r   )r   s   "r   r   r     s   € ÷ 4ñ 4¨Jð 4¸:ñ 4r   c                ó\   € V f   R # V \         9  d   \        RV  R24      h\         V ,          # )Nz9workqueue_scope must be 'device_ctx' or 'balanced', got 'Ú')Ú_WORKQUEUE_SCOPE_VALUESÚ
ValueError)r˜   s   &r   Ú_parse_workqueue_scoperž     s@   € ØÒÙØÔ5Ô5ÜðØ#Ð$ Að'ó
ð 	
ô # ?Õ3Ð3r   c            
      óÀ   € ] tR tRtRtRR R llt]RR R ll4       t]R R	 l4       t	]R
 R l4       t
]R R l4       t]R R l4       tR^ R^ R^ RRRR/R R lltRtR# )r   i  a   An SM resource selected by CUDA, with its device and allocation metadata.

Obtain resources with :meth:`from_device`, :meth:`split`, or
:attr:`GreenContext.sm_partition`. Construct a :class:`GreenContext` with
``sm_partition=partition`` to run work on the selected SMs.

A partition describes a set of SMs; it does not reserve them against other
contexts. Reusing a partition for multiple contexts shares those SMs.
Nc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Ú	_resourcer   Ú
_device_idr   Ú_ownerz!SMPartition | GreenContext | Noner   r*   r   )r   s   "r   r   ÚSMPartition.__annotate__  s2   € ÷ ñ àðð ðð 2ð	ð
 
ñr   c                	ó*   € Wn         W n        W0n        R # r,   )r¡   r¢   r£   )Úselfr¡   r¢   r£   s   &&&&r   Ú__init__ÚSMPartition.__init__  s   € ð #ŒØ$ŒØŽr   c               ó    € V ^8„  d   QhRRRR/# )r   rQ   rR   r   r   r   )r   s   "r   r   r¤   %  s   € ÷ (ñ ( Jð (¸+ñ (r   c                óV  € \        4        Vf   \        P                  P                  4       p\	        \
        P                  ! ^ 4      4       \	        \
        P                  ! V4      4      p\	        \
        P                  ! V\
        P                  P                  4      4      pV ! W14      # )z®Return the full device SM resource.

Initializes the CUDA driver. If ``device_id`` is omitted, uses the
current PyTorch device, initializing PyTorch CUDA state if necessary.
)r7   r2   r3   rT   r
   rH   rU   rV   ÚcuDeviceGetDevResourceÚCUdevResourceTypeÚCU_DEV_RESOURCE_TYPE_SM)ÚclsrQ   rF   Úresources   &&  r   Úfrom_deviceÚSMPartition.from_device$  s~   € ô 	ÔØÒÜŸ
™
×1Ñ1Ó3ˆIÜœTŸ[š[¨›^Ô,ä%¤d×&6Ò&6°yÓ&AÓBˆÜ'Ü×'Ò'ØÜ×&Ñ&×>Ñ>óó
ˆñ �8Ó'Ð'r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r¤   :  s   € ÷ ñ ˜3ñ r   c                ó   € V P                   # )z%The device index of this SM resource.)r¢   ©r¦   s   &r   rQ   ÚSMPartition.device_id9  s   € ð �‰Ðr   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r¤   ?  s   € ÷ )ñ )˜#ñ )r   c                óB   € V P                   P                  P                  # )z*The actual number of SMs in this resource.)r¡   ÚsmÚsmCountr´   s   &r   Úsm_countÚSMPartition.sm_count>  s   € ð �~‰~× Ñ ×(Ñ(Ð(r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r¤   D  s   € ÷ 8ñ 8 cñ 8r   c                óB   € V P                   P                  P                  # )zAThe co-scheduled SM alignment reported by CUDA for this resource.)r¡   r¸   ÚsmCoscheduledAlignmentr´   s   &r   Úcoscheduled_sm_countÚ SMPartition.coscheduled_sm_countC  s   € ð �~‰~× Ñ ×7Ñ7Ð7r   c               ó   € V ^8„  d   QhRR/# ©r   r   rR   r   )r   s   "r   r   r¤   I  s   € ÷ ñ  Jñ r   c                óè   € \        4        \        P                  P                  pV P                  P
                  P                  V,          '       d!   V P                  P
                  P                  # R# )zÈThe locality domain reported by CUDA, or ``None`` if unspecified.

Requires CUDA driver and bindings 13.4+. This reads the resource's
metadata rather than inferring a domain from the requested split.
N)r@   rH   ÚCUdevSmResourceGroup_flagsÚ+CU_DEV_SM_RESOURCE_GROUP_LOCALITY_DOMAIN_IDr¡   r¸   ÚflagsÚlocalityDomainId)r¦   Úflags   & r   Úlocality_domain_idÚSMPartition.locality_domain_idH  sV   € ô 	#Ô$ô ×+Ñ+×WÑWð 	ð �>‰>×Ñ×"Ñ" T×)Ô)Ø—>‘>×$Ñ$×5Ñ5Ð5Ùr   Únum_smsr¿   Úpreferred_coscheduled_sm_countÚbackfillFÚlocality_domain_idsc               ó0   € V ^8„  d   QhRRRRRRRRRRR	R
/# )r   rË   úint | Sequence[int]r¿   rÌ   rÍ   úbool | Sequence[bool]rÎ   ú!int | None | Sequence[int | None]r   z2tuple[tuple[SMPartition, ...], SMPartition | None]r   )r   s   "r   r   r¤   X  sP   € ÷ [#ñ [#ð %ð[#ð 2ð	[#ð
 )<ð[#ð (ð[#ð ?ð[#ð 
<ñ[#r   c          
     ó(	  a € Rp\        RV4       RVRVRVRVRV/pVP                  4        UU	u/ uFG  w  r‰\        V	\        4      '       g   K  \        V	\        \
        34      '       d   K;  V\        V	4      bKI  	  p
pp	V
P                  4        U	u0 uF  p	\        V	4      kK  	  pp	\        V4      ^8”  d   \        R4      hV'       d   VP                  4       M^pV^ 8X  d   \        R	4      hVP                  4        UU	u/ uF  w  r‰YˆV
9   d	   W¨,          M	V	3V,          bK   	  ppp	VR,          pVR,          pVR,          pVR,          pVR,          pR
pV F–  pVf   K	  \        V\        4      '       d   \        V\        4      '       g   V^ 8  d   \        R4      hVf    \        4        \        S P                  4      pVV8¼  g   Ks  \        RV RS P                   RV^,
           24      h	  RV3RV3RV33 FT  w  r�V FI  p	\        V	\        4      '       d    \        V	\        4      '       g
   V	^ 8  g   K8  V RV	: 2p\        V4      h	  KV  	  \         ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d   \        R4      h. p\#        V4       EF  w  ppV^ 8X  d6   VV,          '       d'   V\        V4      ^,
          8  d   \        RV R24      h\$        P&                  ! 4       pVVn        VV,          Vn        VV,          Vn        VV,          '       d    \$        P.                  P0                  Vn        VV,          e@   V;P2                  \$        P.                  P4                  ,          un        VV,          Vn        VP9                  V4       EK  	  \;        \$        P<                  ! \        V4      S P>                  ^ V4      4      w  pp\        ;QJ d    . V 3R lV 4       F  NK  	  5M! V 3R lV 4       4      pR
pVP@                  \$        PB                  PD                  8H  pV'       d4   VPF                  P(                  '       d   \I        VS P                  S 4      pVV3# u up	pi u up	i u up	pi )ad
  Split this resource into disjoint groups and an optional remainder.

Requires CUDA driver and bindings 13.1+. CUDA checks the requested
counts and hardware constraints; counts are not automatically rounded.
A count of zero requests discovery of the largest remaining group
satisfying its constraints. Groups are processed in order.

Args:
    num_sms (int or sequence of int, optional): SM count for each group.
        Zero requests discovery. Default: ``0``.
    coscheduled_sm_count (int or sequence of int, optional): Co-scheduled
        SM grouping size for thread-block clusters. Zero lets CUDA
        determine cluster capabilities from the selected resources.
        Default: ``0``.
    preferred_coscheduled_sm_count (int or sequence of int, optional):
        Preferred larger grouping size, when CUDA can combine groups.
        Zero selects the CUDA default. Default: ``0``.
    backfill (bool or sequence of bool, optional): Allow CUDA to fill
        groups with SMs outside the co-scheduling or locality constraints.
        Default: ``False``.
    locality_domain_ids (int, None, or sequence of int or None, optional):
        Select SMs from these locality domains during splitting. ``None``
        leaves locality unconstrained. Requires CUDA driver and bindings
        13.4+ when any domain is specified. Default: ``None``.

Each option can be a scalar or a sequence. All sequences must have the
same nonzero length; scalars are broadcast to that length. If every
option is scalar, the split has one group. An early discovery group can
exhaust the SMs needed by later groups.
A group with both ``num_sms=0`` and ``backfill=True`` consumes all
remaining SMs and must be the last group.
Returns ``(partitions, remainder)``, with ``None`` for an empty remainder.
The remainder does not inherit the requested alignment.

To subdivide a returned partition or remainder, create a
:class:`GreenContext` from it and split the context's queried
:attr:`~GreenContext.sm_partition`. CUDA drivers can reject raw split
outputs as already partitioned resources. Context creation is explicit.

Children are subsets of this resource and overlap it. Siblings from
this operation, including the remainder, are disjoint. Results from
separate splits on the same or overlapping input resources may overlap.

Example::

    >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA)
    >>> sms = SMPartition.from_device(device_id=0)
    >>> (first,), rest = sms.split(num_sms=4, coscheduled_sm_count=2)
    >>> rest_ctx = GreenContext(sm_partition=rest)
    >>> (second,), rest = rest_ctx.sm_partition.split(
    ...     num_sms=4, coscheduled_sm_count=2
    ... )
z9SM splitting requires CUDA driver and cuda.bindings 13.1+r:   rË   r¿   rÌ   rÍ   rÎ   z.All sequence options must have the same lengthz'A split must contain at least one groupNz@locality_domain_ids entries must be nonnegative integers or Nonezlocality_domain_ids contains z, but valid IDs for device z are 0 through z+ entries must be nonnegative integers, got c              3  óL   "  € T F  p\        V\        4      '       * x € K  	  R # 5ir,   )r~   rB   )rj   r"   s   & r   rl   Ú$SMPartition.split.<locals>.<genexpr>Ì  s   é € ÐB¹	¨u”:˜e¤TÓ*×*Ñ*»	ùs   ‚"$TFz$backfill entries must be bool valueszSplit group z� has num_sms=0 and backfill=True, which consumes all remaining SMs. Only the last group may use this combination; move it last or specify a positive num_sms.c              3  óR   <"  € T F  p\        VSP                  S4      x € K  	  R # 5ir,   )r   rQ   )rj   Úrr¦   s   & €r   rl   rÕ   ë  s!   øé € ÐQÁyÀ!œ Q¨¯©¸×=Ð=Ãyùs   ƒ$')%r-   Úitemsr~   r   r)   ÚbytesÚtupleÚvaluesrz   r�   Úpopr   rB   r@   rN   rQ   rt   Ú	enumeraterH   ÚCU_DEV_SM_RESOURCE_GROUP_PARAMSr¹   ÚcoscheduledSmCountÚpreferredCoscheduledSmCountrÄ   Ú!CU_DEV_SM_RESOURCE_GROUP_BACKFILLrÆ   rÅ   rÇ   r„   r
   ÚcuDevSmResourceSplitr¡   Útyper¬   r­   r¸   r   )r¦   rË   r¿   rÌ   rÍ   rÎ   r(   Úoptionsrk   r"   Ú	sequencesÚlengthsrL   rÛ   ÚcountsÚ	co_countsÚ	preferredÚ	backfillsÚdomainsÚnum_domainsÚdomainÚmsgÚparamsr�   ÚparamÚ	resourcesÚ	remainderÚchildrenÚ	remainingÚis_sm_resources   f$$$$$                        r   r|   ÚSMPartition.splitX  s>  ø€ ð| NˆÜ˜U GÔ,à�wØ"Ð$8Ø,Ð.LØ˜Ø!Ð#6ð
ˆð  'Ÿ}™}œô
á.‘�Ü˜%¤×*ô ä3=¸eÄcÌ5À\×3Rô ˆD”%˜“,ÒÙ.ð 	ñ 
ð
 ,5×+;Ñ+;Ô+=Ó>Ñ+= %”3�u–:Ñ+=ˆÐ>Üˆw‹<˜!ÔÜÐMÓNÐNß!(�—‘”¨aˆØ�AŒ:ÜÐFÓGÐGð  'Ÿ}™}œô
á.‘�ð ¨YÔ%6�)–/¸U¸HÀuÕ<LÒLÙ.ð 	ñ 
ð ˜	Õ"ˆØÐ1Õ2ˆ	ØÐ;Õ<ˆ	Ø˜:Õ&ˆ	ØÐ.Õ/ˆØˆÛˆFØŠ~ÙÜ˜f¤c×*Ò*¬j¸Ä×.FÒ.FÈ&ÐSTÌ*Ü ØVóð ð Ò"Ü*Ô,Ü8¸¿¹ÓH�Ø˜Ö$Ü Ø3°F°8ð <Ø"Ÿn™nÐ-¨_¸[È1½_Ð<MðOóð ñ ð  ˜ÐØ# YÐ/Ø-¨yÐ9ó
‰LˆDó
  �Ü! %¬×-Ò-´¸EÄ4×1HÒ1HÈEÐTUÎIØ!˜FÐ"MÈeÉYÐW�CÜ$ S›/Ð)ó  ñ
÷ ‹3ÑB¹	ÓB�3�3Š3ÑB¹	ÓB×BÒBÜÐCÓDÐDØˆÜ% f×-‰LˆE�5Ø˜Œz˜i¨×.Ô.°5¼3¸v»;È½?Ô3JÜ Ø" 5 'ð *Oð Oóð ô ×8Ò8Ó:ˆEØ!ˆEŒMØ'0°Õ'7ˆEÔ$Ø09¸%Õ0@ˆEÔ-Ø˜×Ôô ×3Ñ3×UÑUð ”ð �u�~Ò)Ø—’ä×3Ñ3×_Ñ_õ•ð *1°­�Ô&Ø�M‰M˜%× ñ/ .ô0  4ä×%Ò%¤c¨&£k°4·>±>À1ÀfÓMó 
Ñˆ	�9÷ ”5ÔQÁyÓQ—5‘5ÔQÁyÓQÓQˆØˆ	ð �N‰Nœd×4Ñ4×LÑLÑLð 	÷ ˜iŸl™l×2×2Ð2Ü# I¨t¯~©~¸tÓDˆIØ˜Ð"Ð"ùói
ùò
 ?ùó
s   ¯RÁRÁ,RÂR	Ä$R)r¢   r£   r¡   r,   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r§   Úclassmethodr°   ÚpropertyrQ   rº   r¿   rÉ   r|   Ú__static_attributes__r   r   r   r   r     s¶   † ñ÷ð ö(ó ð(ð( ôó ðð ô)ó ð)ð ô8ó ð8ð ôó ðð[#ð ()ð[#ð 56ð	[#ð
 ?@ð[#ð +0ð[#ð BF÷[#ó [#r   c                  ó”  € ] tR tRtRtRRRRRRRRRR/R	 R
 lltR R ltR R lt]R^ R^ R^ RRRRRRRRRR/R R ll4       t	]
R R l4       t]
R R l4       t]
R R l4       t]
R R l4       t]RRRRRRRRRR/R R ll4       t]R,R  R! ll4       tR" R# lt]! ]]R$7      R% R& l4       t]! ]]R$7      R' R( l4       tR) R* ltR+tR# )-r   iö  a,  Wrapper around a CUDA green context.

.. warning::
   This API is in beta and may change in future releases.

CUDA work should be placed on streams created from the green context:

.. code-block:: python

    ctx = GreenContext(...)
    stream = ctx.Stream()
    with torch.cuda.stream(stream):
        # torch operations here are using resources from `ctx`
        pass

Green-context streams are custom CUDA streams. Synchronization with other
streams is the user's responsibility and should be handled with CUDA events,
as with any other custom stream.
rË   NÚsm_partitionr˜   Úworkqueue_concurrency_limitrQ   c               ó0   € V ^8„  d   QhRRRRRRRRRRR	R
/# )r   rË   rR   r   úSMPartition | Noner˜   r™   r  rQ   r   r*   r   )r   s   "r   r   ÚGreenContext.__annotate__  sP   € ÷ Fñ Fð ðFð )ð	Fð
 $ðFð &0ðFð ðFð 
ñFr   c               ól  € RV n         RV n        RV n        \        4        \	        V4      pVe   \        4        Ve"   \        V\        4      '       g   \        R4      hVe   Ve   \        R4      hVf   Vf   Vf   \        R4      hVe   Vf   \        R4      hVe-   Ve   WRP                  8w  d   \        R4      hVP                  pM"Vf   \        P                  P                  4       p\        \         P"                  ! 4       4      p\%        V4      ^ 8X  d8   \&        P(                  ! R^R7       \        \*        P,                  ! ^ 4      4       \        \         P.                  ! V4      4      p. p	Ve   V	P1                  VP2                  4       VeÏ   \        \         P4                  ! V\         P6                  P8                  4      4      p
V^ 8:  g   WP:                  P<                  8”  d'   \        R	V R
V
P:                  P<                   R24      h\        \         P>                  ! ^V
^ V4      4      w  r¼pV^8w  d   \        R4      hV	P1                  V^ ,          4       Ven   \        \         P4                  ! V\         P6                  P@                  4      4      pWnPB                  n"        Ve   WNPB                  n#        V	P1                  V4       \        \         PH                  ! V	\K        V	4      4      4      p\        \         PL                  ! VV\         PN                  PP                  4      4      p \        \         PR                  ! V4      4      p\%        V4      ^ 8X  d   \        R4      hV PU                  VVV4       R#   \V         d"    \        \         PX                  ! T4      4       h i ; i)a›  Create a CUDA green context.

Specify ``num_sms``, ``sm_partition``, or ``workqueue_scope``.
``num_sms`` and ``sm_partition`` are mutually exclusive. Either can be
combined with workqueue configuration.

Arguments:
    num_sms (int, optional): The number of SMs to use in the green
        context. When ``None``, uses ``sm_partition`` if provided,
        otherwise all SMs.
    sm_partition (SMPartition, optional): An existing SM resource to use.
        The context is created on the partition's device. Reusing a
        partition creates contexts sharing the same SMs.
    workqueue_scope (str, optional): Workqueue sharing scope. One of
        ``"device_ctx"`` (shared across all contexts, default driver
        behavior) or ``"balanced"`` (non-overlapping workqueues with
        other balanced green contexts). When ``None``, no workqueue
        configuration is applied.
    workqueue_concurrency_limit (int, optional): Maximum number of
        concurrent stream-ordered workloads for the workqueue. Requires
        ``workqueue_scope`` to be set.
    device_id (int, optional): The device index of green context.
        When ``None``, the current device is used.
Nz#sm_partition must be an SMPartitionz/num_sms and sm_partition are mutually exclusivezKAt least one of num_sms, sm_partition, or workqueue_scope must be specifiedz>workqueue_concurrency_limit requires workqueue_scope to be setz.device_id must match the SM partition's devicezcAttempted to create a green context but there was no primary context! Creating a primary context...)Ú
stacklevelz3Invalid number of SMs requested for green context: z (device has z SMs)z)Failed to create single SM resource groupz+Green ctx conversion to regular ctx failed!)-r¢   Ú
_green_ctxÚ_contextr7   rž   r<   r~   r   Ú	TypeErrorr�   r    rQ   r2   r3   rT   r
   rH   ÚcuCtxGetCurrentr   ÚwarningsÚwarnÚ_rtÚcudaFreerV   r„   r¡   r«   r¬   r­   r¸   r¹   ÚcuDevSmResourceSplitByCountÚ%CU_DEV_RESOURCE_TYPE_WORKQUEUE_CONFIGÚwqConfigÚsharingScopeÚwqConcurrencyLimitÚcuDevResourceGenerateDescrz   ÚcuGreenCtxCreateÚCUgreenCtxCreate_flagsÚCU_GREEN_CTX_DEFAULT_STREAMÚcuCtxFromGreenCtxÚ_init_from_cuda_objectsÚ	ExceptionÚcuGreenCtxDestroy)r¦   rË   r   r˜   r  rQ   Úscope_valueÚcurrent_ctxrF   rñ   Úsm_resourceÚsplit_resultÚ	nb_groupsÚ
_remainingÚwq_resourceÚdescÚ	green_ctxÚcontexts   &$$$$$            r   r§   ÚGreenContext.__init__  sJ  € ðB ˆŒØˆŒØˆŒÜÔä,¨_Ó=ˆØÒ"Ü'Ô)àÒ#¬J°|Ä[×,QÒ,QÜÐAÓBÐBØÒ <Ò#;ÜÐNÓOÐOØŠ?˜|Ò3¸Ò8KÜØ]óð ð 'Ò2°{Ò7JÜØPóð ð Ò#ØÒ$¨×6LÑ6LÔ)LÜ Ð!QÓRÐRØ$×.Ñ.‰IØÒÜŸ
™
×1Ñ1Ó3ˆIô +¬4×+?Ò+?Ó+AÓBˆäˆ{Ó˜qÔ Ü�MŠMð9àõô !¤§¢¨a£Ô1ô &¤d×&6Ò&6°yÓ&AÓBˆØˆ	ØÒ#Ø×Ñ˜\×3Ñ3Ô4àÒÜ.Ü×+Ò+ØÜ×*Ñ*×BÑBóóˆKð ˜!Œ|˜w¯©×)?Ñ)?Ô?Ü"ØIØ�i˜}¨[¯^©^×-CÑ-CÐ,DÀEðKóð ô 3GÜ×0Ò0Ø�{ A wóó3Ñ/ˆL Zð
 ˜AŒ~Ü"Ð#NÓOÐOØ×Ñ˜\¨!�_Ô-àÒ"Ü.Ü×+Ò+ØÜ×*Ñ*×PÑPóóˆKð 1<× Ñ Ô-Ø*Ò6Ø:U×$Ñ$Ô7Ø×Ñ˜[Ô)ä#Ü×*Ò*Øœ3˜y›>óó
ˆô
 )Ü×!Ò!ØØÜ×+Ñ+×GÑGóó
ˆ	ð		ä*¬4×+AÒ+AÀ)Ó+LÓMˆGÜ�7‹|˜qÔ Ü"Ð#PÓQÐQØ×(Ñ(¨°I¸wÖGøÜô 	ä ¤×!7Ò!7¸	Ó!BÔCØð	ús   Ì8AN Î,N3c               ó   € V ^8„  d   QhRR/# r/   r   )r   s   "r   r   r  “  s   € ÷ Tñ T˜ñ Tr   c           
     	ó.  € \        V R R4      pVf   R# \        \        V P                  ^,           4      p\	        \        V4      4       F4  p \        \        P                  ! V P                  V,          4      4       K6  	  RV n         \        \        P                  ! V4      4       R#   \         d+   p\        P                  ! RT RT RT 24        Rp?K‘  Rp?ii ; i  \         d(   p\        P                  ! RT RT 24        Rp?R# Rp?ii ; i)r  Nz3Error while destroying green context stream at idx z for green context z: z%Error while destroying green context )ÚgetattrÚminÚ_STREAMS_PER_GREEN_CONTEXT_POOLÚ_curr_stream_idxÚreversedr�   r
   rH   ÚcuStreamDestroyÚ_green_ctx_streamsr    r  r  r  r  )r¦   r$  ÚendÚidxr$   s   &    r   Ú__del__ÚGreenContext.__del__“  sü   € Ü˜D ,°Ó5ˆ	ØÒÙô Ô1°4×3HÑ3HÈ1Õ3LÓMˆÜœE #›JÖ'ˆCðä$¤T×%9Ò%9¸$×:QÑ:QÐRUÕ:VÓ%WÖXñ (ð ˆŒð	Tä ¤×!7Ò!7¸	Ó!BÖCøô  ô Ü—’ØIÈ#Èð O)Ø)2¨°2°a°Sð:÷ò ûðûô ô 	TÜ�MŠMÐAÀ)ÀÈBÈqÈcÐR×SÒSûð	Tús0   Á0B*Â	C" Â*CÂ5CÃCÃ"DÃ-DÄDc               ó    € V ^8„  d   QhRRRR/# )r   rQ   r   r   r*   r   )r   s   "r   r   r  «  s   € ÷ 	$ñ 	$°ð 	$ÈTñ 	$r   c                	óz   € Wn         W0n        R V n        R V n        R .\        ,          V n        RV n        W n        R # )Néÿÿÿÿ)r¢   r  Ú	_sm_countÚ_parent_streamr+  r/  r,  r  )r¦   rQ   r$  r%  s   &&&&r   r  Ú$GreenContext._init_from_cuda_objects«  s?   € Ø#ŒØŒØ%)ˆŒØ8<ˆÔàð5
ä+õ5,ˆÔð !#ˆÔØ#Žr   r¿   rÌ   rÍ   FrÎ   c               ó<   € V ^8„  d   QhRRRRRRRRRRR	R
RRRRRR/	# )r   rË   rÐ   r¿   rÌ   rÍ   rÑ   rÎ   rÒ   r˜   r™   r  rR   rQ   r   ztuple[GreenContext, ...]r   )r   s   "r   r   r  ·  sd   € ÷ '
ñ '
à$ð'
ð 2ð'
ð )<ð	'
ð
 (ð'
ð ?ð'
ð $ð'
ð &0ð'
ð ð'
ð 
"ñ'
r   c                óÈ   aa€ \         P                  V4      pVP                  V VVVVR7      w  rš\        ;QJ d    . VV3R lV	 4       F  NK  	  5# ! VV3R lV	 4       4      # )a¹  Create contexts backed by disjoint SM partitions of a device.

Partition options are those of :meth:`SMPartition.split`. Workqueue
options are applied to each context. Unassigned SMs are unused; use
:meth:`SMPartition.split` to retain the remainder for later use.

Example::

    >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CUDA)
    >>> a, b = GreenContext.split(
    ...     num_sms=(24, 40), coscheduled_sm_count=8, device_id=0
    ... )
)rË   r¿   rÌ   rÍ   rÎ   c              3  ó@   <"  € T F  p\        VSSR 7      x € K  	  R# 5i))r   r˜   r  N©r   )rj   Ú	partitionr  r˜   s   & €€r   rl   Ú%GreenContext.split.<locals>.<genexpr>×  s/   øé € ð 
ñ (�	ô Ø&Ø /Ø,G÷ñ ó
 (ùs   ƒ)r   r°   r|   rÚ   )rË   r¿   rÌ   rÍ   rÎ   r˜   r  rQ   ÚsourceÚ
partitionsÚ_s   $$$$$dd$   r   r|   ÚGreenContext.split¶  sq   ù€ ô2 ×(Ñ(¨Ó3ˆØŸ™ØØ!5Ø+IØØ 3ð %ó 
‰ˆ
÷ Œuõ 
ñ (ó
�uð 	
ˆuõ 
ñ (ó
ó 
ð 	
r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r  á  s   € ÷ ñ ˜3ñ r   c                ól   € V P                  4        V P                  f   \        R4      hV P                  # )z'The device index of this green context.úGreenContext has been destroyed)Ú_ensure_aliver¢   r    r´   s   &r   rQ   ÚGreenContext.device_idà  s0   € ð 	×ÑÔØ�?‰?Ò"ÜÐ@ÓAÐAØ�‰Ðr   c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r   s   "r   r   r  é  s   € ÷ ;ñ ;˜kñ ;r   c                óÒ   € V P                  4        \        \        P                  ! V P                  \        P
                  P                  4      4      p\        WP                  V 4      # )zThe context's actual SM resource, which can be subdivided.

The returned resource keeps this context alive while it is in use.
)	rG  r
   rH   ÚcuGreenCtxGetDevResourcer  r¬   r­   r   rQ   )r¦   r¯   s   & r   r   ÚGreenContext.sm_partitionè  sQ   € ð 	×ÑÔÜ'Ü×)Ò)Ø—‘Ü×&Ñ&×>Ñ>óó
ˆô ˜8§^¡^°TÓ:Ð:r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r  ø  s   € ÷ ñ ˜#ñ r   c                óŒ   € V P                  4        V P                  f   V P                  P                  V n        V P                  # )z3The actual number of SMs available to this context.)rG  r7  r   rº   r´   s   &r   rº   ÚGreenContext.sm_count÷  s7   € ð 	×ÑÔØ�>‰>Ò!Ø!×.Ñ.×7Ñ7ˆDŒNØ�~‰~Ðr   c               ó   € V ^8„  d   QhRR/# rÂ   r   )r   s   "r   r   r     s   € ÷ 4ñ 4 Jñ 4r   c                ó.   € V P                   P                  # )zoThe locality domain reported by CUDA for this context, if specified.

Requires CUDA driver and bindings 13.4+.
)r   rÉ   r´   s   &r   rÉ   ÚGreenContext.locality_domain_idÿ  s   € ð × Ñ ×3Ñ3Ð3r   c               ó0   € V ^8„  d   QhRRRRRRRRRRR	R
/# )r   rË   rR   r   r  r˜   r™   r  rQ   r   r   r   )r   s   "r   r   r    sF   € ÷ 
ñ 
àð
ð )ð
ð $ð	
ð
 &0ð
ð ð
ð 
ñ
r   c                ó"   € \        V VVVVR7      # )zVCreate a CUDA green context.

Kept for compatibility, see `GreenContext` constructor.
©rË   r   r˜   r  rQ   r=  rU  s   $$$$$r   ÚcreateÚGreenContext.create  s    € ô ØØ%Ø+Ø(CØô
ð 	
r   c               ó    € V ^8„  d   QhRRRR/# rP   r   )r   s   "r   r   r    s   € ÷ 7ñ 7¨Zð 7À3ñ 7r   c                óH  € \        4        \        4        V f   \        P                  P	                  4       p \        \        P                  ! V 4      4      p\        \        P                  ! V\        P                  P                  4      4      pVP                  P                  # )a?  Return the maximum workqueue concurrency limit for the device.

This queries the device for the default number of concurrent
stream-ordered workloads supported by workqueue configuration
resources.

Arguments:
    device_id (int, optional): The device index to query. When
        ``None``, the current device is used.
)r7   r<   r2   r3   rT   r
   rH   rV   r«   r¬   r  r  r  )rQ   rF   r"  s   &  r   Úmax_workqueue_concurrencyÚ&GreenContext.max_workqueue_concurrency  s}   € ô 	ÔÜ#Ô%ØÒÜŸ
™
×1Ñ1Ó3ˆIô &¤d×&6Ò&6°yÓ&AÓBˆÜ*Ü×'Ò'ØÜ×&Ñ&×LÑLóó
ˆð ×#Ñ#×6Ñ6Ð6r   c               ó   € V ^8„  d   QhRR/# r/   r   )r   s   "r   r   r  7  s   € ÷ Bñ B˜tñ Br   c                	óT   € V P                   e   V P                  f   \        R4      hR # )NrF  )r  r  r    r´   s   &r   rG  ÚGreenContext._ensure_alive7  s&   € Ø�?‰?Ò" d§m¡mÒ&;ÜÐ@ÓAÐAñ '<r   )Úcategoryc               ó   € V ^8„  d   QhRR/# r/   r   )r   s   "r   r   r  <  s   € ÷ 0ñ 0˜Tñ 0r   c                ó²  € V P                  4        V P                  e   \        R4      h\        P                  P                  4       pWn        \        P                  P                  4       pVP                  V4       \        \        P                  ! 4       4      p\        V4      ^ 8X  d+   \        \        P                  ! V P                  4      4       M)\        \        P                  ! V P                  4      4       \        P                  P                  V P                   4      pVP#                  V4       \        P                  P%                  V4       R# )z‡Make the green context the current context.

Deprecated. Create streams with :meth:`Stream` and use
:func:`torch.cuda.stream` instead.
Nz+set_context called twice before pop_context)rG  r8  r    r2   r3   Úcurrent_streamÚEventÚrecordr
   rH   r
  r   ÚcuCtxSetCurrentr  ÚcuCtxPushCurrentÚdefault_streamr¢   ÚwaitÚ
set_stream)r¦   rb  Úeventr  Úgreen_ctx_streams   &    r   Úset_contextÚGreenContext.set_context;  sé   € ð 	×ÑÔØ×ÑÒ*ÜÐLÓMÐMÜŸ™×2Ñ2Ó4ˆØ,Ôä—
‘
× Ñ Ó"ˆØ�‰�^Ô$ô +¬4×+?Ò+?Ó+AÓBˆÜˆ{Ó˜qÔ ä ¤×!5Ò!5°d·m±mÓ!DÕEô !¤×!6Ò!6°t·}±}Ó!EÔFä Ÿ:™:×4Ñ4°T·_±_ÓEÐØ�
‰
Ð#Ô$Ü�
‰
×ÑÐ.Ö/r   c               ó   € V ^8„  d   QhRR/# r/   r   )r   s   "r   r   r  Y  s   € ÷ 'ñ '˜Tñ 'r   c                ó6  €  V P                  4        V P                  f   \        R4      h\        P                  P                  4       pVP                  \        P                  P                  4       4       \        \        P                  ! 4       4      p\        V4      \        V P                  4      8w  d   \        R4      hVP                  V P                  4       \        P                  P                  V P                  4       RV n        R#   RT n        i ; i)zÎAssuming the green context is the current context, pop it from the
context stack and restore the previous context.

Deprecated. Create streams with :meth:`Stream` and use
:func:`torch.cuda.stream` instead.
Nz/pop_context called without matching set_contextz-expected popped context to be the current ctx)rG  r8  r    r2   r3   rc  rd  rb  r
   rH   ÚcuCtxPopCurrentr   r  rh  ri  )r¦   rj  Úpoppeds   &  r   Úpop_contextÚGreenContext.pop_contextX  sÇ   € ð	'Ø×ÑÔ Ø×"Ñ"Ò*Ü"Ð#TÓUÐUä—J‘J×$Ñ$Ó&ˆEØ�L‰LœŸ™×2Ñ2Ó4Ô5ô *¬$×*>Ò*>Ó*@ÓAˆFä�6‹{œc $§-¡-Ó0Ô0Ü"Ð#RÓSÐSà�J‰J�t×*Ñ*Ô+Ü�J‰J×!Ñ! $×"5Ñ"5Ô6à"&ˆDÖø $ˆDÕús   ‚DD Ä	Dc               ó   € V ^8„  d   QhRR/# )r   r   ztorch.cuda.Streamr   )r   s   "r   r   r  s  s   € ÷ Qñ QÐ)ñ Qr   c                ó´  € V P                  4        V P                  ^,           pV\        ,          pV\        8  dS   \        \        P
                  ! V P                  \        P                  P                  ^ 4      4      pW0P                  V&   MV P                  V,          pWn        \        P                  P                  \        V4      V P                  4      # )zùReturn a CUDA stream associated with this green context.

Use the returned stream with :func:`torch.cuda.stream` to run work on
the green context. Synchronization with other streams is not automatic;
use CUDA events as with any other custom stream.
)rG  r,  r+  r
   rH   ÚcuGreenCtxStreamCreater  ÚCUstream_flagsÚCU_STREAM_NON_BLOCKINGr/  r2   r3   ÚExternalStreamr   r¢   )r¦   Úcurr_idxr1  rk  s   &   r   ÚStreamÚGreenContext.Streams  s®   € ð 	×ÑÔØ×(Ñ(¨1Õ,ˆØÔ8Õ8ˆØÔ5Ô5Ü3Ü×+Ò+Ø—O‘OÜ×'Ñ'×>Ñ>Øóó Ðð ,<×#Ñ# CÒ(à#×6Ñ6°sÕ;ÐØ (Ôä�z‰z×(Ñ(¬Ð-=Ó)>ÀÇÁÓPÐPr   )r  r,  r¢   r  r/  r8  r7  r,   )r÷   rø   rù   rú   rû   r§   r2  r  Ústaticmethodr|   rý   rQ   r   rº   rÉ   rV  rZ  rG  r   Ú_CONTEXT_STACK_DEPRECATIONÚFutureWarningrl  rr  r{  rþ   r   r   r   r   r   ö  sª  † ñð(Fð #ðFð ,0ð	Fð
 '+ðFð 37ðFð !%÷FõPTõ0	$ð ð'
à'(ð'
ð 56ð'
ð ?@ð	'
ð
 +0ð'
ð BFð'
ð '+ð'
ð 37ð'
ð !%ö'
ó ð'
ðR ôó ðð ô;ó ð;ð ôó ðð ô4ó ð4ð ð
à"ð
ð ,0ð
ð '+ð	
ð
 37ð
ð !%ö
ó ð
ð( ö7ó ð7õ4Bñ Ð*°]ÔCô0ó Dð0ñ8 Ð*°]ÔCô'ó Dð'÷4Qñ Qr   )r   r   rW   r`   r,   ),Ú
__future__r   Ú	functoolsro   r5   r  Úcollections.abcr   rs   r   r   Útypingr   Útyping_extensionsr   r2   Útorch.cuda._utilsr	   r
   r   rH   r   r  r   r   r   Ú__all__r+  rœ   r~  Úcacher&   r-   r7   r<   r@   rD   rN   rW   r`   r]   rž   r   r   r   r   r   Ú<module>rˆ     sÇ   ðÝ "ã Û 	Û 
Û Ý $ß Ý Ý (ã ÷÷ ñ ò€ð #%Ð ð �!Ø�ðÐ ð+ð ð ‡�ôó ðõ4õ	õõ)õ
õ"÷4÷0"8õJQõh4÷d#ñ d#÷NTQó TQr   