+
    –°³j§Z  ã                  óš  € ^ RI Ht ^ RIt^ RIHt ^ RIHt ^ RIHtH	t	H
t
Ht ^ RIt^ RIHtHt ^ RIHtHt ^ RIHtHt ^ R	IHt ^R
IHt ^RIHt ]
'       d   ^ RIHtHt ^ RIH t  ]! RRR7      t!]PD                  PG                  ]$R4      t%]PD                  PG                  ]$R4      t&]'](]PR                  ,          R,          ,          t*]]'],          .]*3,          t+R R lt,R R lt-]P\                  P^                  P`                  Pb                  ]P\                  P^                  P`                  Pd                  ]P\                  P^                  P`                  Pf                  ]P\                  P^                  P`                  Ph                  ]P\                  P^                  P`                  Pj                  ]P\                  P^                  Pl                  Pb                  3t7 ! R R4      t8]Pr                  ! RRR7       ! R R4      4       t:]Pr                  ! RRR7       ! R R4      4       t;]Pr                  ! RRR7       ! R R 4      4       t<]Pr                  ! RRR7       ! R! R"4      4       t=R# R$ lt>R% R& lt?R' R( lt@R) R* ltAR+ R, ltBR- R. ltCR/ R0 ltDR1 R2 ltER3 R4 ltFR5 R6 ltGR7 R8 ltHR9 R: ltIR; R< ltJR= R> ltK]Pr                   ! R? R@4      4       tLRA RB ltMRC RD ltN ! RE RF]4      tORG RH ltPRI RJ ltQ]Pr                  ! RRK7       ! RL RM4      4       tR]Pr                  ! RRK7       ! RN RO4      4       tSRP RQ ltTRR RS ltUR# )Té    )ÚannotationsN)ÚCallable)ÚEnum)ÚAnyÚLiteralÚTYPE_CHECKINGÚTypeVar)ÚcountersÚget_metrics_context)ÚGraphPartitionMapÚ	InputType)Úget_plain_tensorsÚis_fake)Ú
OrderedSet)Úconfig)Úis_using_cudagraph_partition)ÚSequenceÚSet)Ú
OutputCodeÚ_OCr   )ÚboundÚ
cudagraphsÚcudagraph_static_inputsc               ó   € V ^8„  d   QhRR/# )é   ÚreturnzLiteral['user_visible'] | None© )Úformats   "Ú`/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/_inductor/cudagraph_utils.pyÚ__annotate__r    %   s   € ÷ ñ Ð,Jñ ó    c                 óf   € \         P                  P                  p V R9  d   \        RV : 24      hV # )NzlExpected torch._inductor.config.triton.cudagraph_trees_generation_cloning to be None or 'user_visible', got )NÚuser_visible)r   ÚtritonÚ"cudagraph_trees_generation_cloningÚAssertionError)Úmodes    r   r%   r%   %   s=   € Ü�=‰=×;Ñ;€DØÐ)Ô)Üðà‘(ðó
ð 	
ð
 €Kr!   c               ó   € V ^8„  d   QhRR/# )r   r   Úboolr   )r   s   "r   r    r    0   s   € ÷ Bñ B¸ñ Br!   c                 ó   € \        4       R 8H  # )r#   )r%   r   r!   r   Ú/cudagraph_trees_clone_live_user_visible_outputsr+   0   s   € Ü-Ó/°>ÑAÐAr!   c                  ó>   € ] tR t^>tRtR R ltR R ltR R ltRtR	# )
ÚCUDAGraphPolicya*  Pluggable policy controlling CUDA graph wrapping in Inductor's post_compile.

Override methods to customize:
  - HOW compiled functions are cudagraph-wrapped (cudagraphify)
  - WHETHER inner CompiledFxGraphs should be wrapped (should_wrap)
  - OUTER wrapping of compound outputs like RegionalOutputCode (wrap_output)

Set via ``torch._inductor.config.cudagraph_policy``.  When ``None``
(the default), the existing built-in behaviour is used unchanged.

Example usage::

    class MyCUDAGraphPolicy(CUDAGraphPolicy):
        def cudagraphify(self, model, example_inputs, static_input_idxs, **kwargs):
            return my_custom_wrapper(model, example_inputs, static_input_idxs)


    with torch._inductor.config.patch("cudagraph_policy", MyCUDAGraphPolicy()):
        compiled_fn = deserialize_artifacts(...)
c               ó8   € V ^8„  d   QhRRRRRRRRR	R
RR
RRRR/# )r   ÚmodelúCallable[..., Any]Úexample_inputszSequence[InputType]Ústatic_input_idxsúSequence[int]Údevice_indexÚintÚis_backwardr)   Úis_inferenceÚkwargsr   r   r   )r   s   "r   r    ÚCUDAGraphPolicy.__annotate__T   sZ   € ÷ &
ñ &
à!ð&
ð ,ð&
ð )ð	&
ð ð&
ð ð&
ð ð&
ð ð&
ð 
ñ&
r!   c          	     ó.   € ^ RI Hp V! VV3RVRVRV/VB # )al  Wrap a single compiled callable with CUDA graph capture/replay.

Called by ``cudagraph_post_compile`` for each ``CompiledFxGraph``.
The default delegates to ``compile_fx.cudagraphify`` (cudagraph_trees).

``example_inputs`` are the example inputs at post_compile time.
The default implementation does not forward them because
``compile_fx.cudagraphify`` defers graph recording to the first
real call via an inner closure.  Subclasses that need the
example inputs for warmup or static-input detection may use them.

When ``config.graph_partition=True``, setting a CUDAGraphPolicy
bypasses ``cudagraph_partition_post_compile`` (which wraps each
partition individually) and routes through ``cudagraph_post_compile``
instead, so this method wraps the *entire* callable, not individual
partitions.  Subclasses that need per-partition control should
handle partitioning internally.
)Úcudagraphifyr4   r6   r7   )Útorch._inductor.compile_fxr;   )	Úselfr/   r1   r2   r4   r6   r7   r8   r;   s	   &&&&$$$, r   r;   ÚCUDAGraphPolicy.cudagraphifyT   sB   € õ: 	<áØØñ
ð &ð
ð $ð	
ð
 &ð
ð ñ
ð 	
r!   c               ó    € V ^8„  d   QhRRRR/# )r   Úcompiled_graphr   r   r)   r   )r   s   "r   r    r9   |   s   € ÷ 	ñ 	¨*ð 	¸ñ 	r!   c                ó   € R# )a)  Whether to apply cudagraph wrapping to this CompiledFxGraph.

Called for each inner ``CompiledFxGraph`` during ``post_compile``.
Return ``False`` to skip wrapping (e.g. when wrapping at the outer
level via ``wrap_output`` instead).

Default: ``True`` (wrap everything, same as current behaviour).
Tr   )r=   r@   s   &&r   Úshould_wrapÚCUDAGraphPolicy.should_wrap|   s   € ñ r!   c               ó    € V ^8„  d   QhRRRR/# )r   Úoutput_coder   r   r   )r   s   "r   r    r9   ‡   s   € ÷ ñ  sð ¨sñ r!   c                ó   € V# )a©  Optional outer-level wrapping after inner post_compile completes.

Called by ``_compile_fx_inner``, ``BundledOutputCodeLoadable.post_compile``,
and ``FxGraphCacheLoadable.post_compile`` on the ``OutputCode`` returned
from ``post_compile``.  Subclasses that only want to wrap specific
output types should check ``isinstance`` and return the input
unchanged for types they don't handle.

Default: identity (no outer wrapping).
r   )r=   rE   s   &&r   Úwrap_outputÚCUDAGraphPolicy.wrap_output‡   s
   € ð Ðr!   r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r;   rB   rG   Ú__static_attributes__r   r!   r   r-   r-   >   s   † ñõ*&
õP	÷ñ r!   r-   T)ÚfrozenÚslotsc                  ó&   € ] tR t^•t$ RtR]R&   RtR# )Ú
FunctionIDz9Unique counter of a function wrapped in cudagraphify_implr5   Úidr   N©rI   rJ   rK   rL   rM   Ú__annotations__rN   r   r!   r   rR   rR   •   s
   ‡ á?à‡Gr!   rR   c                  óD   € ] tR t^œt$ RtR]R&   R]R&   R]R&   R]R&   R	tR
# )ÚPlaceholderInfozÊ
A serializable version of torch.fx.Node that contains information
pertinent to placeholder stack traces. We use these in logging and error messages
related to cudagraphs, and will cache these results.
ÚstrÚnameú
str | NoneÚstack_traceúlist[PlaceholderInfo]ÚusersÚmutating_use_stack_tracer   NrT   r   r!   r   rW   rW   œ   s    ‡ ñð ƒIØÓà Ó Ø(×(r!   rW   c                  ó,   € ] tR t^«t$ R]R&   R]R&   RtR# )ÚInputStorageMutationInfoúOrderedSet[int]Ú
input_idxsrZ   r[   r   N)rI   rJ   rK   rL   rU   rN   r   r!   r   r`   r`   «   s   ‡ àÓØ×r!   r`   c                  ó–   € ] tR t^±t$ RtR]R&   R]R&   R]R&   R]R	&   R
]R&   R]R&   RtR]R&   ]P                  ! ]	R7      t
R]R&   RtR# )ÚWrappedFunctionz¸
Represents a function that you want to record for CUDA graph replay,
with a little more metadata so we can identify if we have an applicable
CUDA graph in our CUDA graph tree for it.
r0   r/   r3   r2   rR   rS   ztuple[torch.Tensor, ...]Ú	constantsúSequence[PlaceholderInfo]ÚplaceholdersÚmutated_input_idxsFr)   Úkernel_free_cudagraph)Údefault_factoryzfrozenset[int]Úuser_visible_output_idxsr   N)rI   rJ   rK   rL   rM   rU   ri   ÚdataclassesÚfieldÚ	frozensetrk   rN   r   r!   r   rd   rd   ±   sR   ‡ ñð ÓØ$Ó$ØƒNØ'Ó'Ø+Ó+Ø%Ó%Ø"'Ð˜4Ó'Ø/:×/@Ò/@Ø!ô0Ð˜n÷ r!   rd   c               ó    € V ^8„  d   QhRRRR/# )r   Úplaceholder_nodeútorch.fx.Noder   rZ   r   )r   s   "r   r    r    Å   s   € ÷ ñ Ø#ðàñr!   c                óœ  € \        V P                  4      ^8X  d9   \        \        V P                  4      4      P                  P                  RR4      # V P                   Fi  pVP                  \        P                  P                  P                  P                  J g   KA  VP                  P                  RR4      ;p'       g   Kg  Vu # 	  R# )é   r[   N)Úlenr]   ÚnextÚiterÚmetaÚgetÚtargetÚtorchÚopsÚatenÚcopy_Údefault)rp   Úuser[   s   &  r   Ú&get_mutating_use_stack_trace_from_noder€   Å   sš   € ô Ð×!Ñ!Ó" aÔ'Ü”DÐ)×/Ñ/Ó0Ó1×6Ñ6×:Ñ:¸=È$ÓOÐOà×%Ô%ˆØ�:‰:œŸ™Ÿ™×-Ñ-×5Ñ5Õ5Ø!Ÿh™hŸl™l¨=¸$Ó?Ð?ˆ{×?Ð?Ø"Ò"ñ &ñ
 r!   c               ó    € V ^8„  d   QhRRRR/# )r   Úplaceholder_inforW   r   rZ   r   )r   s   "r   r    r    Ô   s   € ÷ 5ñ 5°?ð 5Àzñ 5r!   c                ó   € V P                   # ©N)r^   )r‚   s   &r   Úget_mutating_use_stack_tracer…   Ô   s   € Ø×4Ñ4Ð4r!   c               ó    € V ^8„  d   QhRRRR/# )r   Úgmútorch.fx.GraphModuler   r`   r   )r   s   "r   r    r    Ø   s    € ÷ Nñ NØðNàñNr!   c                ó¢  € V P                   P                   Uu. uF  qP                  R 8X  g   K  VNK  	  pp\        V4       UUu/ uF  w  r1WbK	  	  ppp\	        4       pRpV P                   P                   F¿  pVP                  R8w  g   VP
                  \        9  d   K+  VP                  '       d   VP                  ^ ,          MRp\        V\        P                  P                  4      '       g   K~  Wt9   g   K†  VP                  WG,          4       Ve   K£  VP                  P                  RR4      pKÁ  	  \        WV4      # u upi u uppi )ÚplaceholderNÚcall_functionr[   )ÚgraphÚnodesÚopÚ	enumerater   ry   ÚINPUT_STORAGE_MUTATION_TARGETSÚargsÚ
isinstancerz   ÚfxÚNodeÚaddrw   rx   r`   )r‡   Únoderg   ÚidxÚplaceholder_indicesÚstorage_mutation_input_idxsr[   Úmutated_args   &       r   Úget_input_storage_mutation_infor›   Ø   sý   € ð &(§X¡X§^¢^ÓP¡^˜T·w±wÀ-Ñ7O—D�D¡^€LÐPÜ6?ÀÔ6MÔNÑ6M©¨˜4š9Ñ6MÐÑNÜ3=³<ÐØ"€Kà—‘—”ˆà�G‰G�Ô&Ø�{‰{Ô"@Ô@áà&*§i§i i�d—i‘i –l°Tˆô
 �{¤E§H¡H§M¡M×2Ô2ØÖ2à'×+Ñ+Ð,?Õ,LÔMØÔ"Ø"Ÿi™iŸm™m¨M¸4Ó@’ñ# ô& $Ð$?ÓMÐMùò1 QùÛNs   ™E°EÁEc               ó    € V ^8„  d   QhRRRR/# )r   Ústorage_mutation_infor`   r   rZ   r   )r   s   "r   r    r    ö   s   € ÷ ñ Ø3ðàñr!   c                ó–   € V P                   pV'       g   R # R\        V4       R2pV P                  '       d   V RV P                   2# V# )Nzinput storage mutation (ú instances)z. Found from:
 )rb   rt   r[   )r�   r™   Úmsgs   &  r   Ú!get_input_storage_mutation_reasonr¡   ö   sV   € ð #8×"BÑ"BÐß&Ùà$¤SÐ)DÓ%EÐ$FÀkÐ
R€CØ×(×(Ð(Ø�Ð&Ð'<×'HÑ'HÐ&IÐJÐJà€Jr!   c               ó    € V ^8„  d   QhRRRR/# )r   rp   rq   r   rW   r   )r   s   "r   r    r      s   € ÷ Oñ O¨-ð O¸Oñ Or!   c                óü   € V P                   pV P                  P                  R R4      p. pRpV P                  R8X  d0   V P                   Uu. uF  p\        V4      NK  	  pp\        V 4      p\        WW44      # u upi )r[   NrŠ   )rY   rw   rx   rŽ   r]   Úto_placeholder_infor€   rW   )rp   rY   r[   r]   r^   Úis   &     r   r¤   r¤     sƒ   € Ø× Ñ €DØ"×'Ñ'×+Ñ+¨M¸4Ó@€KØ€EØ#Ðà×Ñ˜mÔ+Ø1A×1GÒ1GÓHÑ1G¨AÔ$ QÖ'Ñ1GˆÐHÜ#IØó$
Ð ô ˜4¨eÓNÐNùò Is   ÁA9c               ó    € V ^8„  d   QhRRRR/# )r   rŒ   ztorch.fx.Graphr   r\   r   )r   s   "r   r    r      s   € ÷ ñ  ð Ð3Hñ r!   c                óz   € V P                    Uu. uF   qP                  R 8X  g   K  \        V4      NK"  	  up# u upi )rŠ   )r�   rŽ   r¤   )rŒ   r–   s   & r   Úget_placeholder_infor¨     s9   € à.3¯kªkóÙ.9 d¿W¹WÈÑ=UÔ!Ô˜DÖ!©kñð ùò s   �8¦8c               ó    € V ^8„  d   QhRRRR/# )r   ÚreasonrX   r   r   )r   s   "r   r    r      s   € ÷ 2ñ 2¨ð 2°ñ 2r!   c                ó   € R V  2# )zskipping cudagraphs due to r   )rª   s   &r   Úformat_default_skip_messager¬     s   € Ø(¨¨Ð1Ð1r!   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rg   rf   Úmutation_indicesz AbstractSet[int] | Sequence[int]r   rX   r   )r   s   "r   r    r      s&   € ÷ ñ Ø+ðà6ðð 	ñr!   c                ó¤   € R pV F   pW,          p\        V4      ;p'       g   K    M	  \        R\        V4       R24      pV'       d   V RV 2# V# )Ú zmutated inputs (rŸ   ú. Found from : 
 )r…   r¬   rt   )rg   r®   r[   r—   rŠ   r    s   &&    r   Úget_mutation_stack_tracer²     sl   € ð !€KãˆØ"Õ'ˆÜ6°{ÓCÐCˆ;×CÐCÙñ  ô
 &Ø
œ3Ð/Ó0Ð1°Ð=ó€C÷ Ø�Ð(¨¨Ð6Ð6à€Jr!   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Úfuncrd   Úinputsúlist[InputType]Úis_cuda_graph_recorded_tensorzCallable[[torch.Tensor], bool]r   rZ   r   )r   s   "r   r    r    1  s1   € ÷ ñ Ø
ðàðð $Bðð ñ	r!   c                óÀ  € \         P                  P                  P                  P                  '       dE   V P
                   Uu. uF-  pW0P                  9   d   K  V! W,          4      '       d   K+  VNK/  	  ppMV P
                  p\        P                  R V P                  4       \        P                  RV4       V'       d   \        V P                  V4      # R# u upi )z'check mutation static input indices: %szcheck mutation indices: %sN)rz   Ú	_inductorr   r$   Úcudagraph_treesrh   r2   Ústatic_inputs_logÚdebugr²   rg   )r´   rµ   r·   r—   r®   s   &&&  r   Úcheck_for_mutationr½   1  sÑ   € ô ‡�×Ñ×$Ñ$×4×4Ð4ð ×.Ò.ó+
á.�à×-Ñ-Ñ-ô ñ 1°µ×=÷	 ˆCÙ.ð 	ð +
Ðð  ×2Ñ2Ðä×ÑØ1°4×3IÑ3Iôô ×ÑÐ8Ð:JÔK÷ ô 	! ×!2Ñ!2Ð4DÓEðð ðùò!+
s   ÁCÁCÁ0Cc               ó    € V ^8„  d   QhRRRR/# )r   r–   rq   r   rZ   r   )r   s   "r   r    r    P  s   € ÷ ñ ˜}ð °ñ r!   c                ó|   € V P                    F+  pVP                  P                  R R4      ;p'       g   K)  Vu # 	  R# )r[   N)r]   rw   rx   )r–   r   r[   s   &  r   Ú_get_use_stack_tracerÀ   P  s8   € Ø�zŒzˆØŸ(™(Ÿ,™, }°dÓ;Ð;ˆ;×;Ð;ØÒñ ñ r!   c               ó    € V ^8„  d   QhRRRR/# ©r   Údevice_node_mappingz!dict[torch.device, torch.fx.Node]r   rZ   r   )r   s   "r   r    r    W  s    € ÷ Tñ TØ:ðTàñTr!   c                ób  € V P                  \        P                  ! R 4      R4       \        4       '       d'   V P                  \        P                  ! R4      R4       V P	                  \        P                  ! R4      4      ;p'       d?   RVP
                   R2p\        V4      ;p'       d   \        V RV 24      # \        V4      # \        V 4      ^8X  d4   \        \        V P                  4       4      4      P                  R8X  d   R# R V  4       p\        RR	P                  V4       24      # )
rw   NÚcpuzcpu device (Ú)r±   Úcudac              3  ó8   "  € T F  p\        V4      x € K  	  R # 5ir„   )Úrepr)Ú.0Úkeys   & r   Ú	<genexpr>Ú:check_multiple_devices_or_any_cpu_nodes.<locals>.<genexpr>o  s   é € Ð:Ñ&9˜s”�c—�Ó&9ùs   ‚zmultiple devices: z, )Úpoprz   Údevicer   rx   rY   rÀ   r¬   rt   ru   rv   ÚkeysÚtypeÚjoin)rÃ   Úcpu_noder    r[   Ú	keys_reprs   &    r   Ú'check_multiple_devices_or_any_cpu_nodesrÕ   W  s  € ð ×ÑœEŸLšL¨Ó0°$Ô7ô $×%Ò%à×Ñ¤§¢¨UÓ 3°TÔ:à&×*Ñ*¬5¯<ª<¸Ó+>Ó?Ð?€xÖ?Ø˜XŸ]™]˜O¨1Ð-ˆÜ.¨xÓ8Ð8ˆ;Ö8Ü.°#°Ð6HÈÈÐ/VÓWÐWä*¨3Ó/Ð/ô 	ÐÓ  AÔ%Ü”Ð)×.Ñ.Ó0Ó1Ó2×7Ñ7¸6ÔAáá:Ñ&9Ó:€IÜ&Ð);¸D¿I¹IÀiÓ<PÐ;QÐ'RÓSÐSr!   c               ó   € V ^8„  d   QhRR/# )r   r   rZ   r   )r   s   "r   r    r    s  s   € ÷ ñ °
ñ r!   c                 ó¬   € \         P                  P                  4       '       d0   \         P                  P	                  4       '       g   \        R4      # R# )a¹  Skip cudagraphs when the CUDA/HIP caching allocator is disabled
(via ``torch.cuda.caching_allocator_enable(False)`` or the env-var
bypass ``PYTORCH_NO_(CUDA|HIP)_MEMORY_CACHING``). Cudagraph capture
pools allocations through the caching allocator; with it bypassed,
capture appears to succeed but pool tracking diverges (see
check_memory_pool in cudagraph_trees.py), surfacing as 'storage data
ptrs not allocated in pool ...' at replay time.zOcudagraph capture requires the caching allocator; current allocator is uncachedN)rz   rÇ   Úis_availableÚ_CÚ%_cuda_cudaCachingAllocator_is_enabledr¬   r   r!   r   Ú&check_caching_allocator_for_cudagraphsrÛ   s  sA   € ô 	�
‰
×Ñ×!Ò!ä—‘×>Ñ>×@Ò@ä*ð,ó
ð 	
ñ r!   c               ó    € V ^8„  d   QhRRRR/# rÂ   r   )r   s   "r   r    r    ‡  s   € ÷ ñ Ø:ðàñr!   c                ó<   € \        4       ;'       g    \        V 4      # r„   )rÛ   rÕ   )rÃ   s   &r   Ú check_lowering_disable_cudagraphrÞ   ‡  s$   € ô 	/Ó0÷ 	Hð 	HÜ2Ð3FÓGðr!   c               ó    € V ^8„  d   QhRRRR/# )r   r    rX   r   ÚNoner   )r   s   "r   r    r    �  s   € ÷ 	Jñ 	J¨Sð 	J°Tñ 	Jr!   c                óZ  € \         P                  V 4       \        R ,          R;;,          ^,          uu&   \        P                  P
                  P                  P                  '       d   \        V 4      h\        4       pVP                  4       '       d   VP                  RV RR7       R# R# )ÚinductorÚcudagraph_skipsÚcudagraph_skip_reasonT)Ú	overwriteN)Úcudagraphs_logÚwarningr
   rz   r¹   r   r$   Úcudagraph_or_errorÚRuntimeErrorr   Úin_progressÚset)r    Úmetrics_contexts   & r   Ú#log_cudagraph_skip_and_bump_counterrí   �  s   € Ü×Ñ˜3ÔÜˆZÕÐ*×+¨qÕ0Ó+ä‡�×Ñ×$Ñ$×7×7Ð7Ü˜3ÓÐä)Ó+€OØ×"Ñ"×$Ò$Ø×ÑÐ3°SÀDÐÖIñ %r!   c                  ó.   € ] tR tRt$ R]R&   R R ltRtR# )ÚBoxedDeviceIndexiœ  ú
int | NoneÚvaluec               ó    € V ^8„  d   QhRRRR/# )r   Ú
device_idxrð   r   rà   r   )r   s   "r   r    ÚBoxedDeviceIndex.__annotate__   s   € ÷  ñ  ˜jð  ¨Tñ  r!   c                	ód   € Ve&   \        V\        4      '       g   \        RV: 24      hWn        R # )Nz+expected device_idx to be None or int, got )r’   r5   r&   rñ   )r=   ró   s   &&r   rë   ÚBoxedDeviceIndex.set   s2   € ØÒ"¤j°¼S×&AÒ&AÜ Ø=¸j¹^ÐLóð ð  Ž
r!   )rñ   N)rI   rJ   rK   rL   rU   rë   rN   r   r!   r   rï   rï   œ  s   ‡ àÓ÷ ñ  r!   rï   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   r‡   rˆ   Úmutated_inputszOrderedSet[str]rh   ra   r2   r3   r   rZ   r   )r   s   "r   r    r    ¨  s:   € ÷ 9ñ 9Øð9à#ð9ð (ð9ð %ð	9ð
 ñ9r!   c                óv  € \        R 4      p\        P                  P                  P                  P
                  '       d]   \        V4      pV Uu. uF  qfV9  g   K  VNK  	  pp\        V4      ^ 8g  pV'       g   R# \        V P                  4      p	\        W—4      # \        V4      ^ 8g  pV'       g   R# T# u upi )zmutated inputsN)r¬   rz   r¹   r   r$   rº   r   rt   r¨   rŒ   r²   )
r‡   rø   rh   r2   Údefault_msgÚunique_idxsr—   r®   Úhas_mutationrg   s
   &&&&      r   Ú3check_for_mutation_ignore_cuda_graph_managed_tensorrý   ¨  s©   € ô .Ð.>Ó?€Kô ‡�×Ñ×$Ñ$×4×4Ð4Ü Ð!2Ó3ˆá+=ÓXÑ+= CÈKÑAWŸC˜CÑ+=ÐÐXÜÐ+Ó,°Ñ1ˆßÙÜ+¨B¯H©HÓ5ˆÜ'¨ÓGÐGô ˜>Ó*¨aÑ/ˆß'ˆtÐ8¨[Ð8ùò Ys   ÁB6ÁB6c               ó    € V ^8„  d   QhRRRR/# )r   rŠ   rW   r   rZ   r   )r   s   "r   r    r    À  s   € ÷ ñ ¨_ð Àñ r!   c                ó¨   € V P                   '       d   V P                   # V P                   F#  pVP                   '       g   K  VP                   u # 	  R# )zE
Gets the first non-empty stack trace of a placeholder or its users.
N)r[   r]   )rŠ   Úusers   & r   Úget_placeholder_stack_tracer  À  sI   € ð ××ÐØ×&Ñ&Ð&à×!Ô!ˆØ××ÒØ×#Ñ#Ò#ñ "ñ r!   c                  ó2   € ] tR tRt^t^t^t^tR R ltRt	R# )ÚCheckInvariantStatusiÎ  c               ó   € V ^8„  d   QhRR/# ©r   r   rX   r   )r   s   "r   r    Ú!CheckInvariantStatus.__annotate__Û  s   € ÷ 0ñ 0˜ñ 0r!   c                	óª   € V P                   R 8X  d   R# V P                   R8X  d   R# V P                   R8X  d   R# V P                    RV P                   2# )ÚCudagraphManagedIdxMismatchz-cudagraph managed tensor data pointer changedÚStaticInputIdxMismatchz!static input data pointer changedÚ&ExpectedDeadIndicesBeforeGraphMismatchz+expected dead indices before graph are livez: )rY   rñ   )r=   s   &r   Ú__str__ÚCheckInvariantStatus.__str__Û  sK   € Ø�9‰9Ð5Ô5ÙBØ�Y‰YÐ2Ô2Ù6Ø�Y‰YÐBÔBÙ@à—i‘i�[  4§:¡: ,Ð/Ð/r!   r   N)
rI   rJ   rK   rL   ÚSUCCESSr  r	  r
  r  rN   r   r!   r   r  r  Î  s)   † à€Gð #$Ðð Ðð ./Ð*÷0ñ 0r!   r  c               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )r   rg   rf   rµ   r¶   Úrecorded_data_ptrzSequence[int | None]Útarget_idxsr3   Úmismatchr  r   rX   r   )r   s   "r   r    r    æ  sD   € ÷ ñ Ø+ðàðð ,ðð ð	ð
 #ðð 	ñr!   c                óZ  € \        V4      \        V4      8X  d   \        V4      \        V 4      8X  g   \        R4      hV Uu. uF  qQV,          NK  	  ppV Uu. uF  qRV,          NK  	  ppV R2p\        \        Wg4      4       F˜  w  pw  rš\	        V	\
        P                  4      '       g   \        R\        V	4       24      hW5,          pV	P                  4       V
8w  g   K^  W,          pV RVP                   RV
 RV	P                  4        R\        V4       R2
pKš  	  V# u upi u upi )	zq
Logs the mismatch between input data pointers and recorded data pointers.
This checks only idxs in target_idxs.
zClength mismatch between inputs, recorded_data_ptr, and placeholdersz.
zexpected torch.Tensor, got zinput name: z. data pointer changed from z to z. input stack trace: Ú
)rt   r&   r�   Úzipr’   rz   ÚTensorrÑ   Údata_ptrrY   r  )rg   rµ   r  r  r  r¥   Ú	t_tensorsÚt_data_ptrsÚ	error_msgÚtensorr  ÚindexrŠ   s   &&&&&        r   Úlog_data_ptr_mismatchr  æ  s1  € ô �‹Kœ3Ð0Ó1Ô1´c¸&³kÄSÈÓEVÔ6VÜØQó
ð 	
ñ %0Ó0¡K˜q˜—�¡K€IÐ0Ù1<Ó=±¨A Q×'Ð'±€KÐ=Ø�*˜CÐ €IÜ!*¬3¨yÓ+FÖ!GÑˆÑˆFÜ˜&¤%§,¡,×/Ò/Ü Ð#>¼tÀF»|¸nÐ!MÓNÐNØ•ˆØ�?‰?Ó Ö(Ø&Õ-ˆKà�+˜\¨+×*:Ñ*:Ð);ð <-Ø-5¨J°d¸6¿?¹?Ó;LÐ:Mð N&Ü&AÀ+Ó&NÐ%OÈrðSò ñ "Hð Ðùò 1ùÚ=s   ÁD#ÁD(c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úfn_cachez)dict[tuple[int, ...], Callable[..., Any]]Únew_int_keyr   r   r)   r   )r   s   "r   r    r      s&   € ÷ ñ Ø7ðàðð 
ñr!   c                ó`  a€ \        V P                  4       4      ^,           oR V3R llp\        P                  P                  P
                  P                  '       dP   S\        P                  P                  P
                  P                  8”  d   \        P                  V! 4       4       R# R# )rs   c               ó   € V ^8„  d   QhRR/# r  r   )r   s   "r   r    Ú8maybe_warning_due_to_dynamic_shape.<locals>.__annotate__  s   € ÷ 

ñ 

�cñ 

r!   c                 ó   <€ R S  R2# )z¤CUDAGraph supports dynamic shapes by recording a new graph for each distinct input size. Recording too many CUDAGraphs may lead to extra overhead. We have observed a0   distinct sizes. Please consider the following options for better performance: a) padding inputs to a few fixed number of shapes; or b) set torch._inductor.config.triton.cudagraph_skip_dynamic_graphs=True. Set torch._inductor.config.triton.cudagraph_dynamic_shape_warn_limit=None to silence this warning.r   )Únum_cudagraphss   €r   Úwarn_msgÚ4maybe_warning_due_to_dynamic_shape.<locals>.warn_msg  s   ø€ ð0à0>Ð/?ð @'ð'ð		
r!   TF)	rt   rÐ   rz   r¹   r   r$   Ú"cudagraph_dynamic_shape_warn_limitræ   rç   )r  r  r%  r$  s   && @r   Ú"maybe_warning_due_to_dynamic_shaper(    s|   ø€ ô ˜Ÿ™›Ó)¨AÕ-€N÷

ð 

ô 	�‰×Ñ×%Ñ%×H×HÐHØÜ
�/‰/×
 Ñ
 ×
'Ñ
'×
JÑ
JôKô 	×Ñ™x›zÔ*Ùár!   )rO   c                  óD   € ] tR tRt$ RtR]R&   R]R&   R]R&   R	]R
&   RtR# )ÚCudagraphCachedInfoi$  z
Info needed to realign inputs
rf   rg   úlist[str | None]Ústack_tracesr3   rk   z	list[str]Úcudagraph_fail_reasonsr   NrT   r   r!   r   r*  r*  $  s!   ‡ ñð ,Ó+Ø"Ó"Ø+Ó+Ø%×%r!   r*  c                  óX   € ] tR tRt$ RtR]R&   R]R&   R]R&   R]R	&   R]R
&   R]R&   RtR# )ÚCudagraphMetadatai0  z&
Metadata for recording a CUDA graph.
rf   rg   ra   r2   rh   r+  r,  rk   zdict[str, torch.Tensor]re   r   NrT   r   r!   r   r/  r/  0  s-   ‡ ñð ,Ó+Ø&Ó&Ø'Ó'Ø"Ó"Ø-Ó-Ø&×&r!   r/  c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úpartition_mapr   Úmetadatar/  r   r   )r   s   "r   r    r    >  s+   € ÷ Fñ FØ$ðFàðFð ñFr!   c                óˆ  € . p\        4       p\        4       p\        V P                  4       F�  w  rVWaP                  9   d   VP	                  V4       WaP
                  9   d   VP	                  V4       Ve   VP                  V,          pM\        RV P                   RV 2R. RR7      pVP                  V4       K‘  	  . p\        4       p	\        V P                  4       Fš  w  r«V'       g   VP                  R4       K   V Uu. uF  pWÁP                  9   g   K  VNK  	  ppV'       d
   V^ ,          MV^ ,          pVP                  VP                  V,          4       V'       g   K‰  V	P	                  V
4       Kœ  	  V P                   Uu/ uF  qÿVP                  V,          bK  	  pp\        VVVVV	V4      # u upi u upi )z¿
Convert the cudagraph metadata at the graph level to the graph partition level,
given the graph partition info (i.e., mapping from partition input/output index
to graph input/output index).
NÚ
partition_Ú_placeholder_)rY   r[   r]   r^   )r   r�   Úinput_index_mappingr2   r•   rh   rg   rW   rS   ÚappendÚoutput_index_mappingrk   r,  Úconstant_namesre   r/  )r1  r2  Úpartition_placeholdersÚpartition_static_input_idxsÚpartition_mutated_input_idxsÚpartition_input_idxÚgraph_input_idxrŠ   Úpartition_stack_tracesÚ"partition_user_visible_output_idxsÚpartition_output_idxÚgraph_output_idxsÚgraph_output_idxÚuser_visible_graph_output_idxsÚstack_trace_idxrY   Úpartition_constantss   &&               r   Ú get_partition_cudagraph_metadatarG  >  sã  € ð  ÐÜ3=³<ÐÜ4>³LÐ Ü09Ø×)Ñ)ö1Ñ,Ðð ×8Ñ8Ô8Ø'×+Ñ+Ð,?Ô@à×9Ñ9Ô9Ø(×,Ñ,Ð-@ÔAàÒ&Ø"×/Ñ/°Õ@‰Kô *Ø! -×"2Ñ"2Ð!3°=ÐATÐ@UÐVØ ØØ)-ô	ˆKð 	×%Ñ% kÖ2ñ'1ð*  ÐÜ:D»,Ð&ô 4=Ø×*Ñ*ö4Ñ/Ð÷ !Ø"×)Ñ)¨$Ô/Ùñ %6ó*
á$5Ð Ø×#DÑ#DÑD÷ ÐÙ$5ð 	'ð *
÷ .ð +¨1Ö-à" 1Õ%ð 	ð
 	×%Ñ% h×&;Ñ&;¸OÕ&LÔMß)Ñ)Ø.×2Ñ2Ð3GÖHñ'4ð, 4A×3OÒ3OóÙ3O¨4ˆh× Ñ  Õ&Ò&Ñ3Oð ð ô ØØ#Ø$ØØ*Øóð ùò%*
ùòs   ÄF:ÄF:ÆF?c               ó    € V ^8„  d   QhRRRR/# )r   ÚobjÚobjectr   ra   r   )r   s   "r   r    r    ‡  s   € ÷ ñ  ð ¨?ñ r!   c                ó¸  € \        V \        P                  4      '       g   \        4       # \        4       p\	        V . R7       F‚  p\        V4      \        P                  Jd   K"  \        V4      '       g.   VP                  '       g   VP                  P
                  R8w  d   Kb   VP                  VP                  4       4       K„  	  V#   \         d     K–  i ; i)zODebug helper that collects the data pointers of all CUDA tensors in the object.)ÚoutrÇ   )r’   rz   r  r   r   rÑ   r   Úis_metarÏ   r•   r  Ú	Exception)rI  ÚptrsÚbases   &  r   Úcollect_cuda_data_ptrsrQ  ‡  s�   € ä�cœ5Ÿ<™<×(Ò(Ü‹|Ðä&›L€DÜ! #¨2×.ˆÜ�‹:œUŸ\™\Ó)ÙÜ�4�=Š=˜DŸLŸL˜L¨D¯K©K×,<Ñ,<ÀÔ,FÙð	Ø�H‰H�T—]‘]“_Ö%ñ /ð €Køô ô 	Úð	ús   Â%C
Ã
CÃC)VÚ
__future__r   rl   Úcollections.abcr   Úenumr   Útypingr   r   r   r	   rz   Útorch._dynamo.utilsr
   r   Útorch._inductor.utilsr   r   Útorch._subclasses.fake_tensorr   r   Útorch.utils._ordered_setr   r°   r   Úutilsr   r   r   ÚAbstractSetÚtorch._inductor.output_coder   r   Ú_loggingÚgetArtifactLoggerrI   ræ   r»   Úlistr5   r  Ú
OutputTypeÚ	ModelTyper%   r+   r{   r|   Úset_r~   Úsource_StorageÚsource_Storage_storage_offsetÚsource_TensorÚsource_Tensor_storage_offsetÚshallow_copy_data_r�   r-   Ú	dataclassrR   rW   r`   rd   r€   r…   r›   r¡   r¤   r¨   r¬   r²   r½   rÀ   rÕ   rÛ   rÞ   rí   rï   rý   r  r  r  r(  r*  r/  rG  rQ  r   r!   r   Ú<module>ri     sÈ  ðå "ã Ý $Ý ß 7Ó 7ã ß =ß >ß DÝ /å Ý /÷ ß<å6áˆe˜<Ô(€ð —‘×1Ñ1°(¸LÓI€Ø—N‘N×4Ñ4ØÐ'óÐ ð
 �#˜Ÿ™Õ$ tÕ+Õ,€
Ø�d˜9•oÐ&¨
Ð2Õ3€	õõBð
 
‡I�I‡N�N×Ñ×ÑØ	‡I�I‡N�N×Ñ×&Ñ&Ø	‡I�I‡N�N×Ñ×5Ñ5Ø	‡I�I‡N�N×Ñ×%Ñ%Ø	‡I�I‡N�N×Ñ×4Ñ4Ø	‡I�I‡N�N×%Ñ%×-Ñ-ð"Ð ÷Tñ Tðn ×Ò˜d¨$Ô/÷ð ó 0ðð ×Ò˜d¨$Ô/÷)ð )ó 0ð)ð ×Ò˜d¨$Ô/÷ð ó 0ðð
 ×Ò˜d¨$Ô/÷ð ó 0ðõ&õ5õNõ<õOõõ2õõ(õ>õTõ8õ(õ	Jð ×Ñ÷ ð  ó ð õ9õ0ô0˜4ô 0õ0õBð: ×Ò˜dÔ#÷&ð &ó $ð&ð ×Ò˜dÔ#÷
'ð 
'ó $ð
'õF÷Rr!   