+
    üäûjÍm ã                  óÌ  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI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u Ht ^ RIH t  ^ RI!H"t" ^ RI#H$t$ ^ R	I%H&t& ^ R
I'H(t( ]PR                  ! ]*4      t+]'       d   ^ RIH,t, ^ RI-H.t. ^ RI/H0t0 ^ RI1H2t2 ^ RI3H4t4 . t5R]6R&   Rt7^t8]! R]94      t:];]<]9R,          ]9R,          ]9R,          3,          t=]>]9];]9R,          ]9R,          3,          3,          R,          t?]! / 4      t@R]6R&    ! R R]A4      tB]P†                  ! RR7       ! R R4      4       tD ! R R4      tE ! R R4      tFR tG ! R! R"]F4      tHR# R$ ltIR% R& ltJR' R( ltKR) R* ltLR+ R, ltMR- R. ltNR/ R0 ltOR1 R2 ltPR3 R4 ltQR5 R6 ltRR7 R8 ltSR9 R: ltTR; R< ltUR= R> ltVR? R@ ltWRA RB ltXRC RD ltYR‰RE RF lltZ ! RG RH4      t[RIt\RJ RK lt]RL RM lt^RN RO lt_RPt`RQ RR ltaRStbRT RU ltcRVtdRWRXRYRZ/teR[ R\ ltfR] R^ ltgR_ R` lthRa Rb ltiRc Rd ltjRe Rf ltkRg Rh ltlRi Rj ltmRk Rl ltnRm Rn ltoRo Rp ltp ! Rq Rr]E4      tqRsR/Rt Ru lltr]s! ]Pè                  ]Pê                  ]Pì                  ]Pî                  04      txRv Rw ltyRx Ry ltzRz R{ lt{R| R} lt|R~R/R€ R� llt}R‚]D! 4       RƒR„/R… R† llt~R‡ Rˆ ltR# )Ša¸  Ahead-of-time precompilation: the make_fx capture internals behind the public
``torch.compiler.precompile`` module.

``torch/compiler/precompile.py`` re-exports the public types defined here --
``Capture``, ``MakeFxTracer``, ``PrecompiledRunnable`` -- beside
``PrecompileSummary``, and the two caller-driven entry points defined here:
``capture``, which writes the pair from the calls the caller makes, and ``load``,
which reconstructs a runnable from it.
``PrecompiledModule`` drives a NON-STRICT make_fx trace of one execution of ``fn``
and renders it as a self-contained, executable ``python_code`` string plus a
companion integrity-tagged ``cache``: with ``backend="inductor"`` (the default) the
captured graph is lowered through the AOT backend contract
(``torch._functorch.aot_autograd.compile_to_python``, AOTAutograd + Inductor), and
``python_code`` JIT-compiles kernels on first call while the cache primes them so a
warm reload skips JIT; with ``backend="eager"`` ``python_code`` inlines the captured
graph and runs on its own. ``_runnable_from_pair`` is the loader core that turns a
pair back into a runnable. The multi-graph (Dynamo) frame records and driver
emitter at the end of the module serve the same artifact format for a capture that
graph-breaks or recompiles.

The full contract, the calling convention, and the cache / code_hash design all live in
Note [precompile programming model] below; every public entry point and guard references
it.
)ÚannotationsN)ÚCallable)ÚMappingProxyType)ÚAnyÚcastÚNewTypeÚTYPE_CHECKING)ÚTensor)Údetect_fake_mode)Úmake_fx)Ú	stateless)Úis_traceable_wrapper_subclass)ÚMapping)ÚSelf©ÚPySourceBuilder©ÚFakeTensorMode)ÚPrecompileSummaryú	list[str]Ú__all__ztorch.compiler.precompileÚ_ModuleIndexzMapping[int, Any]Ú	_NO_MARKSc                  ó   € ] tR tRtRtRtRtR# )ÚPrecompileErrori>  au  The error type raised by ``torch.compiler.precompile`` and its artifacts.

Raised when capture, lowering, ``load``, or a runtime call violates the precompile
contract -- e.g. a tensor baked as a constant (invariant 1), an unsupported /
effectful op, a nested example input, which capture does not support on either path
(invariant 3), an UNBACKED capture attempted inside another trace (invariant 3), a
non-tensor output the inductor backend cannot lower, or a runtime input whose shape or
memory format differs from the example (invariants 3 and 6).
See Note [precompile programming model] in this module for the full contract.
ztorch.compiler© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚMC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\_precompile.pyr   r   >  s   † ñ	ð "„Jr"   r   T)Úfrozenc                  ó*   € ] tR tRt$ RtRtR]R&   RtR# )ÚMakeFxTraceriP  a#  The ``make_fx`` capture front-end, passed as ``tracer=`` to a precompile capture.

A NON-STRICT single make_fx trace: it records the ATen ops of ONE execution of
``fn``, so a ``capture`` with this tracer takes exactly one call and refuses a
second, and control flow and shapes are specialized to that call (the source of
the programming-model contract). Part of the prototype ``torch.compiler.precompile``
API, so it may change without a deprecation cycle.

The contract in brief (Note [precompile programming model] in
``torch/_precompile.py`` has the full list): every tensor ``fn`` reads is an
argument or a registered parameter/buffer of an ``nn.Module`` argument, and
shapes are static unless a dim is marked with ``mark_unbacked``
(``torch._dynamo.decorators``, inductor backend only) before the call: a
marked dim is captured as an unbacked symint, so one artifact serves any
runtime size of it, and a graph that needs to guard on it fails at capture.
Dims that must be equal at runtime must share a ``shape_id``: marked
independently they bake a silent equal-size assumption, and a mismatch at
runtime is not caught. Each input's dtype and device are specialized too (a
runtime mismatch is rejected), the inductor backend additionally specializes
on memory format, and a nested-tensor example input is refused.

``decompositions`` is an optional decomposition table (a dict mapping each
``OpOverload`` to a decomposition function) forwarded to ``make_fx`` as its
``decomposition_table``; it is specific to this tracer (Dynamo lowers through the
backend instead).
Núdict | NoneÚdecompositionsr   )r   r   r   r   r    r(   Ú__annotations__r!   r   r"   r#   r&   r&   P  s   ‡ ñð6 #'€N�K×&r"   r&   c                  óZ   € ] tR tRt$ RtRtR]R&   R R ltR R	 ltR
 R lt	R R lt
RtR# )ÚPrecompiledRunnableip  a  What ``torch.compiler.precompile.load`` returns.

A callable with the captured ``fn``'s calling convention that can also be
entered as a context manager and unloaded. A standalone artifact installs
nothing, so for it ``__enter__``/``__exit__``/:meth:`unload` are no-ops.
Part of the prototype ``torch.compiler.precompile`` API, so it may change
without a deprecation cycle.

Attributes:
    installed: Whether calling this handle installs onto the captured code
        objects; ``False`` for a standalone artifact.
FÚboolÚ	installedc               ó$   € V ^8„  d   QhRRRRRR/# ©é   ÚargsÚobjectÚkwargsÚreturnr   )Úformats   "r#   Ú__annotate__Ú PrecompiledRunnable.__annotate__€  ó!   € ÷ "ñ "˜fð "°ð "¸6ñ "r"   c                	ó   € \         h©N©ÚNotImplementedError©Úselfr1   r3   s   &*,r#   Ú__call__ÚPrecompiledRunnable.__call__€  ó   € Ü!Ð!r"   c               ó   € V ^8„  d   QhRR/# ©r0   r4   r   r   )r5   s   "r#   r6   r7   ƒ  s   € ÷ ñ ˜4ñ r"   c                	ó   € V # r:   r   ©r>   s   &r#   Ú	__enter__ÚPrecompiledRunnable.__enter__ƒ  s   € Øˆr"   c               ó    € V ^8„  d   QhRRRR/# ©r0   Úexcr2   r4   ÚNoner   )r5   s   "r#   r6   r7   †  s   € ÷ ñ ˜Vð ¨ñ r"   c                	ó&   € V P                  4        R # r:   )Úunload©r>   rJ   s   &*r#   Ú__exit__ÚPrecompiledRunnable.__exit__†  s   € Ø�‰Žr"   c               ó   € V ^8„  d   QhRR/# ©r0   r4   rK   r   )r5   s   "r#   r6   r7   ‰  s   € ÷ añ a˜ñ ar"   c                ó   € R# )zRRemove whatever this loaded artifact installed; a no-op when it installed nothing.Nr   rE   s   &r#   rM   ÚPrecompiledRunnable.unload‰  s   ‚ r"   r   N)r   r   r   r   r    r-   r)   r?   rF   rO   rM   r!   r   r"   r#   r+   r+   p  s.   ‡ ñð €IˆtÓõ"õõ÷añ ar"   r+   c                  óJ   € ] tR tRtRtR R ltR R ltR R ltR	 R
 ltRt	R# )ÚCapturei�  a.  The caller-driven capture ``torch.compiler.precompile.capture`` returns.

Part of the prototype ``torch.compiler.precompile`` API, so it may change
without a deprecation cycle. Enter it as a context manager to arm the
capture, call it exactly as you would ``fn`` inside the block -- each call
runs for real, is folded into the capture, and returns that run's result
-- and the artifact is written to the ``artifact_path`` / ``cache_path``
files when the block exits. How many calls a capture takes is the tracer's:
:class:`MakeFxTracer` takes exactly one. Call :meth:`save` inside the block
to write what has been captured so far to those same files without ending
the capture. A block that raises writes nothing it has not already saved,
and a block that made no call raises ``PrecompileError`` on exit rather
than writing an empty artifact. A capture is single-use: once its block
exits it cannot be entered again, so call ``capture()`` again to retry.
That includes a failed write at exit: the spent capture does not keep its
pair, so fix the path and capture again.
c               ó   € V ^8„  d   QhRR/# rC   r   )r5   s   "r#   r6   ÚCapture.__annotate__   s   € ÷ "ñ "˜4ñ "r"   c                	ó   € \         hr:   r;   rE   s   &r#   rF   ÚCapture.__enter__   rA   r"   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r5   s   "r#   r6   rX   £  s   € ÷ "ñ "˜Vð "¨ñ "r"   c                	ó   € \         hr:   r;   rN   s   &*r#   rO   ÚCapture.__exit__£  rA   r"   c               ó$   € V ^8„  d   QhRRRRRR/# r/   r   )r5   s   "r#   r6   rX   ¦  r8   r"   c                	ó   € \         hr:   r;   r=   s   &*,r#   r?   ÚCapture.__call__¦  rA   r"   c               ó   € V ^8„  d   QhRR/# rR   r   )r5   s   "r#   r6   rX   ©  s   € ÷ "ñ "�dñ "r"   c                ó   € \         h)z•Write everything captured so far to the artifact files without ending the capture.

Raises ``PrecompileError`` outside the capture's ``with`` block.
r;   rE   s   &r#   ÚsaveÚCapture.save©  s
   € ô
 "Ð!r"   r   N)
r   r   r   r   r    rF   rO   r?   rc   r!   r   r"   r#   rV   rV   �  s    † ñõ$"õ"õ"÷"ñ "r"   rV   zwcapture is not active: its block has already exited, and a capture is single-use; call capture() again for a fresh one.c                  ón   € ] tR tRtR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 ltRtR# )Ú_MakeFxCapturei·  a  Single-shot capture: the :class:`MakeFxTracer` front-end.

A make_fx trace records the ATen ops of ONE execution of ``fn``, so this
captures exactly one call and refuses a second -- there is no notion of
guards or recompiled variants here, and thus nothing a further call could
add.
c               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R/# )r0   ÚfnúCallable[..., object]Úartifact_pathústr | os.PathLike[str]Ú
cache_pathÚbackendÚstrr(   r'   r4   rK   r   )r5   s   "r#   r6   Ú_MakeFxCapture.__annotate__À  sF   € ÷ ñ à!ðð .ðð +ð	ð ðð $ðð 
ñr"   c               	ó|   € \        WR VR7      V n        W n        W0n        RV n        RV n        RV n        RV n        R# )r   )rm   Útracerr(   FN)ÚPrecompiledModuleÚ_moduleÚ_artifact_pathÚ_cache_pathÚ_enteredÚ_exitedÚ	_renderedÚ_called)r>   rh   rj   rl   rm   r(   s   &&&&$$r#   Ú__init__Ú_MakeFxCapture.__init__À  sA   € ô )Ø¨	À.ô
ˆŒð ,ÔØ%ÔØˆŒØˆŒØ37ˆŒØˆŽr"   c               ó   € V ^8„  d   QhRR/# rC   r   )r5   s   "r#   r6   ro   Ó  s   € ÷ 	ñ 	˜4ñ 	r"   c                	ó�   € V P                   '       d   \        \        4      hV P                  '       d   \        R 4      hRV n        V # )zRthis capture has already been entered; capture() returns a fresh capture per call.T)rw   r   Ú_SPENT_CAPTURErv   rE   s   &r#   rF   Ú_MakeFxCapture.__enter__Ó  s?   € Ø�<�<ˆ<Ü!¤.Ó1Ð1Ø�=�=ˆ=Ü!ð*óð ð ˆŒØˆr"   c               ó    € V ^8„  d   QhRRRR/# rI   r   )r5   s   "r#   r6   ro   Þ  s   € ÷ 	ñ 	˜Vð 	¨ñ 	r"   c                	ó\   € R V n         RV n        V^ ,          e   R# V P                  4        R# )FTN)rv   rw   Ú_writerN   s   &*r#   rO   Ú_MakeFxCapture.__exit__Þ  s(   € ð
 ˆŒØˆŒØˆq�6ÒÙØ�‰Žr"   c               ó   € V ^8„  d   QhRR/# rR   r   )r5   s   "r#   r6   ro   é  s   € ÷ ñ �dñ r"   c                ó¢   € V P                   '       d   \        \        4      hV P                  '       g   \        R4      hV P	                  4        R# )z¢Write the captured artifact to disk. A make_fx capture records a single
call, so there is nothing further to fold in; save() and block exit
write the same files.
zJcapture is not active: enter it with a `with` block before calling save().N)rw   r   r~   rv   r‚   rE   s   &r#   rc   Ú_MakeFxCapture.saveé  s>   € ð
 �<�<ˆ<Ü!¤.Ó1Ð1Ø�}�}ˆ}Ü!ð"óð ð 	�‰Žr"   c               ó   € V ^8„  d   QhRR/# rR   r   )r5   s   "r#   r6   ro   ÷  s   € ÷ ñ ˜ñ r"   c                	ó,  € V P                   f   V P                  '       d   \        R4      hV P                   f   \        R4      h \        V P                  V P
                  .V P                   O5!   R #   \         d   p\        RT 24      ThR p?ii ; i)NzNnothing was captured: the capture's call raised, so there is no pair to write.z[nothing was captured: call the capture with your example arguments inside the `with` block.z)precompile could not write the artifact: )rx   ry   r   Ú_write_artifactrt   ru   ÚOSError)r>   Úes   & r#   r‚   Ú_MakeFxCapture._write÷  s’   € Ø�>‰>Ò! d§l§l lÜ!ð!óð ð �>‰>Ò!Ü!ð5óð ð	Ü˜D×/Ñ/°×1AÑ1AÐSÀDÇNÁNÖSøÜô 	ä!Ø;¸A¸3Ð?óàðûð	ús   Á,A4 Á4BÁ?BÂBc               ó$   € V ^8„  d   QhRRRRRR/# r/   r   )r5   s   "r#   r6   ro   
  s!   € ÷ %ñ %˜fð %°ð %¸6ñ %r"   c                	ó   € V P                   '       d   \        \        4      hV P                  '       g   \        R 4      hV'       d   \	        R4      hV P
                  e   \        R4      hRV n        V P                  V4       V P                  P                  4       pW0P                  P                  V4      3p\        VRR/ ! V!  pW@n        V# )zrcapture is not active: enter it with a `with` block before calling it, or nothing is written when the block exits.z{MakeFxTracer takes positional arguments only; pass the model(s) and inputs positionally, as the loaded artifact takes them.z�MakeFxTracer captures a single call and one has already been traced; a make_fx trace records one execution, so a second call has nothing to add.TÚ_trusted)rw   r   r~   rv   Ú
ValueErrorrx   ry   Ú_trace_without_side_effectsrs   Úto_python_codeÚto_cache_bytesÚ_runnable_from_pair)r>   r1   r3   Úpython_codeÚrenderedÚresults   &*,   r#   r?   Ú_MakeFxCapture.__call__
  sÈ   € Ø�<�<ˆ<Ü!¤.Ó1Ð1Ø�}�}ˆ}Ü!ðJóð ÷ ÜðNóð ð �>‰>Ò%Ü!ð&óð ð
 ˆŒð 	×(Ñ(¨Ô.Ø—l‘l×1Ñ1Ó3ˆØ§¡×!<Ñ!<¸[Ó!IÐJˆÜ$ hÐ>¸Ò>ÀÑEˆØ!ŒØˆr"   c               ó    € V ^8„  d   QhRRRR/# ©r0   r1   útuple[object, ...]r4   rK   r   )r5   s   "r#   r6   ro   1  s   € ÷ )ñ )Ð0Bð )Àtñ )r"   c           	     	óÎ  € \        V4      '       d   V P                  P                  V4       R # V Uu. uF1  p\        V\        P
                  P                  4      '       g   K/  VNK3  	  pp\        P                  ! V4      pV UUu0 uF$  qUP                  4        F  p\        V4      kK  	  K&  	  uppV Uu0 uF  p\        V4      kK  	  up,
          p. R V 4       OVOp	V	 Uu/ uF`  p\        V\        P                  4      '       g   K%  \        V4      V9  g   K7  \        V4      WwP                  4       P                  4       3bKb  	  p
p V P                  P                  V4       \        P                  ! 4       ;_uu_ 4        V
P                  4        F4  w  r{\        P                   ! W{4      '       d   K#  VP#                  V4       K6  	  R R R 4       T P                  P$                  pTf   \'        R4      h\)        T\+        T P                  P,                  4      4      '       d   \/        R4      hR # u upi u uppi u upi u upi   + '       g   i     L†; i  \        P                  ! 4       ;_uu_ 4        T
P                  4        F4  w  r{\        P                   ! Y{4      '       d   K#  TP#                  T4       K6  	  R R R 4       i   + '       g   i     i ; i; i)Nc              3  óP   "  € T F  qP                  4        F  q"x € K  	  K  	  R # 5ir:   )Úbuffers)Ú.0ÚmÚbs   &  r#   Ú	<genexpr>Ú=_MakeFxCapture._trace_without_side_effects.<locals>.<genexpr>B  s   é € Ð:¡˜1¯i©i®k¨”Q©k‘Q£ùs   ‚$&z_compile left no traced graphzòMakeFxTracer cannot capture a fn that updates a parameter in place (e.g. an optimizer step): serving the capture would apply the update a second time, and the trace may already have applied it once. Step the optimizer outside the captured fn.)Ú_has_unbacked_marksrs   Ú_compileÚ
isinstanceÚtorchÚnnÚModuleÚpytreeÚtree_leavesÚ
parametersÚidr	   ÚdetachÚcloneÚno_gradÚvaluesÚequalÚcopy_Ú_gmÚAssertionErrorÚ_writes_a_parameterÚlenÚ_param_namesr   )r>   r1   ÚaÚmodsÚleavesr    ÚpÚtÚparamsÚtensorsÚsavedÚvalueÚgms   &&           r#   r‘   Ú*_MakeFxCapture._trace_without_side_effects1  s  € ô ˜t×$Ò$à�L‰L×!Ñ! $Ô'ÙÙÓB™4�a¤:¨a´·±·±×#A—�™4ˆÐBô ×#Ò# DÓ)ˆÙ!%Ô>¡˜A¯|©|®~¨!”"�Q–%©~‘%¡Ò>ÑQWÓAXÑQWÈAÄ"ÀQÆ%ÑQWÑAXÕXˆØDÑ:¡Ó:ÐD¸VÐDˆñ ó
á�Ü˜!œUŸ\™\×*ô +ä/1°!«u¸FÑ/Bô +ŒBˆq‹E�A—x‘x“z×'Ñ'Ó)Ð*Ò*Ùð 	ð 
ð
	'Ø�L‰L×!Ñ! $Ô'ô —’—•Ø %§¡¦‘H�AÜ Ÿ;š; q×0Ô0ØŸ™ žñ !/÷ !ð �\‰\×ÑˆØŠ:Ü Ð!@ÓAÐAÜ˜r¤3 t§|¡|×'@Ñ'@Ó#A×BÒBÜ!ð9óð ñ Cùò/ Cùó ?ùÒAXùò
÷ !—û”—’—•Ø %§¡¦‘H�AÜ Ÿ;š; q×0Ô0ØŸ™ žñ !/÷ !——�ýse   ³,H9Á$H9Â*H>Â8IÃ&"I	ÄI	Ä-I	ÅI! Æ/IÆ;IÉI	É!K$É?/K	Ê3K	Ë	K$ËK!ËK$)rt   ru   ry   rv   rw   rs   rx   N)r   r   r   r   r    rz   rF   rO   rc   r‚   r?   r‘   r!   r   r"   r#   rf   rf   ·  s0   † ñõõ&	õ	õõõ&%÷N)ñ )r"   rf   c               ó    € V ^8„  d   QhRRRR/# )r0   r½   r2   r4   ztuple[int, ...] | Noner   )r5   s   "r#   r6   r6   ]  s   € ÷ 	ñ 	�Fð 	Ð5ñ 	r"   c                ó’   € \        V \        P                  4      '       d'   \        V 4      '       g   \	        V P
                  4      # R# )a  Return the shape of a plain dense tensor, else ``None`` (non-tensor / subclass).

Tensor subclasses (e.g. DTensor) go through AOTAutograd's flatten path, so their
outer shape is not the dense shape the inductor artifact bakes; record ``None`` and
skip them in the shape check.
N)r¦   r§   r	   r   ÚtupleÚshape©r½   s   &r#   Ú_dense_shaperÉ   ]  s1   € ô �!”U—\‘\×"Ò"Ô+HÈ×+KÒ+KÜ�Q—W‘W‹~ÐÙr"   c               ó    € V ^8„  d   QhRRRR/# ©r0   r½   r2   r4   ú
str | Noner   )r5   s   "r#   r6   r6   i  s   € ÷ 
ñ 
�Fð 
˜zñ 
r"   c                ó’   € \        V \        P                  4      '       d'   \        V 4      '       g   \	        V P
                  4      # R# )as  Return the dtype of a plain dense tensor as a string, else ``None``.

Recorded as a string (e.g. ``"torch.float32"``) so it serializes into the artifact
metadata as a literal and compares cleanly against ``str(t.dtype)`` at runtime;
mirrors the _dense_shape convention (None for non-tensor / subclass leaves). The
graph is specialized to the example dtype (invariant 6).
N)r¦   r§   r	   r   rn   ÚdtyperÈ   s   &r#   Ú_dense_dtyperÏ   i  s1   € ô �!”U—\‘\×"Ò"Ô+HÈ×+KÒ+KÜ�1—7‘7‹|ÐÙr"   c               ó    € V ^8„  d   QhRRRR/# rË   r   )r5   s   "r#   r6   r6   v  s   € ÷ 	ñ 	�Vð 	 
ñ 	r"   c                ó’   € \        V \        P                  4      '       d'   \        V 4      '       g   \	        V P
                  4      # R# )a4  Return the device (as a string) of a plain dense tensor, else ``None``.

Recorded as a string so it serializes into the artifact metadata as a literal and
compares cleanly at runtime; mirrors _dense_shape (None for non-tensor / subclass
leaves). The graph is specialized to the example device (invariant 6).
N)r¦   r§   r	   r   rn   ÚdevicerÈ   s   &r#   Ú_dense_devicerÓ   v  s1   € ô �!”U—\‘\×"Ò"Ô+HÈ×+KÒ+KÜ�1—8‘8‹}ÐÙr"   c               ó    € V ^8„  d   QhRRRR/# )r0   rÂ   útorch.fx.GraphModuler4   zlist[tuple[str, object]]r   )r5   s   "r#   r6   r6   ‚  s   € ÷ ñ Øðàñr"   c                óê   € . pV P                   P                  RR7       FP  pT pVP                  P                  R4       F  p\	        W4R4      pK  	  VP                  VP                  V34       KR  	  V# )z”Return ``(target, attr)`` for every ``get_attr`` node, resolving dotted
qualnames the same way for both capture guards below (missing attr -> None).Úget_attr)ÚopÚ.N)ÚgraphÚ
find_nodesÚtargetÚsplitÚgetattrÚappend)rÂ   ÚresolvedÚnodeÚattrÚparts   &    r#   Ú_resolved_get_attrsrä   ‚  sk   € ð
 €HØ—‘×#Ñ# zÐ#Ö2ˆØˆØ—K‘K×%Ñ% cÖ*ˆDÜ˜4 tÓ,ŠDñ +à�‰˜Ÿ™ dÐ+Ö,ñ	 3ð
 €Or"   c               ó    € V ^8„  d   QhRRRR/# )r0   rá   ztorch.fx.Noder4   r2   r   )r5   s   "r#   r6   r6   �  s   € ÷ ñ ˜ð ¨6ñ r"   c                ó’  € V P                   \        P                  J d   V P                  ^ ,          # \	        V P                   RR4      pVe   VP
                  '       g   R# VP
                  ^ ,          P                  pVf   R# \        VP                  4       Fª  w  r4VP                  f   K  VP                  '       d0   VP                  P                  VP                  ,          '       g   KV  V\        V P                  4      8  d   V P                  V,          u # V P                  P                  VP                  4      u # 	  R# )zˆThe argument a view, alias or in-place result aliases (the ``out`` of an
``out=`` overload, the list behind a ``split`` piece), or None.Ú_schemaN)rÜ   ÚoperatorÚgetitemr1   rÞ   ÚreturnsÚ
alias_infoÚ	enumerateÚ	argumentsÚ
before_setr·   r3   ÚgetÚname)rá   ÚschemaÚretÚiÚargs   &    r#   Ú_aliased_inputrõ   �  sÜ   € ð ‡{�{”h×&Ñ&Ó&Ø�y‰y˜�|ÐÜ�T—[‘[ )¨TÓ2€FØ‚~˜VŸ^Ÿ^˜^ÙØ
�.‰.˜Õ
×
&Ñ
&€CØ
‚{ÙÜ˜F×,Ñ,Ö-‰ˆà�>‰>Ô%Ø——� #§.¡.×";Ñ";¸c¿n¹n×"LÖ"Là#$¤s¨4¯9©9£~Ô#5�4—9‘9˜Q•<ÒT¸4¿;¹;¿?¹?È3Ï8É8Ó;TÒTñ .ñ r"   c               ó$   € V ^8„  d   QhRRRRRR/# )r0   rÂ   rÕ   Ú
num_paramsÚintr4   r,   r   )r5   s   "r#   r6   r6   ¤  s"   € ÷ ñ Ð0ð ¸cð Àdñ r"   c                ó*  € V P                   P                   Uu. uF  q"P                  R8X  g   K  VNK  	  pp\        VRV 4      pV P                   P                   EF-  p\	        VP
                  RR4      pVf   K!  \        VP                  4       Fó  w  rxVP                  e   VP                  P                  '       g   K1  V\        VP                  4      8  d   VP                  V,          M$VP                  P                  VP                  4      p	\        V	\         \"        34      '       d   T	MV	. FK  p
\        V
\$        P&                  P(                  4      '       d   W¤9  d   \+        V
4      p
K=  W¤9   g   KH     R# 	  Kõ  	  EK0  	  R# u upi )a,  Whether a traced op writes into one of the first ``num_params`` placeholders
(the lifted parameters), directly or through a view or alias of one such as
``p.data`` or a ``chunk`` piece. Read off the graph because neither the version
counter nor a view's own counter records a write through ``.data``.ÚplaceholderNrç   TF)rÚ   ÚnodesrØ   ÚsetrÞ   rÜ   rì   rí   rë   Úis_writer·   r1   r3   rï   rð   r¦   ÚlistrÆ   r§   ÚfxÚNoderõ   )rÂ   r÷   ÚnÚplaceholdersÚparam_nodesrá   rñ   ró   rô   rÁ   Úbases   &&         r#   r¶   r¶   ¤  s$  € ð
  "Ÿx™xŸ~š~ÓG™~˜!·±¸Ñ1F—A�A™~€LÐGÜ�l ; JÐ/Ó0€KØ—‘—•ˆÜ˜Ÿ™ i°Ó6ˆØŠ>ÙÜ × 0Ñ 0Ö1‰FˆAØ�~‰~Ò%¨S¯^©^×-D×-DÐ-DÙØ$%¬¨D¯I©I«Ô$6�D—I‘I˜a–L¸D¿K¹K¿O¹OÈCÏHÉHÓ<UˆEä!+¨E´D¼%°=×!AÒ!A™ÈÀwÒN�Ü  ¤u§x¡x§}¡}×5Ò5¸$Ô:QÜ)¨$Ó/’DØÖ&Üó	 Oô 2ñ	 ñ ùò! Hs
   ™F°Fc               ó    € V ^8„  d   QhRRRR/# )r0   r1   r›   r4   r,   r   )r5   s   "r#   r6   r6   Æ  s   € ÷ 
ñ 
Ð0ð 
°Tñ 
r"   c                óº   € \         ;QJ d0    R \        P                  ! V 4       4       F  '       g   K   R# 	  R# ! R \        P                  ! V 4       4       4      # )zXTrue if any tensor reachable in ``args`` carries a mark_unbacked dim (backed or
strict).c              3  óª   "  € T FI  p\        V\        P                  4      ;'       d#    \        VR R4      ;'       g    \        VRR4      x € KK  	  R# 5i)Ú_dynamo_unbacked_indicesNÚ_dynamo_strict_unbacked_indices)r¦   r§   r	   rÞ   ©rŸ   r½   s   & r#   r¢   Ú&_has_unbacked_marks.<locals>.<genexpr>É  s[   é € ð ñ *ˆAô 	�1”e—l‘lÓ#÷ 	
ð 	
ä�AÐ1°4Ó8÷ Cð CÜ�qÐ;¸TÓBô	
ó
 *ùs   ‚%A¨A½ATF)Úanyrª   r«   )r1   s   &r#   r¤   r¤   Æ  sY   € ÷ ‹3ñ ô ×#Ò# DÔ)ó�3Œ3ð Š3ð ˆ3ñ ô ×#Ò# DÔ)óó ð r"   c               ó    € V ^8„  d   QhRRRR/# )r0   Ú	user_flatúlist[object]r4   rK   r   )r5   s   "r#   r6   r6   Ó  s   € ÷ ,ñ ,¨ð ,¸$ñ ,r"   c                ó  € V  Fý  p\        V\        P                  4      '       g   K%  \        V4      '       d2   \	        VRR4      '       g   \	        VRR4      '       d   \        R4      h\	        VRR4      '       d   \        R4      h\	        VRR4      pV'       g   Kœ  \        ;QJ d*    R VP                  4        4       F  '       g   K   R	M	  R
M! R VP                  4        4       4      '       g   Kô  \        R4      h	  R# )a"  Reject mark options precompile cannot honor, loudly (invariant 3).

precompile only honors mark_unbacked (backed unbacked dims) and mark_unbacked's
strict variant. Backed dynamic marks (mark_dynamic -> _dynamo_dynamic_indices) and
per-dim specialization (_specialize_on) have no analogue in the static/unbacked
capture path -- silently dropping them would bake a wrong artifact, so reject rather
than ignore. (mark_unbacked's hint_override is NOT rejected: it is a perf-only
autotuning size hint, never a guard, so the single artifact is valid regardless; it
is threaded into the capture ShapeEnv in _fakeify_with_unbacked.) A mark_unbacked dim
on a tensor SUBCLASS (e.g. DTensor) is rejected: the dynamic capture cannot preserve
the subclass through the refake, so it too would bake a wrong artifact.
r  Nr	  zýprecompile: an input is a tensor subclass (e.g. DTensor) with a mark_unbacked dynamic dim, which precompile cannot honor: the dynamic capture cannot preserve the subclass. Mark a dense input instead, or capture that dim static (do not mark_unbacked it).Ú_dynamo_dynamic_indiceszÎprecompile: an input has a mark_dynamic (backed dynamic) dim, which precompile cannot honor; it supports only mark_unbacked dynamic dims. Use torch._dynamo.decorators.mark_unbacked, or leave the dim static.Ú_specialize_onc              3  ó$   "  € T F  qx € K  	  R # 5ir:   r   )rŸ   Úvs   & r#   r¢   Ú,_reject_unsupported_marks.<locals>.<genexpr>ú  s   é € Ð CÑ,B q¤Ó,Bùs   ‚TFz°precompile: an input has a mark_unbacked specialize_on list, which precompile cannot honor (it produces a single artifact, not per-value specializations). Remove specialize_on.)r¦   r§   r	   r   rÞ   r   r  r±   )r  r½   Úspecialize_ons   &  r#   Ú_reject_unsupported_marksr  Ó  sá   € ó ˆÜ˜!œUŸ\™\×*Ò*Ùô )¨×+Ò+Ü�AÐ1°4×8Ò8Ü�qÐ;¸T×BÒBä!ðEóð ô �1Ð/°×6Ò6Ü!ðWóð ô
   Ð#3°TÓ:ˆß‰=ŸS›SÑ C¨M×,@Ñ,@Ô,BÓ CŸSŸSšSÑ C¨M×,@Ñ,@Ô,BÓ C×CÔCÜ!ð:óð ó7 r"   c               ó    € V ^8„  d   QhRRRR/# )r0   r‹   ÚBaseExceptionr4   r   r   )r5   s   "r#   r6   r6     s   € ÷ ñ ˜]ð ¨ñ r"   c                óp   € \        R\        V 4      P                  4       ;'       g    R.^ ,           24      # )az  The capture-time error for a guard on a mark_unbacked dim, shared by the capture paths.

A mark_unbacked dim is captured as an unbacked symint (no hint), so a computation that
needs to guard on / specialize its size (a shape-dependent branch, a reshape that pins
it) cannot be captured. Unbacked dims cannot be guarded, so rather than bake a
silently-wrong artifact, fail here.
a  precompile: fn needs to guard on a dim marked with mark_unbacked (it branches on or specializes that size), which is not allowed for an unbacked dynamic dim. Do not mark that dim (capture it static), or restructure fn to avoid the size-dependent operation. Underlying: Ú )r   rn   Ú
splitlines)r‹   s   &r#   Ú_unbacked_guard_errorr    s@   € ô ð	Pô �‹F×ÑÓ×'Ð' B 4¨Õ+Ð
,ð		.óð r"   c               ó    € V ^8„  d   QhRRRR/# )r0   r  r  r4   úlist[dict[int, _MarkSpec]]r   )r5   s   "r#   r6   r6     s   € ÷ %ñ % Lð %Ð5Oñ %r"   c                ó¸  € . pV  EFK  p\        V\        P                  4      '       g   VP                  / 4       K7  \	        \        VRR4      ;'       g    R4      pT\	        \        VRR4      ;'       g    R4      ,          pV'       g   VP                  / 4       K™  \        VR\        4      ;'       g    \        p\        VR\        4      ;'       g    \        p\        VR\        4      ;'       g    \        pTP                  V Uu/ uF9  pWtP                  V4      .VP                  VR4      OVP                  V4      N5bK;  	  up4       EKN  	  V# u upi )	a�  Read ``torch._dynamo.decorators.mark_unbacked`` marks off the user-input tensors.

Dynamic shapes are opt-in via that decorator (the caller marks dims before calling
precompile), NOT via a precompile kwarg -- so the precompile signature stays simple.
Returns a per-leaf list aligned to ``user_flat``; each entry maps a marked dim to
``(shape_id, min, max, hint_override)`` (None when unset), empty when the leaf has no
marks. Dims sharing a ``shape_id`` get the SAME unbacked symbol (so they are equal by
construction); ``min``/``max`` become runtime range asserts; ``hint_override`` is a
perf-only autotuning size hint applied to the symbol in _fakeify_with_unbacked.
r  Nr	  Ú_dynamo_shape_idsÚ_dynamo_unbacked_boundsÚ_dynamo_hint_overridesr   )NN)r¦   r§   r	   rß   rü   rÞ   r   rï   )r  Úmarksr½   ÚidxÚ	shape_idsÚboundsÚhintsÚds   &       r#   Ú_read_unbacked_marksr*    s*  € ð )+€EÜˆÜ˜!œUŸ\™\×*Ò*Ø�L‰L˜ÔÙô ”'˜!Ð7¸Ó>×DÐDÀ"ÓEˆØŒs”7˜1Ð?ÀÓF×LÐLÈ"ÓMÕMˆßØ�L‰L˜ÔÙÜ˜AÐ2´IÓ>×KÐKÄ)ˆ	Ü˜Ð5´yÓA×NÐNÄYˆÜ˜Ð3´YÓ?×LÐLÄ9ˆØ�‰ñ óá�Að —M‘M !Ó$ÐQ v§z¡z°!°\Ó'BÐQÀEÇIÁIÈaÃLÑQÒQÙñ÷	
ñ' ð2 €Lùòs   Ä
?E
c               ó    € V ^8„  d   QhRRRR/# )r0   r$  r  r4   úlist[_LeafBounds]r   )r5   s   "r#   r6   r6   ;  s   € ÷ ñ Ð8ð Ð=Nñ r"   c                ó®   € . pV  FL  p/ pVP                  4        F  w  pw  rVrxVf   Vf   K  Wg3W4&   K  	  TP                  T;'       g    R4       KN  	  V# )a–  Build the per-leaf runtime min/max bounds from the already-read mark_unbacked
marks, aligned to ``user_flat`` (so ``marks`` is the output of _read_unbacked_marks).

mark_unbacked promises (in its own docstring) a runtime check that the dim is >= min
and <= max; those bounds are applied as capture-time torch._check constraints in
_fakeify_with_unbacked, but unbacked symints cannot be guarded on, so they never
become a runtime guard on their own. We record them here so the driver enforces them.
Each entry is None when the leaf has no bounded marked dim, else a dict mapping a
marked dim index to ``(lo, hi)`` (either may be None); mirrors USER_INPUT_DTYPES.
N)Úitemsrß   )	r$  r'  ÚperÚper_leafr)  Ú	_shape_idÚloÚhiÚ_hints	   &        r#   Ú_read_input_boundsr5  ;  sa   € ð !#€FÛˆØ=?ˆØ-0¯Y©Y®[Ñ)ˆAÑ)�	˜rØŠ~ ¤Ø!˜h�“ñ .9ð 	�‰�h×&Ð& $Ö'ñ ð €Mr"   c               ó    € V ^8„  d   QhRRRR/# )r0   r½   ztorch.Tensorr4   ztorch.memory_formatr   )r5   s   "r#   r6   r6   P  s   € ÷ ñ ˜\ð Ð.Añ r"   c                ó\  € V P                  \        P                  R7      '       d   \        P                  # V P                  \        P                  R7      '       d   \        P                  # V P                  \        P                  R7      '       d   \        P                  # \        R4      h)a“  Return the example leaf's memory format so a refaked marked input preserves it.

A mark_unbacked dim refakes the leaf via torch.empty; defaulting to contiguous would
bake a contiguous assert_size_stride and reject a channels_last / transposed input
even at its own layout. Probe the recognized formats and raise on an exotic /
ambiguous layout we cannot capture rather than silently forcing contiguous.
)Úmemory_formata\  precompile: a mark_unbacked input has a memory format that is neither contiguous, channels_last, nor channels_last_3d (e.g. a transposed or otherwise non-standard layout); the dynamic-shape capture cannot preserve it. Pass the input in one of those layouts (.contiguous() to make it contiguous), or capture the dim static (do not mark_unbacked it).)Úis_contiguousr§   Úcontiguous_formatÚchannels_lastÚchannels_last_3dr   rÈ   s   &r#   Ú_detect_memory_formatr=  P  s   € ð 	‡�¤U×%<Ñ%<€×=Ò=Ü×&Ñ&Ð&Ø‡�¤U×%8Ñ%8€×9Ò9Ü×"Ñ"Ð"Ø‡�¤U×%;Ñ%;€×<Ò<Ü×%Ñ%Ð%Ü
ð	?óð r"   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r0   Úpb_flatúlist[Tensor]r  r  r$  r  r4   z#tuple[list[object], FakeTensorMode]r   )r5   s   "r#   r6   r6   g  s2   € ÷ P-ñ P-ØðP-Ø&2ðP-Ø;UðP-à(ñP-r"   c           
     ó®  € ^ RI Hu Hp ^ RIHp ^ RIHp V! 4       pVP                  RR7      ;_uu_ 4        V! VRRR7      pRRR4       / pX;_uu_ 4        V  U	u. uF  q—P                  V	RR7      NK  	  p
p	. p\        W4       EF  w  rÍ\        V\        P                  4      '       g   VP                  V4       K9  V'       g%   VP                  VP                  VRR7      4       Ke  . p\        VP                  4       EF*  w  ppWý9  d   VP                  \!        V4      4       K)  Wß,          w  ppppVe^   VV9   dW   VV,          pVe   \        P"                  ! VV8¬  4       Ve   \        P"                  ! VV8*  4       VP                  V4       K—  VP%                  4       p\        P"                  ! V^ 8¬  4       Ve   \        P"                  ! VV8¬  4       Ve   \        P"                  ! VV8*  4       Ve   VP'                  VV4       Ve   VVV&   VP                  V4       EK-  	  \)        V4      p\        P*                  ! VVP,                  VP.                  VR	7      pVP1                  VP2                  4       VP                  V4       EK  	  RRR4       . X
OXOV3#   + '       g   i     ELq; iu up	i   + '       g   i     L1; i)
aë  Fakeify the flat capture inputs for an unbacked dynamic-shape capture.

Params/buffers and unmarked dims become static fakes; each mark_unbacked dim becomes
an UNBACKED SymInt (unguardable, so the artifact is valid for any runtime size and a
graph that needs to guard on it fails at capture). Dims sharing a ``shape_id`` reuse
one symbol; ``min``/``max`` add runtime asserts. Returns ``(flat_fake, fake_mode)``;
the fake_mode (ShapeEnv) is threaded to the lowering via from_tracing_context.
Nr   )ÚShapeEnvF)Ú(fake_tensor_allow_unsafe_data_ptr_accessT)Ú	shape_envÚallow_non_fake_inputsÚallow_fallback_kernels)Ústatic_shapes)rÎ   rÒ   r8  )Útorch._functorch.configÚ
_functorchÚconfigÚtorch._subclasses.fake_tensorr   Ú%torch.fx.experimental.symbolic_shapesrB  ÚpatchÚfrom_tensorÚzipr¦   r§   r	   rß   rì   rÇ   rø   Ú_checkÚcreate_unbacked_symintÚ"_set_unbacked_var_to_hint_overrider=  ÚemptyrÎ   rÒ   Úrequires_grad_Úrequires_grad)r?  r  r$  Úfunctorch_configr   rB  rD  Ú	fake_modeÚsharedr½   Úfake_pbÚ	fake_userÚleafr/  Úsizesró   ÚsÚshape_idr2  r3  ÚhintÚur8  Úfs   &&&                     r#   Ú_fakeify_with_unbackedrb  g  se  € ÷ 7Ð6Ý<Ý>á“
€Ið 
×	Ñ	ÈÐ	×	OÕ	OÙ"ØØ"&Ø#(ô
ˆ	÷ 
Pð !#€Fß	ŠÙIPÓQÉÀA×(Ñ(¨¸$Ð(Ö?ÉˆÐQØ"$ˆ	Ü˜Y×.‰IˆDÜ˜d¤E§L¡L×1Ò1Ø× Ñ  Ö&ßØ× Ñ  ×!6Ñ!6°tÈ4Ð!6Ó!PÖQà#%�Ü% d§j¡j×1‘D�A�qØ”|ØŸ™¤S¨£VÔ,Ù Ø-0­VÑ*�H˜b " dØÒ+°¸FÔ0BØ" 8Õ,˜ð š>Ü!ŸLšL¨¨b©Ô1Øš>Ü!ŸLšL¨¨b©Ô1ØŸ™ QœÙ Ø!×8Ñ8Ó:�AÜ—L’L  a¡Ô(Ø’~ÜŸš Q¨"¡WÔ-Ø’~ÜŸš Q¨"¡WÔ-ð Ò'Ø!×DÑDÀQÈÔMØÒ+Ø+,˜˜xÑ(Ø—L‘L —Oñ; 2ô< !6°dÓ ;�Ü—K’KØØŸ*™*ØŸ;™;Ø"/ô	�ð × Ñ  ×!3Ñ!3Ô4Ø× Ñ  ×#ñ[ /÷ 
ðb "ˆWÐ!�yÐ! 9Ð,Ð,÷s 
P×	OÐ	Oüò R÷ 
�ús1   ·J+ÁKÁJ?Á7AKÃGKÊ+J<	Ê?KËK	c               ó$   € V ^8„  d   QhRRRRRR/# )r0   Úlabelrn   r¹   r	   r4   rK   r   )r5   s   "r#   r6   r6   º  s!   € ÷ !ñ ! sð !¨vð !¸$ñ !r"   c           
     ój  € VP                   '       d   \        RV  RVP                   R24      h\        V4      '       dt   VP	                  4       w  r#V FY  p\        W4      p\        V\        P                  4      '       g   K0  \        V  RV: R\        V4      P                   R2V4       K[  	  R# R# )a/  Refuse an example tensor capture cannot trace on.

``label`` is one of ``_capture``'s ``input_labels`` ("parameter w", "buffer nt", "user
input 0"), so each refusal names what the caller has to change. A NESTED input is
refused on BOTH capture paths, and worded as a restriction rather than as a claim about
either fake mode: the unbacked path's ShapeEnv could mint the symbolic nested int a
jagged tensor's ragged dim needs (a static capture has none, so fakeifying one there
dies on a raw internal assertion), but nothing downstream of the trace has a nested
representation either way -- the recorded dense shape/dtype/device the driver checks
against is None for one. Running ahead of every shape read also gets the STRIDED
layout, whose ``t.shape`` read raises inside NestedTensorImpl, this same named refusal.
zprecompile: example z is a nested tensor (z« layout), which capture does not support. Make it a plain dense tensor (or a supported subclass) -- on the model for a parameter/buffer, at the call site for a user input.z (inner tensor z of a z
 subclass)N)Ú	is_nestedr   Úlayoutr   Ú__tensor_flatten__rÞ   r¦   r§   r	   Ú_reject_unfakeifiable_inputÚtyper   )rd  r¹   ÚattrsÚ_rð   Úinners   &&    r#   ri  ri  º  sª   € ð 	‡{‡{€{ÜØ" 5 'Ð)>¸q¿x¹x¸jð I%ð %ó
ð 	
ô % Q×'Ò'Ø×'Ñ'Ó)‰ˆÛˆDÜ˜AÓ$ˆEä˜%¤§¡×.Ô.Ü+Ø�g˜_¨T©H°F¼4À»7×;KÑ;KÐ:LÈJÐWØöó	 ñ (r"   c               ó    € V ^8„  d   QhRRRR/# ©r0   rÂ   rÕ   r4   rK   r   )r5   s   "r#   r6   r6   Þ  s   € ÷ 
ñ 
Ð#7ð 
¸Dñ 
r"   c           	     ó  € \        V 4       UUu. uFR  w  r\        V\        P                  4      '       g   K'  V\	        VP
                  4      \        VP                  4      3NKT  	  pppV'       d   \        RV R24      hR# u uppi )aÁ  Enforce invariant 1 of Note [precompile programming model]: everything live
is an input.

Every legitimate tensor in a non-strict capture is a placeholder (a lifted
parameter/buffer or user input) or the result of a ``call_function`` node.
A ``get_attr`` pointing at a tensor therefore means some tensor was closed
over (a global, captured local, or non-registered module attribute) and would
be baked into the graph as a constant, which we forbid.
a˜  precompile traced a tensor that is neither a graph input (module parameter/buffer or user input) nor an intermediate. Such tensors would be hard-coded into the graph. This fires for a tensor closed over by fn (a global or captured local) or a plain (non-registered) module attribute, and also for a tensor literal constructed inside fn (e.g. torch.tensor([...])). Offending constants (target, shape, dtype): z©. Fix by passing the tensor as an explicit argument; for module state register it as a parameter/buffer, and for a literal hoist it out of fn and pass it as an argument.N)	rä   r¦   r§   r	   rÆ   rÇ   rn   rÎ   r   ©rÂ   rÜ   râ   Ú	offendings   &   r#   Ú_check_no_constant_tensorsrs  Þ  s‡   € ô 0°Ô3ôá3‰LˆFÜ�dœEŸL™L×)ô 	5ˆ”�t—z‘zÓ"¤C¨¯
©
£OÓ4Ù3ð ñ ÷
 Üð'ð (1 kð 2OðOó

ð 
	
ñ ùós
   �$B¸/Bc               ó    € V ^8„  d   QhRRRR/# ro  r   )r5   s   "r#   r6   r6   û  s   € ÷ 
ñ 
Ð*>ð 
À4ñ 
r"   c                óÔ   € \        V 4       UUu. uF3  w  r\        V\        P                  P                  4      '       g   K1  VNK5  	  pppV'       d   \        RV R24      hR# u uppi )aÈ  Reject captured control-flow HOP subgraphs (e.g. from ``torch.cond``).

They appear as ``get_attr`` nodes pointing at nested ``GraphModule`` submodules.
The eager backend inlines ``gm.code`` and cannot reach such submodules (they are
not on the standalone ``_GraphSelf`` holder), and the standalone composition does
not inline them either, so the artifact would crash at runtime. Fail at capture
with a concrete reason instead, like ``_assert_supported``.
z“precompile cannot lower a captured control-flow subgraph (e.g. from torch.cond / torch.while_loop); not supported yet. Offending get_attr targets: rÙ   N)rä   r¦   r§   rÿ   ÚGraphModuler   rq  s   &   r#   Ú!_assert_no_control_flow_subgraphsrw  û  sn   € ô 0°Ô3ôá3‰LˆFÜ�dœEŸH™H×0Ñ0×1÷ 	ˆÙ3ð ñ ÷
 Üðà!�{ !ð%ó
ð 	
ñ ùós   �.A$ÁA$c               ó    € V ^8„  d   QhRRRR/# )r0   rº   zlist[torch.nn.Module]r4   zStuple[list[Tensor], list[str], list[str], list[tuple[_ModuleIndex, str, int]], int]r   )r5   s   "r#   r6   r6     s"   € ÷ 4Hñ 4HØ
ð4Hðñ4Hr"   c                óš  a
aaa€ \        V 4      ^8”  d   R R lo
MR R lo
. o/ o. oR V
VVV3R llp. p\        V 4       F3  w  r4VP                  RR7       F  w  rVV! \        V4      WVV4       K  	  K5  	  \        S4      p. p\        V 4       F3  w  r4VP	                  RR7       F  w  rYV! \        V4      WYV4       K  	  K5  	  SW(SV3# )	a¦  Lift each module's parameters then buffers to a flat list, interning by
tensor identity so a tied weight becomes a single entry (one optimizer step,
accumulated gradient -- not one per name).

Returns ``(pb_flat, param_names, buffer_names, alias_entries, num_params)``,
where ``alias_entries`` maps each ``(module_index, name)`` to its index in
``pb_flat`` (used to reparametrize during capture). This same params-then-
buffers, intern-by-identity order is reproduced at runtime against the
user-supplied modules, so the dense list lines up with the compiled graph.

INVARIANT: the all-modules' params then all-modules' buffers, dedup-by-id ordering
here is load-bearing and is reproduced VERBATIM by
``torch._precompile_driver._extract_param_buffers`` (emitted into the inlined/eager
load paths). The cached load path uses this function directly, so both must stay
in sync; ``test_cached_and_inlined_paths_agree`` cross-checks them.
c               ó$   € V ^8„  d   QhRRRRRR/# ©r0   Úmir   r  rn   r4   r   )r5   s   "r#   r6   Ú+_intern_param_buffers.<locals>.__annotate__(  s!   € ÷ 	 ñ 	 �lð 	  sð 	 ¨sñ 	 r"   c                ó   € R V  RV 2# )r    rÙ   r   ©r|  r  s   &&r#   Ú_nameÚ$_intern_param_buffers.<locals>._name(  s   € Ø�r�d˜!˜A˜3�<Ðr"   c               ó$   € V ^8„  d   QhRRRRRR/# r{  r   )r5   s   "r#   r6   r}  ,  s!   € ÷ 	ñ 	�lð 	 sð 	¨sñ 	r"   c                ó   € V# r:   r   r  s   &&r#   r€  r�  ,  s   € ØˆHr"   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r0   r|  r   r  rn   r½   r	   Ú	names_outr   r4   rK   r   )r5   s   "r#   r6   r}  3  s/   € ÷ ,ñ ,�Lð , Sð ,¨Vð ,À	ð ,Èdñ ,r"   c                óì   <€ SP                  \        V4      4      pVfB   \        S4      pVS\        V4      &   SP                  V4       VP                  S! W4      4       SP                  WV34       R # r:   )rï   r­   r·   rß   )	r|  r  r½   r…  Úuidxr€  Úalias_entriesÚ
id_to_uidxÚuniques	   &&&& €€€€r#   Ú_internÚ&_intern_param_buffers.<locals>._intern3  sa   ø€ Ø�~‰~œb ›eÓ$ˆØŠ<Ü�v“;ˆDØ $ˆJ”r˜!“uÑØ�M‰M˜!ÔØ×Ñ™U 2›\Ô*Ø×Ñ˜b T˜]Ö+r"   F)Úremove_duplicate)r·   rì   Únamed_parametersr   Únamed_buffers)rº   r‹  Úparam_namesr|  r    r  r¼   r÷   Úbuffer_namesr¡   r€  rˆ  r‰  rŠ  s   &         @@@@r#   Ú_intern_param_buffersr’    sÐ   û€ ô* ˆ4ƒy�1„}ö	 õ	ð €FØ!#€JØ9;€M÷,ó ,ð  €KÜ˜4–‰ˆØ×&Ñ&¸Ð&Ö>‰DˆAÙ”L Ó$ a¨KÖ8ó ?ñ !ô �V“€JØ €LÜ˜4–‰ˆØ—O‘O°U�OÖ;‰DˆAÙ”L Ó$ a¨LÖ9ó <ñ !ð �;¨m¸ZÐGÐGr"   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r0   rh   ri   r1   r›   r(   r'   r4   Ú_Capturer   )r5   s   "r#   r6   r6   H  s6   € ÷ Mñ MØðMà
ðMð  ðMð ñ	Mr"   c                ó`  a aaa&a'a(a)a*a+a,a-a.€ ^ RI o)\        S4      o\        S4       UUu. uF3  w  r4\        V\        P
                  P                  4      '       g   K1  VNK5  	  ppp\        V4      o,S Uu. uF1  p\        V\        P
                  P                  4      '       g   K/  VNK3  	  upo+\        ;QJ d     . V,3R l\        S4       4       F  NK  	  5M! V,3R l\        S4       4       4      p\        S+4      w  rxp	o&o-\        V4      o.\        P                  ! V4      w  p
o*\        V
4       . VOV
Op\        V4      p. R V 4       OR V	 4       OR \        \        V
4      4       4       Op\        WÛ4       F2  w  rä\        V\        P                   4      '       g   K'  \#        Wä4       K4  	  VRS-  Uu. uF  p\        VP$                  4      NK  	  ppVS-R  Uu. uF  p\        VP$                  4      NK  	  ppVRS-  Uu. uF  p\'        VP(                  4      NK  	  ppVS-R  Uu. uF  p\'        VP(                  4      NK  	  ppVRS-  Uu. uF  p\'        VP*                  4      NK  	  ppVS-R  Uu. uF  p\'        VP*                  4      NK  	  ppV
 Uu. uF  p\-        V4      NK  	  ppV
 Uu. uF  p\/        V4      NK  	  ppV
 Uu. uF  p\1        V4      NK  	  pp\3        V
4      p\5        V4      '       d   \7        4       e   \9        R4      h\;        V4      pV Uu. uF1  p\        V\        P                   4      '       d   VP<                  MRNK3  	  ppV F,  p\        V\        P                   4      '       g   K%  RVn        K.  	  Rp\5        V4      '       dy   \?        WzV4      w  pp\        VV4       UUau. uFP  w  poVf   RMC\        ;QJ d     . V3R l\        V4       4       F  NK  	  5M! V3R l\        V4       4       4      NKR  	  pppRo(. o'R V&VV'V(V)V V*V+V,V-V.3R	 llp^ R
I H!p  Ve   RMRp!Ve   TMS)PE                  4       p" \        PF                  ! 4       ;_uu_ 4        T";_uu_ 4         \I        VVV!R7      ! V4      p# RRR4       RRR4       \        TT4       F/  w  pp%\        T\        P                   4      '       g   K(  T%Tn        K1  	  \M        X#4       \O        T#4       \Q        T#4       \S        R#/ RT#bRTbRTbR\        S4      bRTbRT	bRTbRTbRTbRTbRTbRTbRS*bR\U        RS(4      bRS'bRTbRTbR TbR!TbR"Tb # u uppi u upi u upi u upi u upi u upi u upi u upi u upi u upi u upi u upi u uppi   T  d   p$\K        T$4      T$hRp$?$ii ; i  + '       g   i     EL/; i  + '       g   i     EL;; i  \        TT4       F/  w  pp%\        T\        P                   4      '       g   K(  T%Tn        K1  	  i ; i)$a£  Trace the computation ``fn(*args)`` to an ATen graph.

See Note [precompile programming model] for the contract. ``fn`` is the whole
computation, e.g. ``lambda model, x: model(x)`` or a training step
``lambda model, x, t: loss_fn(model(x), t).backward()``. Among ``args``, the
``nn.Module`` arguments have their parameters/buffers lifted to explicit graph
inputs (via reparametrization, so nothing is baked -- invariant 1); the
remaining arguments are the runtime inputs. Whatever ``fn`` returns becomes the
graph's result outputs, and if ``fn`` ran a backward, the resulting parameter
gradients (read off ``param.grad``) are harvested as additional, trailing graph
outputs. They are kept separate from the result so the driver can scatter them
onto the runtime model's ``.grad`` fields rather than return them (invariant 5).

This is a NON-STRICT trace (invariant 3): make_fx records only the ATen ops
that run for THIS example. Python-level control flow over tensor values, data-
dependent branches, and shapes are specialized to ``args`` and baked. The
interning/order established here for params then buffers is the calling
convention the runtime model must reproduce (invariant 2).
Nc              3  ó>   <"  € T F  w  rVS9  g   K  Vx € K  	  R # 5ir:   r   )rŸ   ró   r¹   Úmodule_pos_sets   &  €r#   r¢   Ú_capture.<locals>.<genexpr>f  s   øé € ÐQ¡o™d˜a¸À.Ñ9PŸš£oùs   ƒ“
c              3  ó,   "  € T F
  pR V 2x € K  	  R# 5i)z
parameter Nr   ©rŸ   r  s   & r#   r¢   r˜    s   é € Ð	0¡K˜qˆJ�q�cÕ
£Kùó   ‚c              3  ó,   "  € T F
  pR V 2x € K  	  R# 5i)zbuffer Nr   rš  s   & r#   r¢   r˜  €  s   é € Ð	.¡˜AˆG�A�3�-£ùr›  c              3  ó,   "  € T F
  pR V 2x € K  	  R# 5i)zuser input Nr   )rŸ   ró   s   & r#   r¢   r˜  �  s   é € Ð	;Ñ%: ˆK˜�sÕ
Ó%:ùr›  a<  precompile: unbacked capture cannot run inside another trace -- a FakeTensorMode is already active (e.g. precompile called from inside torch.compile or an export/AOTAutograd trace). make_fx would adopt that mode and its ShapeEnv, so capture's own safety settings would not apply. Capture outside the enclosing trace.c              3  ó>   <"  € T F  w  rVS9   d   R MTx € K  	  R # 5ir:   r   )rŸ   ró   r]  r/  s   &  €r#   r¢   r˜  Û  s   øé € ÐK¹?±4°1˜q Cœx‘t¨QÔ.»?ùs   ƒc               ó    € V ^8„  d   QhRRRR/# )r0   Úflatr  r4   r   )r5   s   "r#   r6   Ú_capture.<locals>.__annotate__ä  s   € ÷ ?*ñ ?*�lð ?* |ñ ?*r"   c                óš  <€ \        R V RS  4      p\        P                  ! V S R S4      pSP                  4       ;_uu_ 4       p\	        S4       FS  w  rES UUUu/ uF  w  rgq†V8X  g   K  WqV,          bK  	  p	pppVP                  \        P                  ! WYRR7      4       KU  	  . p
^ p\        \        S4      4       FD  pVS9   d   V
P                  SV,          4       K$  V
P                  W+,          4       V^,          pKF  	  S! V
!  pVRS pV Uu. uF  qÿP                  NK  	  pp\        ;QJ d    R VSR  4       F  '       g   K   RM	  RM! R VSR  4       4      '       d   \        R4      h\        ;QJ d    R V S R  4       F  '       g   K   RM	  RM! R V S R  4       4      '       d   \        R4      h RRR4       \        P                  ! X4      w  pp. p. p\	        X4       F.  w  ppVf   K  VP                  V4       VP                  V4       K0  	  VoVo. VOVO# u upppi u upi   + '       g   i     L€; i)	r@  NT)Útie_weightsc              3  ó@   "  € T F  p\        VR R4      RJx € K  	  R# 5i©ÚgradN©rÞ   )rŸ   r¡   s   & r#   r¢   Ú,_capture.<locals>.flat_fn.<locals>.<genexpr>  s   é € ÐQÁ¸A”7˜1˜f dÓ+°4Õ7Ãùó   ‚Fz¯precompile: a registered buffer received a gradient (it has requires_grad=True), but precompile only harvests gradients for parameters. Register it as an nn.Parameter instead.c              3  ó@   "  € T F  p\        VR R4      RJx € K  	  R# 5ir¥  r§  r
  s   & r#   r¢   r¨    s   é € ÐOÁ¸A”7˜1˜f dÓ+°4Õ7Ãùr©  zÑprecompile: a user input received a gradient; precompile only harvests gradients for parameters, so an input gradient would be silently dropped. Pass the tensor as a module parameter if its gradient is needed.)r   rª   Útree_unflattenÚ	ExitStackrì   Úenter_contextr   Ú_reparametrize_moduleÚranger·   rß   r¦  r  r   Útree_flatten)!r   ÚpbÚruntime_inputsÚstackr|  r    Úemir  r‡  ÚreparamÚfullÚuiró   r—   Úparam_proxiesr¼   Ú	harvestedÚresult_flatÚresult_specÚ	grad_flatÚgrad_param_indicesÚgrˆ  r1   Úcaptured_grad_param_indicesÚcaptured_out_specÚ
contextlibrh   Úin_specrº   r—  r÷   Únum_pbs!   &                     €€€€€€€€€€€r#   Úflat_fnÚ_capture.<locals>.flat_fnä  s'  ø€ ô �. $ w¨ -Ó0ˆÜ×.Ò.¨t°F°G¨}¸gÓFˆØ×!Ñ!×#Ô# uÜ" 4ž‘�Ù;HÕV¹=©<¨3°4ÐSUÉIœ;˜1 �hš;¹=�ÒVØ×#Ñ#Ü×3Ò3°AÈDÔQöñ )ð "$ˆDØˆBÜœ3˜t›9Ö%�Ø˜Ô&Ø—K‘K  Q¥Ö(à—K‘K Õ 2Ô3Ø˜!•G’Bñ &ñ ˜‘YˆFà˜{ 
˜OˆMÙ)6Ó7© AŸœ©ˆIÐ7÷ ‹sÑQÀÀJÀKÁÓQ�s�sŠsÑQÀÀJÀKÁÓQ×QÒQÜ%ðJóð ÷ ‹sÑOÀÀfÀgÁÓO�s�sŠsÑOÀÀfÀgÁÓO×OÒOÜ%ð*óð ð P÷C $ô` $*×#6Ò#6°vÓ#>Ñ ˆ�[Øˆ	ØÐÜ˜iÖ(‰DˆAˆqØŒ}Ø× Ñ  Ô#Ø"×)Ñ)¨!Ö,ñ )ð (ÐØ&8Ð#Ø)�Ð)˜yÐ)Ð)ùôo Wùò" 8÷' $×#úsO   ÁH:ÁH.Á*H.Á7BH:ÄH5Ä)!H:ÅH:Å+H:ÆH:ÆH:Æ6H:È.H:È:I
	)ÚGuardOnDataDependentSymNodeÚsymbolicÚreal)Údecomposition_tableÚtracing_moderÂ   Ú	flat_argsÚmodule_positionsÚnum_positional_argsr�  r‘  Úparam_shapesÚbuffer_shapesÚparam_dtypesÚbuffer_dtypesÚparam_devicesÚbuffer_devicesrÂ  Úout_specúpytree.TreeSpecr½  Úuser_input_shapesÚuser_input_dtypesÚuser_input_devicesÚuser_input_boundsrW  r   )+rÁ  rÆ   rì   r¦   r§   r¨   r©   rü   r’  r·   rª   r°  r  rþ   r¯  rO  r	   ri  rÇ   rn   rÎ   rÒ   rÉ   rÏ   rÓ   r*  r  r
   r   r5  r¦  rb  rL  rÆ  ÚnullcontextÚenable_gradr   r  rs  rw  Ú_assert_supportedr”  r   )/rh   r1   r(   ró   r¹   rÌ  Úuser_inputsr?  r�  r‘  r  rË  Ú	real_flatÚinput_labelsrd  r½   rÎ  rÏ  rÐ  rÑ  rÒ  rÓ  rÖ  r×  rØ  r$  rÙ  Úsaved_gradsrW  r  r/  rÄ  rÆ  rÊ  Ú
capture_cmrÂ   r‹   r¾  rˆ  r¿  rÀ  rÁ  rÂ  rº   r—  r÷   rÃ  s/   ff&                           `       @@@@@@@@@r#   Ú_capturerâ  H  só  ÿû€ ó0 ä�‹;€DÜ&/°¤oÔX¡o™d˜a¼ÀAÄuÇxÁxÇÁ×9WŸ˜¡oÐÑXÜÐ)Ó*€NÙÓ>‘t�!œz¨!¬U¯X©X¯_©_×=�AˆA‘tÑ>€Dß”%ÔQ¤i°¤oÓQ—%‘%ÔQ¤i°¤oÓQÓQ€Kô 	˜dÓ#ñ B€G˜,¨°zô �‹\€FÜ×,Ò,¨[Ó9Ñ€Iˆwô ˜iÔ(Ø&�'Ð&˜IÐ&€Iô �Y“€IðÙ	0¡KÓ	0ðá	.¡Ó	.ðñ 
<¤U¬3¨y«>Ô%:Ó	;ð€Lô ˜Ö0‰ˆÜ�aœŸ™×&Ô&Ü'¨Ö1ñ 1ð -4°K°ZÑ,@ÓAÑ,@ q”E˜!Ÿ'™'–NÑ,@€LÐAØ-4°Z°[Ñ-AÓBÑ-A¨”U˜1Ÿ7™7–^Ñ-A€MÐBØ*1°+°:Ñ*>Ó?Ñ*> Q”C˜Ÿ™–LÑ*>€LÐ?Ø+2°:°;Ñ+?Ó@Ñ+? a”S˜Ÿ™–\Ñ+?€MÐ@Ø,3°K°ZÑ,@ÓAÑ,@ q”S˜Ÿ™–]Ñ,@€MÐAØ-4°Z°[Ñ-AÓBÑ-A¨”c˜!Ÿ(™(–mÑ-A€NÐBñ "+ó>Ù!*˜AŒ�QŽ¡ð ð >ñ 3<Ó<±)¨Qœ až±)ÐÐ<Ù4=Ó>±I¨qœ-¨Ö*±IÐÐ>ô ! Ó+€Eô ˆ5‡z‚zÔ&Ó(Ò4Üð+ó
ð 	
ô +¨5Ó1Ðñ" MVÓVÉIÀqœZ¨¬5¯<©<×8Ò8�1—6’6¸dÒBÉI€KÐVÛˆÜ�aœŸ™×&Ô&ØˆAŽFñ ð €IÜ
ˆ5‡z‚zÜ5°gÈ%ÓPÑˆ	�9ô
 !Ð!2°EÔ:õ	
ñ ;‘	��cð Š|ñ ç”ÔK¼9ÀT¼?ÓK—‘ÔK¼9ÀT¼?ÓKÓKòLñ ;ð	 	ñ 
ð 15ÐØ-/Ð÷?*÷ ?*ò ?*õJ Rà!*Ò!6‘:¸F€LØ'Ò3‘¸×9OÑ9OÓ9Q€JðÜ×Ò× Õ §*¢*ð6ÜØØ(6Ø!-õð ó	‘÷ #-× ô ˜	 ;Ö/‰DˆAˆqÜ˜!œUŸ\™\×*Ô*Ø�–ñ 0ô ˜rÔ"Ü% bÔ)Ü�bÔô ò Ùðáðñ *ðô   œIð	ñ
  ðñ "ðñ "ðñ $ðñ "ðñ $ðñ $ðñ &ðñ ðô Ð'Ð):Ô;ðñ 7ðñ  ,ð!ñ" ,ð#ñ$ .ð%ñ& ,ð'ñ( ð)ð ùó{ Yùâ>ùòX BùÚBùÚ?ùÚ@ùÚAùÚBùò>ùò =ùÚ>ùò\ Wùó
øðz /ô 6Ü+¨AÓ.°AÐ5ûð6ú÷ #-§* *ú× × Ð ûô ˜	 ;Ö/‰DˆAˆqÜ˜!œUŸ\™\×*Ô*Ø�–ò 0ús¿   ª.U&ÁU&Á5,U,Â&U,Æ:U1Ç!U6ÈU;È/V ÉVÉ=V
Ê!VÊ;VËVÌ-7VÏ
V#Ï#=V#ÑW, Ñ<WÒW	Ò	V)ÒWÒ&W, Ö)WÖ0V<Ö<W×W	×W×	W×W)	×#	W, ×,0X-Ø!X-c                  ó&   € ] tR tRtRR R lltRtR# )r”  iX  Nc          *     ól   € 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RRRRRRRRRRR R!/# )"r0   rÂ   rÕ   rË  r  rÌ  z	list[int]rÍ  rø   r�  r   r‘  rÎ  zlist[tuple[int, ...]]rÏ  rÐ  rÑ  rÒ  rÓ  rÂ  rÕ  rÔ  r½  rÖ  z#list[tuple[int | None, ...] | None]r×  zlist[str | None]rØ  rÙ  r,  rW  zFakeTensorMode | Noner4   rK   r   )r5   s   "r#   r6   Ú_Capture.__annotate__Y  sÜ   € ÷ ,#ñ ,#à ð,#ð  ð,#ð $ð	,#ð
 !ð,#ð ð,#ð  ð,#ð ,ð,#ð -ð,#ð  ð,#ð !ð,#ð !ð,#ð "ð,#ð !ð,#ð "ð,#ð  &ð!,#ð" ?ð#,#ð$ ,ð%,#ð& -ð',#ð( -ð),#ð* )ð+,#ð, 
ñ-,#r"   c                	ó   € Wn         W n        W0n        W@n        WPn        W`n        Wpn        W€n        W�n        W n	        W°n
        WÀn        WÐn        Wàn        Wðn        VV n        VV n        VV n        VV n        VV n        R # r:   )rÂ   rË  rÌ  rÍ  r�  r‘  rÎ  rÏ  rÐ  rÑ  rÒ  rÓ  rÂ  rÔ  r½  rÖ  r×  rØ  rÙ  rW  )r>   rÂ   rË  rÌ  rÍ  r�  r‘  rÎ  rÏ  rÐ  rÑ  rÒ  rÓ  rÂ  rÔ  r½  rÖ  r×  rØ  rÙ  rW  s   &&&&&&&&&&&&&&&&&&&&&r#   rz   Ú_Capture.__init__Y  sƒ   € ð. ŒØ"ŒØ 0ÔØ#6Ô Ø&ÔØ(ÔØ(ÔØ*ÔØ(ÔØ*ÔØ*ÔØ,ÔØŒØ ŒØ"4ÔØ!2ˆÔØ!2ˆÔØ"4ˆÔØ!2ˆÔð #ˆŽr"   )rÓ  rÑ  r‘  rÏ  rW  rË  rÂ   r½  rÂ  rÌ  rÍ  rÔ  rÒ  rÐ  r�  rÎ  rÙ  rØ  r×  rÖ  r:   )r   r   r   r   rz   r!   r   r"   r#   r”  r”  X  s   † ÷,#ó ,#r"   r”  a»  # Generated by torch.compiler.precompile -- do not edit.
#
# This is a SELF-CONTAINED, EXECUTABLE artifact: it runs on its own, needing no
# companion cache. You provide the model(s) at runtime, exactly as the original fn
# took them, e.g.:
#
#     ns = {}
#     exec(open("this_file.py").read(), ns)
#     out = ns["forward"](model, my_input)      # same args as the traced fn
#
# The runtime model must be STRUCTURALLY IDENTICAL to the one precompile traced
# (same parameter/buffer names, order, and weight tying); only the weight VALUES
# may differ (swap in a checkpoint). This artifact was produced by a non-strict
# make_fx trace, so control flow and shapes are specialized to the example inputs,
# and (inductor backend) each input's stride / memory format is baked too: pass
# runtime inputs in the example's layout (.contiguous() to match a contiguous
# example). See Note [precompile programming model] in torch/_precompile.py.
#
# It contains, in order:
#   1. The composed graph module from aot_autograd.compile_to_python: the inlined
#      Inductor kernels (JIT-compiled from the embedded source on first use -- no
#      external cache required) plus AOTAutograd's own codegen'd prelude/epilogue
#      (tensor-subclass wrap/unwrap, input-mutation reflection, output aliasing),
#      exposing ``call(flat_inputs) -> outputs``.
#   2. Calling-convention metadata.
#   3. A small driver that extracts each runtime module's params/buffers (in the
#      same order as capture), passes them with the runtime inputs to ``call``, and
#      scatters any harvested gradients onto the model's .grad fields. No model
#      weights are embedded (you bring the model).
#
# The companion ``cache`` returned by precompile is purely an ACCELERATION used by
# torch.compiler.precompile.load: it primes the inductor kernel caches so exec'ing this
# file loads its kernels from the precompiled binaries (no JIT). This file does not read
# it; running this file alone just JITs.
c               ó$   € V ^8„  d   QhRRRRRR/# )r0   Úbufr   Úcompiledrr   r4   rK   r   )r5   s   "r#   r6   r6   ®  s(   € ÷ Iñ I ð IÐ<Mð IÐRVñ Ir"   c                óv  € VP                   e   VP                  f   \        R4      h \        P                  ! VP                   4      p \        P                  ! TP                  4      pT P                  R4       T P                  R4       T P                  R4       T P                  R4       T P                  R4       T P                  R4       T P                  RTP                  : 24       T P                  RTP                  : 24       T P                  R	TP                   24       T P                  R
TP                  : 24       T P                  RTP                  : 24       T P                  RTP                  : 24       T P                  RTP                  : 24       T P                  RTP                  : 24       T P                  RTP                   : 24       T P                  RTP"                  : 24       T P                  RTP$                  : 24       T P                  RTP&                  : 24       T P                  RT: 24       T P                  RT: 24       T P                  RTP(                  : 24       T P                  RTP*                  : 24       T P                  RTP,                  : 24       T P                  RTP.                  : 24       T P                  R4       R #   \
        \        3 d   p\        R4      ThR p?ii ; i  \
        \        3 d    R p ELÍi ; i)Nz1internal: cannot build metadata before _compile()a�  precompile cannot serialize the output structure of fn (its pytree TreeSpec is not JSON-serializable). This fires when fn returns an unregistered collections.namedtuple, or a registered pytree node with a non-JSON-dumpable context. Register the namedtuple via torch.utils._pytree._register_namedtuple(...) (or supply a JSON-dumpable to_dumpable_context), or return a plain tuple/list/dict of tensors.z # 2. Calling-convention metadatazimport torch as _torchz%import torch.utils._pytree as _pytreer  ú
BACKEND = zMODULE_POSITIONS = zNUM_POSITIONAL_ARGS = zPARAM_NAMES = zBUFFER_NAMES = zPARAM_SHAPES = zBUFFER_SHAPES = zPARAM_DTYPES = zBUFFER_DTYPES = zPARAM_DEVICES = zBUFFER_DEVICES = zGRAD_PARAM_INDICES = z
IN_SPEC = zOUT_SPEC = zUSER_INPUT_SHAPES = zUSER_INPUT_DTYPES = zUSER_INPUT_DEVICES = zUSER_INPUT_BOUNDS = úH# ======================================================================)Ú	_out_specÚ_in_specr   rª   Útreespec_dumpsr<   Ú	TypeErrorÚ	writelineÚ_backendÚ_module_positionsÚ_num_positional_argsr¸   Ú_buffer_namesÚ_param_shapesÚ_buffer_shapesÚ_param_dtypesÚ_buffer_dtypesÚ_param_devicesÚ_buffer_devicesÚ_grad_param_indicesÚ_user_input_shapesÚ_user_input_dtypesÚ_user_input_devicesÚ_user_input_bounds)ré  rê  Úout_spec_strr‹   Úin_spec_strs   &&   r#   Ú_build_metadata_sectionr  ®  sÞ  € Ø×ÑÒ! X×%6Ñ%6Ò%>ÜÐQÓRÐRð
Ü×,Ò,¨X×-?Ñ-?Ó@ˆð Ü"(×"7Ò"7¸×8IÑ8IÓ"Jˆð ‡M�M�/Ô"Ø‡M�MÐ4Ô5Ø‡M�M�/Ô"Ø‡M�MÐ*Ô+Ø‡M�MÐ9Ô:Ø‡M�M�"Ôð ‡M�M�J˜x×0Ñ0Ñ3Ð4Ô5Ø‡M�MÐ'¨×(BÑ(BÑ'EÐFÔGð ‡M�MÐ*¨8×+HÑ+HÐ*IÐJÔKØ‡M�M�N 8×#8Ñ#8Ñ";Ð<Ô=Ø‡M�M�O H×$:Ñ$:Ñ#=Ð>Ô?ð ‡M�M�O H×$:Ñ$:Ñ#=Ð>Ô?Ø‡M�MÐ$ X×%<Ñ%<Ñ$?Ð@ÔAØ‡M�M�O H×$:Ñ$:Ñ#=Ð>Ô?Ø‡M�MÐ$ X×%<Ñ%<Ñ$?Ð@ÔAØ‡M�MÐ$ X×%<Ñ%<Ñ$?Ð@ÔAØ‡M�MÐ% h×&>Ñ&>Ñ%AÐBÔCð ‡M�MÐ)¨(×*FÑ*FÑ)IÐJÔKð ‡M�M�J˜{™oÐ.Ô/Ø‡M�M�K Ñ/Ð0Ô1ð
 ‡M�MÐ(¨×)DÑ)DÑ(GÐHÔIØ‡M�MÐ(¨×)DÑ)DÑ(GÐHÔIØ‡M�MÐ)¨(×*FÑ*FÑ)IÐJÔKð ‡M�MÐ(¨×)DÑ)DÑ(GÐHÔIØ‡M�M�"Öøô  ¤Ð+ô ÜðRó
ð ð	ûðûô"  ¤Ð+ô Ø‹ðús)   © K< Á
 L! Ë<LÌLÌLÌ!L8Ì7L8c               ó    € V ^8„  d   QhRRRR/# )r0   r•   rn   r4   zdict[str, object]r   )r5   s   "r#   r6   r6   ú  s   € ÷ xñ x¨#ð xÐ2Cñ xr"   c                ó2  aa€ ^ RI o SP                  V 4      p/ oTP                   F–  p\        TSP                  4      '       g   K!  \        TP                  4      ^8X  g   K=  \        TP                  ^ ,          SP                  4      '       g   Kl  TP                  STP                  ^ ,          P                  &   K˜  	  R TT3R llpRS9   d	   T! R4      MRpTR8X  d4   0 RmpR
S9   d	   T! R
4      MRpTR8X  d   TRR	0,          pTRR0,          pM0 Rmp0 RmpS U	u/ uF  q™Yh,          9   g   K  Y”! T	4      bK  	  p
p	SP                  4       T,
          T,
          R0,
           F  p	\        P                  RT	4       K  	  YjP                  4       ,
          pT'       d   \        R\        T4       R24      hT
P!                  R
R4       T
R,          R9  d   \        RT
R,          : R24      hT
#   \         d   p\        R4      ThRp?ii ; iu up	i )a—  Read the calling-convention constants back out of ``python_code`` WITHOUT
executing it (exec'ing the inlined Inductor output would JIT the kernels, the
very work the cache exists to skip).

python_code is the single source of truth: the metadata builders emit the constants
below as top-level literal assignments, so an AST walk + literal_eval recovers them
safely. The cache then only needs to carry the compiled artifact.

The required set follows TRACER: absent (artifacts predating the dynamo tracer) or
anything but "dynamo" means the make_fx set the inlined driver reads. A dynamo
artifact instead carries the multi-graph driver's blobs (_FRAMES and _BACKENDS, or
_PACKAGE and UNREACHABLE_WITHOUT_INSTALL once SERVING_MODE is "installed"), the
readable frame report beside them and the two versions that lock them,
_DYNAMO_PYTHON_VERSION for the marshalled bytecode and TORCH_VERSION for the
pickled guard state.
Nz\python_code is not valid Python; it does not look like a torch.compiler.precompile artifact.c               ó    € V ^8„  d   QhRRRR/# )r0   rð   rn   r4   r2   r   )r5   s   "r#   r6   Ú._parse_artifact_metadata.<locals>.__annotate__  s   € ÷ ñ �cð ˜fñ r"   c                óŠ   <€  SP                  SV ,          4      #   \        \        3 d   p\        R T : R24      ThRp?ii ; i)zpython_code zG calling-convention metadata is malformed; it must be a Python literal.N)Úliteral_evalr�   rñ  r   )rð   r‹   ÚassignsÚasts   & €€r#   ÚliteralÚ)_parse_artifact_metadata.<locals>.literal  sU   ø€ ð	Ø×#Ñ# G¨D¥MÓ2Ð2øÜœIÐ&ô 	Ü!Ø˜t™hð '/ð /óð ðûð	ús   ƒ ›A¬=½AÚTRACERÚdynamoÚBACKENDÚ_FRAMESÚ	_BACKENDSÚSERVING_MODEr-   Ú_PACKAGEÚUNREACHABLE_WITHOUT_INSTALLÚforwardzlprecompile: ignoring unrecognized top-level assignment %r while parsing artifact calling-convention metadataz3python_code is missing calling-convention metadata z=; it does not look like a torch.compiler.precompile artifact.Ú
standalonez%python_code names an unknown backend z@; a torch.compiler.precompile artifact is 'inductor' or 'eager'.>   ÚFRAMESr  ÚFN_NAMEr  r  ÚTORCH_VERSIONÚDROPPED_GUARDSÚ_ENTRY_BINDINGÚWONT_GENERALIZEÚRISKY_DROPPED_GUARDSÚ_DYNAMO_PYTHON_VERSION>   r  ÚIN_SPECÚOUT_SPECÚPARAM_NAMESÚBUFFER_NAMESÚPARAM_DTYPESÚPARAM_SHAPESÚBUFFER_DTYPESÚBUFFER_SHAPESÚPARAM_DEVICESÚBUFFER_DEVICESÚMODULE_POSITIONSÚUSER_INPUT_BOUNDSÚUSER_INPUT_DTYPESÚUSER_INPUT_SHAPESÚGRAD_PARAM_INDICESÚUSER_INPUT_DEVICESÚNUM_POSITIONAL_ARGS>   r  r  ÚDROPPED_GUARD_CODEÚPOLICY_DROPPED_GUARDS©ÚinductorÚeager)r  ÚparseÚSyntaxErrorr   Úbodyr¦   ÚAssignr·   ÚtargetsÚNamerÁ   r­   ÚkeysÚlogÚdebugÚsortedÚ
setdefault)r•   Útreer‹   rá   r  rq   ÚwantedÚmodeÚoptionalrð   ÚfoundÚmissingr  r  s   &           @@r#   Ú_parse_artifact_metadatarH  ú  s  ù€ ó" ðØ�y‰y˜Ó%ˆð $&€GØ—	”	ˆä�t˜SŸZ™Z×(Ô(Ü�D—L‘LÓ! QÖ&Ü˜4Ÿ<™<¨�?¨C¯H©H×5Ô5à*.¯*©*ˆG�D—L‘L •O×&Ñ&Ó'ñ ÷ñ ð #+¨gÔ"5‰W�XÔ¸4€FØ�Ôò
ˆð +9¸GÔ*C‰w�~Ô&ÈˆØ�;ÔØ�y +Ð.Õ.ˆFØ�zÐ#@ÐAÕAˆFøò
ˆò.€Hñ .5ÓR©W TÀÕ@QÑ8QÔ ˆT�7˜4“=Ò ©W€EÐRØ—‘“ Õ'¨(Õ2°i°[×@Ð@ˆô
 	�	‰	ð;àö	
ñ Að —z‘z“|Õ#€GßÜØAÄ&ÈÃ/ÐARð SJð Jó
ð 	
ð 
×Ñ�^ \Ô2ØˆYÕÐ4Ô4ÜØ3°E¸)Õ4DÑ3Gð HKð Kó
ð 	
ð €LøôG ô Üð2ó
ð ð	ûðüòT Ss#   ˆG5 Ä"HÄ5HÇ5HÈ HÈHc               ó$   € V ^8„  d   QhRRRRRR/# )r0   rê  rr   Úgraph_pythonrn   r4   r   )r5   s   "r#   r6   r6   u  s&   € ÷ ñ Øðàðð 	ñr"   c                óâ  € ^ RI Hp V! 4       pVP                  \        4       VP                  R4       VP                  R4       VP                  R4       VP                  R4       VP                  V4       VP                  R4       \	        W04       VP                  R4       VP                  R4       VP                  R4       VP                  \        R4      4       VP                  4       # )é    r   r  z># 1. Compiled graph (AOTAutograd + Inductor): exposes ``call``zF# 3. Driver: module params/buffers + grad scatter + calling conventionÚ_inductor_forwardrí  )Ú&torch._functorch._aot_autograd.codegenr   rò  Ú_GENERATED_HEADERr  Ú_emit_driver_sourceÚgetvalue)rê  rJ  r   ré  s   &&  r#   Ú_build_python_sourcerR  u  s¸   € õ Gá
Ó
€CØ‡M�MÔ#Ô$Ø‡M�M�"ÔØ‡M�M�/Ô"Ø‡M�MÐRÔSØ‡M�M�/Ô"ð ‡M�M�,ÔØ‡M�M�"ÔÜ˜CÔ*Ø‡M�M�/Ô"Ø‡M�MØPôð ‡M�M�/Ô"Ø‡M�MÔ%Ð&9Ó:Ô;Ø�<‰<‹>Ðr"   aÆ  # Generated by torch.compiler.precompile (backend="eager") -- do not edit.
#
# Self-contained, executable artifact: the captured ATen graph is inlined below (both
# the human-readable rendering and the executable code) and runs on its own. Provide
# the model(s) at runtime, exactly as the original fn took them:
#
#     ns = {}
#     exec(open("this_file.py").read(), ns)
#     out = ns["forward"](model, my_input)      # same args as the traced fn
#
# The runtime model must be structurally identical to the traced one (only weight
# VALUES may differ), and control flow / shapes are specialized to the example inputs.
# See Note [precompile programming model] in torch/_precompile.py for the full contract.
c               ó    € V ^8„  d   QhRRRR/# )r0   rê  rr   r4   rn   r   )r5   s   "r#   r6   r6   ¡  s   € ÷ .ñ .Ð):ð .¸sñ .r"   c                ó¸  € V P                   pVe   VP                  MR pVe   VP                  MR pVe	   Ve   Vf   \        R4      hTP                  P                  RR^4      p\        P                  ! V4      p\        P                  ! V4      p^ RIH	p V! 4       pVP                  \        4       VP                  R4       VP                  R4       VP                  R4       VP                  R4       ^ RIHp	 V	P                  4        F  p
VP                  V
P                  4       K   	  VP                  V4       VP                  R4       VP                  R4       VP                  R	V: R
24       VP                  RV: R
24       VP                  R4       VP                  R4       VP                  R4       VP                  R4       VP                  R4       VP                  R4       \!        W€4       VP                  R4       VP                  R4       VP                  R4       VP                  \#        R4      4       VP%                  4       # )Nz/internal: eager graph missing before _compile()údef forward(zdef _graph_forward(r   r  zC# 1. Captured ATen graph (eager backend) -- executable and readable)Ú_custom_builtinszclass _GraphSelf:z%    _in_spec = pytree.treespec_loads(Ú)z&    _out_spec = pytree.treespec_loads(zdef call(args):z2    out = _graph_forward(_GraphSelf(), list(args))zA    return list(out) if isinstance(out, (list, tuple)) else [out]z3# 3. Driver: run the inlined captured graph eagerlyÚ_eager_forwardrí  )r´   rï  rî  r   ÚcodeÚreplacerª   rð  rN  r   rò  Ú_EAGER_GENERATED_HEADERÚtorch.fx.graphrV  r±   Ú
import_strr  rP  rQ  )rê  rÂ   rÂ  rÔ  Ú	graph_srcr  r  r   ré  rV  Ú_cbs   &          r#   Ú_build_eager_python_sourcer`  ¡  sÖ  € Ø	�‰€Bð
  š^ˆb�kŠk°€GØ!š~ˆr�|Š|°4€HØ	‚z�W’_¨Ò(8ÜÐOÓPÐPØ—‘—‘ Ð0EÀqÓI€IÜ×'Ò'¨Ó0€KÜ×(Ò(¨Ó2€LÝFá
Ó
€CØ‡M�MÔ)Ô*Ø‡M�M�"ÔØ‡M�M�/Ô"Ø‡M�MÐWÔXØ‡M�M�/Ô"õ 0à×&Ñ&Ö(ˆØ�‰�c—n‘nÖ%ñ )à‡M�M�)ÔØ‡M�M�"ÔØ‡M�MÐ%Ô&Ø‡M�MÐ9¸+¹ÈÐJÔKØ‡M�MÐ:¸<Ñ:JÈ!ÐLÔMØ‡M�M�"ÔØ‡M�M�"ÔØ‡M�MÐ#Ô$Ø‡M�MÐFÔGØ‡M�MÐUÔVØ‡M�M�"ÔÜ˜CÔ*Ø‡M�M�/Ô"Ø‡M�MÐGÔHØ‡M�M�/Ô"Ø‡M�MÔ%Ð&6Ó7Ô8Ø�<‰<‹>Ðr"   zšif __name__ == "__main__":
    print("forward() is ready; call it with the model(s) and inputs the traced")
    print("fn took, e.g. forward(model, x).")
c               ó    € V ^8„  d   QhRRRR/# )r0   Úforward_fn_namern   r4   r   )r5   s   "r#   r6   r6   Ù  s   € ÷ 1ñ 1¨ð 1°ñ 1r"   c                óœ  € ^ RI Hp \        W4      p\        P                  ! VP
                  4      \        P                  ! VP                  4      \        P                  ! VP                  4      \        P                  ! V4      P                  RV  R2R^4      .pRP                  R V 4       4      pRV,           R,           \        ,           # )	a"  Emit the runtime driver as text for inlining into python_code.

The driver lives as real, type-checked code in torch._precompile_driver; here we read
it back with inspect.getsource (LAZILY -- only on this emit path; load() never runs
it, so a stripped-source environment only affects capture, not reload) and rename the
selected forward variant to the public ``forward``. Emitting the TEXT (rather than
importing the module from the artifact) keeps python_code self-contained and
version-frozen (Note [precompile programming model], invariant 7).©Ú_precompile_driverzdef Ú(rU  z

c              3  ó@   "  € T F  qP                  4       x € K  	  R # 5ir:   )Úrstrip)rŸ   Úblocks   & r#   r¢   Ú&_emit_driver_source.<locals>.<genexpr>î  s   é € Ð:±6¨%—|‘|—~�~³6ùr©  Ú
ú


)r§   re  rÞ   ÚinspectÚ	getsourceÚ_extract_param_buffersÚ_failÚ_check_structurerZ  ÚjoinÚ_DRIVER_MAIN)rb  ÚdriverÚ
forward_fnÚblocksr9  s   &    r#   rP  rP  Ù  s¦   € õ 3ä˜Ó1€Jä×Ò˜&×7Ñ7Ó8Ü×Ò˜&Ÿ,™,Ó'Ü×Ò˜&×1Ñ1Ó2Ü×Ò˜*Ó%×-Ñ-Ø�?Ð# 1Ð% ~°qó	
ð	€Fð �;‰;Ñ:±6Ó:Ó:€DØ�$�;˜Õ!¤LÕ0Ð0r"   a$  # Generated by torch.compiler.precompile (multi-graph) -- do not edit.
#
# Self-contained, executable artifact for a computation with GRAPH BREAKS or several
# guarded variants. Where the single-graph forms inline one graph, this inlines every
# frame Dynamo compiled -- the entry frame plus each continuation -- with one guard tree
# per captured variant, and dispatches among them at call time:
#
#     ns = {}
#     exec(open("this_file.py").read(), ns)
#     out = ns["forward"](model, my_input)      # same args as the captured callable
#
# Sections below are labelled. What is OPAQUE is base64 of pickled Dynamo state --
# the guard trees, the transformed bytecode and the compiled subgraphs -- because
# those have no readable source form here. Everything else is meant to be read and
# reviewed.
r  a¶  # Nothing is installed onto your code objects and no frame evaluator is involved; the
# only global state loading touches is the captured module, where the names Dynamo
# minted while tracing (import aliases, the builtins dict key, the compiled subgraphs
# under their backend ids) are re-seeded and stay. The flip side is that there is no
# compiler behind it: a call no captured variant covers RAISES rather than compiling a
# new one.
r-   a  # This artifact SERVES BY INSTALLING onto the live code objects, so loading and then
# entering it mutates global state, which unload() and __exit__ take back out. And
# there IS a compiler behind it: a call no captured variant covers is compiled fresh
# at serve time rather than refused. That is what makes a graph-breaking model
# servable at all, but it means the artifact can quietly serve less and less of
# itself -- watch for the "serving compiled a NEW graph" warning, or read
# serve_time_compiles() on the loaded object.
c               ó    € V ^8„  d   QhRRRR/# )r0   Úpayloadr2   r4   rn   r   )r5   s   "r#   r6   r6     s   € ÷ Cñ C�&ð C˜Sñ Cr"   c                ót   € \         P                  ! \        P                  ! V 4      4      P	                  R 4      # )Úascii)Úbase64Ú	b64encodeÚpickleÚdumpsÚdecode)rx  s   &r#   Ú_b64r€    s'   € Ü×ÒœFŸLšL¨Ó1Ó2×9Ñ9¸'ÓBÐBr"   c               ó    € V ^8„  d   QhRRRR/# )r0   Úentryr   r4   úlist[dict[str, Any]]r   )r5   s   "r#   r6   r6     s   € ÷ 'ñ '˜cð 'Ð&:ñ 'r"   c                ó"  € \        V P                  4       UUUu. uFà  w  rRV^ 8H  RVP                  RVP                  '       * ;'       d    VP                  '       * RVP                  RVP
                  R\        VP                  4      RVP                  '       d   \        VP                  4      M. RVP                  '       d   . MVP                   Uu. uF  pR	VP                  R
VP                  /NK  	  up/NKâ  	  uppp# u upi u upppi )aµ  One record per Dynamo frame, in the form the driver rebuilds from.

A standalone artifact can reach exactly two kinds of frame: the ENTRY frame,
which the caller invokes, and a continuation, which the frame ahead of it
reaches by LOAD_GLOBAL on the name capture minted. Anything else Dynamo
compiled is entered by an ordinary Python call that only the frame evaluator
intercepts, so it has no place in a source artifact.

The entry is ``codes[0]``: CompilePackage records the captured callable's
code first and reads it back by position (``main, *codes``). A bypassed code
keeps its record, flagged and without variants, the way install() keeps its
global binding but none of its guarded codes: a continuation the frame ahead
of it names must stay bound, and a bypassed code's guarded codes are dead.
A code that is neither bypassed nor has variants is ``trivial``: it ran as
plain Python during capture, and the driver rebuilds it as plain Python.
Úis_entryÚbypassedÚtrivialrY  Úpython_moduleÚimport_sourcesÚresume_namesÚvariantsÚguards_stateÚdynamo_code)rì   Úcodesr†  Úguarded_codesr•   rˆ  Údictr‰  Úinstall_to_globalrþ   Úfunction_namesrŒ  r�  )r‚  ró   rY  Úguardeds   &   r#   Ú_multigraph_framesr”    s  € ôL ! §¡Ô-õ+ñ* .‰GˆAð' ˜˜Q™Ø˜Ÿ™ð
 ˜4×-Ñ-Ô-×CÐC°d·m±mÔ2CØ�D×$Ñ$Ø˜T×/Ñ/Øœd 4×#6Ñ#6Ó7Ø¸×9O×9OÐ9OœD ×!4Ñ!4Ô5ÐUWØð
 '+§m§m m¡¸×9KÑ9KÐ Kóñ
 !L�Gð # G×$8Ñ$8Ø! 7×#6Ñ#6óñ !Lñó	
ñ( .ó+ð ùòùôs$   š0D
ÁA9D
ÃD
Ã#D,Ã8D
ÄD
c               ó    € V ^8„  d   QhRRRR/# )r0   Úframesrƒ  r4   zset[int]r   )r5   s   "r#   r6   r6   I  s   € ÷ %ñ %Ð2ð %°xñ %r"   c           	     ó@  aa€ ^ RI Ho R V3R llp\        V 4       UUu0 uF  w  r#VR,          '       g   K  VkK  	  ppp\        4       o\	        V4      pV'       dµ   SV! WP                  4       ,          4      ,          o\        V 4       UUu0 uF_  w  r#W$9  g   K  \        ;QJ d&    V3R lVR,           4       F  '       g   K   RM	  RM! V3R lVR,           4       4      '       g   K]  VkKa  	  pppWF,          pVP                  V4       K¼  V# u uppi u uppi )	a™  Indices of the frames a standalone driver can actually dispatch.

The entry is reachable, and a continuation is reachable only once some
ALREADY reachable frame's bytecode names it. Asking merely whether a frame
carries a resume name is not the same question: a continuation whose parent
is itself unreachable is just as dead, and counting it as covered
under-reports how much of the artifact will run eager.
©ÚSerializedCodec               ó    € V ^8„  d   QhRRRR/# )r0   Úframeúdict[str, Any]r4   zset[str]r   )r5   s   "r#   r6   Ú'_reachable_frames.<locals>.__annotate__T  s   € ÷ ñ ˜^ð °ñ r"   c                ó0  <€ \        4       pV R ,           Uu. uF  pSP                  VR,          4      NK  	  ppV'       dP   VP                  4       pVP                  VP                  4       VP                  R VP                   4       4       KW  V# u upi )r‹  r�  c              3  ój   "  € T F)  p\        V\        P                  4      '       g   K%  Vx € K+  	  R # 5ir:   )r¦   ÚtypesÚCodeType)rŸ   Úcs   & r#   r¢   Ú;_reachable_frames.<locals>.named_globals.<locals>.<genexpr>_  s   é € ÐT¡N˜q´jÀÄEÇNÁN×6SŸš£Nùs   ‚"3©
3)rü   Úto_code_objectÚpopÚupdateÚco_namesÚextendÚ	co_consts)r›  ÚoutÚvariantr³  rY  r™  s   &    €r#   Únamed_globalsÚ(_reachable_frames.<locals>.named_globalsT  sƒ   ø€ ô ›ˆð ! Ö,ó
á,�ð ×)Ñ)¨'°-Õ*@ÖAÙ,ð 	ð 
÷ Ø—9‘9“;ˆDØ�J‰J�t—}‘}Ô%Ø�L‰LÑT D§N¢NÓTÖTØˆ
ùò
s   —!Br…  c              3  ó,   <"  € T F	  qS9   x € K  	  R # 5ir:   r   )rŸ   r  Únameds   & €r#   r¢   Ú$_reachable_frames.<locals>.<genexpr>j  s   øé € Ð)TÑ>S¸¨u®*Ó>Sùs   ƒrŠ  TF)Útorch._dynamo.packager™  rì   rü   rþ   r¥  r  r¨  )	r–  r¬  ró   r›  Ú	reachableÚpendingÚgrewr™  r¯  s	   &      @@r#   Ú_reachable_framesrµ  I  sí   ù€ õ 5÷ð ô $-¨VÔ#4ÔJÑ#4‘x�q¸¸j×8IÑ8I—�Ñ#4€IÑJÜ“e€EÜ�9‹o€Gß
Ø‘˜v§k¡k£mÕ4Ó5Õ5ˆô & fÔ-ô
á-‘�ØÑ!ô ç&)£cÔ)T¸eÀNÖ>SÓ)T§c§c¢cÔ)T¸eÀNÖ>SÓ)T×&T÷ ˆAÙ-ð 	ñ 
ð
 	Õˆ	Ø�‰�tÖØÐùó Kùó

s(    D¸DÂ
DÂ
DÂ)DÃ"DÃ.Dc               ó    € V ^8„  d   QhRRRR/# )r0   r–  rƒ  r4   rn   r   )r5   s   "r#   r6   r6   q  s   € ÷ Xñ XÐ.ð X°3ñ Xr"   c                ó@  € \        V 4      p\        V 4       UUu0 uF  w  r#VR,          '       g   K  VkK  	  ppp\        V 4       UUu0 uF)  w  r%VR,          '       g   K  VR,          '       d   K'  VkK+  	  pppYAu;8:  d   WF,          8:  d   R#  R# u uppi u uppi )aé  ``"standalone"`` when a source artifact serves every captured frame.

A frame it cannot reach would run eager, silently giving up the compiled
variant; a frame it reaches but has no variant of (a bypassed continuation)
would raise on the very path capture exercised. Either way the capture is
served by installing instead, which has a compiler behind it. A trivial
continuation ran eager during capture and is served eager, so it counts as
covered when reached and costs nothing when not.
r‹  r‡  r…  r  r-   )rµ  rì   )r–  r²  ró   r›  rê  ra  r‡  s   &      r#   Ú_serving_moder¸  q  sŒ   € ô " &Ó)€IÜ"+¨FÔ"3ÔIÑ"3‘h�a°u¸Z×7HÑ7H—�Ñ"3€HÑIÜ& vÔ.ÔUÑ.‘T�Q°!°I·,±,ŒqÀqÈÇ}Á}�qˆqÑ.€GÑUØ#ÖF°HÕ4FÔFˆ<ÐWÐFÈKÐWùó JùÛUs   šB²BÁ	BÁ!BÁ2Bc               ó$   € V ^8„  d   QhRRRRRR/# )r0   r–  rƒ  r‚  r   r4   rK   r   )r5   s   "r#   r6   r6   �  s"   € ÷ 5
ñ 5
Ð(<ð 5
ÀSð 5
ÈTñ 5
r"   c                óž  € ^ RI Hp \        R V  4       R4      pVf   R# VR,          '       d   \        RVP                  : R24      hVR,          '       g   \        RVP                  : R24      hVP                  VR	,          4      pVP                  '       d2   \        R
VP                  : R\        VP                  4      : R24      hR# )aó  Refuse a capture whose entry the artifact could not rebuild or serve.

The multi-graph driver rebuilds the entry from its code object, which
carries no closure, so a closure entry cannot be built at all. That is a
capture-time fact and is refused here rather than at load on the serving
machine. (Defaults, which the code object does not carry either, are
recorded into the artifact rather than refused.) An entry with no
dispatchable variant is refused too, naming which of its two causes applies.
r˜  c              3  óF   "  € T F  qR ,          '       g   K  Vx € K  	  R# 5i)r…  Nr   )rŸ   ra  s   & r#   r¢   Ú._reject_uninstallable_entry.<locals>.<genexpr>�  s   é € Ð;¡6˜a¨z¯]©]Ÿš£6ùs   ‚!—
!Nr†  z.precompile captured no dispatchable graph for a{  : the entry frame was BYPASSED during capture (its guards could not be serialized, or a backend artifact was missing when the package was saved), so no variant of it can be served. Dynamo logged the reason: look for the package-bypass warning, or the precompile_cache_bypass / dynamo_cache_bypass artifacts under tlparse. Fix that rather than restructuring the captured callable.r‹  au  . The entry frame produced no guarded code, so the artifact would serve nothing. This happens when the captured callable is a thin wrapper -- an nn.Module, or a forward that immediately delegates -- where Dynamo compiles the wrapper's inner frame instead. Capture the function that CALLS the model, e.g. precompile.capture(lambda m, x: m(x), ...) and calling cap(model, x).rY  z6precompile cannot build a self-contained artifact for z: it closes over a  , and this capture has to rebuild the entry from its code object, which cannot restore a closure. Capture a module-level function that takes what it needs as arguments, e.g. precompile.capture(step, ...), calling cap(model, x), with 'def step(model, x): return model(x)'.)r±  r™  Únextr   Úfn_namer¤  Úco_freevarsrþ   )r–  r‚  r™  Úentry_framerY  s   &&   r#   Ú_reject_uninstallable_entryrÁ  �  sê   € õ 5äÑ;¡6Ó;¸TÓB€KØÒÙØ�:×Ôô Ø<¸U¿]¹]Ñ<Mð N3ð 4ó
ð 	
ð �z×"Ô"ô Ø<¸U¿]¹]Ñ<Mð NTð Uó
ð 	
ð ×(Ñ(¨°VÕ)<Ó=€DØ××ÐÜØDÀUÇ]Á]ÑDUð VÜ" 4×#3Ñ#3Ó4Ñ7ð 85ð6ó
ð 	
ñ r"   c               ó    € V ^8„  d   QhRRRR/# )r0   rh   r2   r4   rœ  r   )r5   s   "r#   r6   r6   ¹  s   € ÷ ñ �vð  .ñ r"   c                ó:   € R\        V RR4      R\        V RR4      /# )aR  The default arguments an entry's code object does not carry.

The artifact rebuilds its entry from that entry's code object, which holds
no default arguments. Without them a defaulted parameter is simply absent at
the served call -- which the guard check then cannot bind, so every variant
misses. Closure cells are not carried: an entry that closes over free
variables is refused before we reach here (a rebuilt cell is a new object
that Dynamo's identity guard would miss), so a valid entry has none, and
the driver refuses one that arrives anyway rather than rebuilding it over
empty cells.
ÚdefaultsÚ__defaults__NÚ
kwdefaultsÚ__kwdefaults__r§  )rh   s   &r#   Ú_entry_bindingrÈ  ¹  s+   € ð 	”G˜B °Ó5Ø”g˜bÐ"2°DÓ9ðð r"   c               ó4   € V ^8„  d   QhRRRRRRRRR	R
RRRR
/# )r0   r‚  r   r–  rƒ  ÚbackendsúMapping[str, Any]Úsummaryr   rm   rn   Úentry_bindingrœ  r4   r   )r5   s   "r#   r6   r6   Ë  sW   € ÷ pñ pØðpà ðpð  ðpð ð	pð
 ðpð "ðpð 	ñpr"   c           
     ó  € ^ RI Hp V! 4       pVP                  \        4       VP                  \        R,          4       VP                  R4       VP                  R24       VP                  R4       VP                  R24       VP                  RV: 24       VP                  R4       VP                  R4       VP                  RV P
                  : 24       VP                  R	\        \        P                  R
,          4      : 24       VP                  R\        P                  : 24       VP                  R4       VP                  R4       VP                  R4       VP                  R4       V F=  pVP                  RVR,          P                  : R\        VR,          4       R24       K?  	  VP                  R4       VP                  R4       VP                  R4       VP                  R4       VP                  R4       TP                  RVP                   U	u. uF  p	\        V	4      NK  	  up	: 24       TP                  RVP                   U	u. uF  p	\        V	4      NK  	  up	: 24       VP                  R4       VP                  R4       TP                  RVP                    U	u. uF  p	\        V	4      NK  	  up	: 24       VP                  R4       VP                  R4       VP                  R\        VP"                  4      : 24       VP                  R4       VP                  R4       VP                  R4        \%        V4      p
TP                  R%T
: 24       TP                  R4       TP                  R24       TP                  R&4       TP                  R'4       TP                  R(4       TP                  R)4       TP                  R*4       TP                  R+4       TP                  R24       TP                  R,\%        T4      : 24       TP                  R4       TP                  R24       TP                  R-4       TP                  R'4       TP                  R.4       TP                  R/4       TP                  R24       TP                  R0\%        \/        T4      4      : 24       TP                  R4       TP                  R24       TP                  R14       TP                  R24       TP                  \1        4       4       TP3                  4       # u up	i u up	i u up	i   \&         d:   p\)        R T P
                  : R!\+        T4      P,                   R"T R#24      ThR$p?ii ; i)3a‡  Render a standalone multi-graph capture as ``python_code``.

The readable half -- what was captured, which frames, how many variants, what
guards were dropped -- is emitted as literals so a reviewer can diff it. The
guard trees, the transformed bytecode and the compiled subgraphs have no
source form here, so they go into the clearly bannered opaque blobs the
inlined driver rebuilds from.
r   r  r  z!# 1. What was captured (readable)rì  zTRACER = "dynamo"zSERVING_MODE = "standalone"z
FN_NAME = z_DYNAMO_PYTHON_VERSION = :Nr0   NzTORCH_VERSION = zE# frame name -> number of captured variants. A frame with one variantz:# serves one specialization; the artifact covers no other.z
FRAMES = [z    (rY  z, r‹  z),Ú]zF# Guards that could NOT be serialized and are therefore not checked atzA# serve time. Rebinding any of these between capture and load canzH# silently select the wrong graph -- audit them against your deployment.zDROPPED_GUARDS = zRISKY_DROPPED_GUARDS = zC# What a dropped slot above actually checked, where it renders one.zDROPPED_GUARD_CODE = zD# Values pinned to exactly what capture saw; any other value misses.zWONT_GENERALIZE = zD# The entry's default arguments: a code object carries none, and thez%# driver rebuilds the entry from one.zprecompile cannot carry zB's default arguments in the artifact; defaults must be picklable (ú: z).Nz_ENTRY_BINDING = z3# 2. Guard trees and transformed bytecode -- OPAQUEÚ#zF# base64(pickle) of one record per frame: the frame's code object, itszG# variants' serialized guard state and Dynamo bytecode, and the globalszE# it reads. Guard trees are a spec for a C++ GuardManager and have nozE# readable form; the counts and names above describe what is in here.z
_FRAMES = z!# 3. Compiled subgraphs -- OPAQUEzF# base64(pickle) of the backend artifacts the frames call by name: thezK# bundled AOTAutograd entries (inductor) or the captured fx graphs (eager).z_BACKENDS = zD# 4. Driver: rebuild the guards, wire the names, dispatch (readable)rí  )rN  r   rò  Ú_MULTIGRAPH_GENERATED_HEADERÚ_SERVING_NOTESr¾  rÆ   ÚsysÚversion_infor§   Ú__version__Úco_namer·   Údropped_guardsrþ   Úrisky_dropped_guardsÚdropped_guard_codeÚwont_generalizer€  Ú	Exceptionr   rj  r   r�  Ú_emit_multigraph_driver_sourcerQ  )r‚  r–  rÊ  rÌ  rm   rÍ  r   ré  r›  r¾  Úbinding_blobr‹   s   &&&&&&      r#   Ú_build_multigraph_python_sourcerß  Ë  s¤  € õ  Gá
Ó
€CØ‡M�MÔ.Ô/Ø‡M�M”. Õ.Ô/Ø‡M�M�"ÔØ‡M�M�/Ô"Ø‡M�MÐ5Ô6Ø‡M�M�/Ô"Ø‡M�M�J˜w™kÐ*Ô+Ø‡M�MÐ%Ô&Ø‡M�MÐ/Ô0Ø‡M�M�J˜uŸ}™}Ñ/Ð0Ô1Ø‡M�MÐ-¬e´C×4DÑ4DÀRÕ4HÓ.IÑ-LÐMÔNØ‡M�MÐ$¤U×%6Ñ%6Ñ$9Ð:Ô;Ø‡M�M�"ÔØ‡M�MØOôð ‡M�MÐNÔOØ‡M�M�,ÔÛˆØ�‰˜˜e F�m×3Ñ3Ñ6°b¼¸UÀ:Õ=NÓ9OÐ8PÐPRÐSÖTñ à‡M�M�#ÔØ‡M�M�"ÔØ‡M�MØPôð ‡M�MÐUÔVØ‡M�MØRôð ‡M�MÐ%¸×8NÒ8NÓ&OÑ8N°1¤t¨A¦wÑ8NÑ&OÑ%RÐSÔTØ‡M�MØ
!°G×4PÒ4PÓ"QÑ4P¨q¤4¨¦7Ñ4PÑ"QÑ!TÐUôð ‡M�M�"ÔØ‡M�MÐWÔXØ‡M�MØ
°'×2LÒ2LÓ MÑ2L¨Q¤ a¦Ñ2LÑ MÑPÐQôð ‡M�M�"ÔØ‡M�MØNôð ‡M�MÐ&¤u¨W×-DÑ-DÓ'EÑ&HÐIÔJØ‡M�M�"ÔØ‡M�MØNôð ‡M�MÐ9Ô:ðÜ˜MÓ*ˆð ‡M�MÐ% lÑ%5Ð6Ô7Ø‡M�M�"ÔØ‡M�M�/Ô"Ø‡M�MÐGÔHØ‡M�M�#ÔØ‡M�MØPôð ‡M�MØQôð ‡M�MØOôð ‡M�MØOôð ‡M�M�/Ô"Ø‡M�M�Jœt F›|Ñ.Ð/Ô0Ø‡M�M�"ÔØ‡M�M�/Ô"Ø‡M�MÐ5Ô6Ø‡M�M�#ÔØ‡M�MØPôð ‡M�MØUôð ‡M�M�/Ô"Ø‡M�M�L¤¤d¨8£nÓ!5Ñ 8Ð9Ô:Ø‡M�M�"ÔØ‡M�M�/Ô"Ø‡M�MØNôð ‡M�M�/Ô"Ø‡M�MÔ0Ó2Ô3Ø�<‰<‹>ÐùòA 'Pùâ"Qùò
 !Nøô ô ÜØ& u§}¡}Ñ&7ð 85Ü59¸!³W×5EÑ5EÐ4FÀbÈÈÈ2ðOó
ð ð	ûðús*   È%T5
ÉT:
Ê7T?
ÍU ÕVÕ4VÖVc               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )r0   r‚  r   rÊ  rË  rÌ  r   rm   rn   Úentry_fnr2   r4   útuple[str, bytes]r   )r5   s   "r#   r6   r6   >  sD   € ÷ ='ñ ='Øð='àð='ð ð='ð ð	='ð
 ð='ð ñ='r"   c                óX  a€ \        V 4      p\        WP4       \        V4      o\        V3R l\	        V4       4       4      pV'       d   \        RV P                  : RV R24      h\        WWV\        V4      4      pRpVR8w  d&   ^ RI	H
p	 V	P                  4       p
V
f   RMV
^ ,          p\        P                  ! 4       p\        P                  ! R\         R	\"        R
VRRR\$        P&                  ! VP)                  4       4      P+                  4       RV/V4       W{P-                  4       3# )aÆ  ``(python_code, cache)`` for a multi-graph capture.

python_code is self-contained -- it carries the frames, the guard trees and
the compiled subgraphs -- so cache is the same acceleration it is for the
make_fx form: the inductor bundle that primes the kernel caches, and the tag
binding it to this python_code (invariant 7). The bundle is whatever
``CacheArtifactManager`` recorded, so the caller must have run the capture
under ``with_fresh_cache()``.
c              3  óš   <"  € T F@  w  rVR ,          '       g   K  VS9  g   K  VR,           RVR,          P                    2x € KB  	  R# 5i)r‹  rˆ  rÙ   rY  N)r×  )rŸ   ró   r›  r²  s   &  €r#   r¢   Ú-_build_multigraph_artifact.<locals>.<genexpr>S  sP   øé € ð á)‰HˆAØ�×Ñô 	<à!"¨)Ñ!3ô 	<ˆ5�Õ!Ð
" ! E¨&¥M×$9Ñ$9Ð#:Õ;Û)ùs   ƒA›A¤'AzOprecompile captured frame(s) a standalone artifact cannot reach from the entry rÐ  a+  . A source artifact dispatches only the entry frame and the graph-break continuations its bytecode names; a frame entered by an ordinary call -- a graph break inside a child module's forward, say -- would run eager. Move the graph break into the entry, or make the child module compile in one piece.Nr6  )ÚCacheArtifactManagerr5   Úversionrm   rq   r  Ú	code_hashÚartifact)r”  rÁ  rµ  r@  rì   r   r¾  rß  rÈ  Útorch.compiler._cacheræ  Ú	serializeÚioÚBytesIOr§   rc   Ú_CACHE_FORMATÚ_CACHE_VERSIONÚhashlibÚsha256ÚencodeÚ	hexdigestrQ  )r‚  rÊ  rÌ  rm   rá  r–  Úunreachabler•   Úinductor_bundleræ  rÀ   ré  r²  s   &&&&&       @r#   Ú_build_multigraph_artifactrö  >  s&  ø€ ô    Ó&€Fô   Ô.Ü! &Ó)€IÜô ä! &Ô)óó €K÷
 ô
 ðØŸ™Ñ)¨¨K¨=ð 9ðó
ð 	
ô 2Ø�x¨'´>À(Ó3Kó€Kð €OØ�'ÔÝ>à$×.Ñ.Ó0ˆØ"'¢-™$°U¸1µXˆÜ
�*Š*‹,€CÜ	‡J‚Jà”mØ”~Ø�wØ�hØœŸš¨×(:Ñ(:Ó(<Ó=×GÑGÓIØ˜ð	
ð 	ô
ð Ÿ™›Ð&Ð&r"   c               ó   € V ^8„  d   QhRR/# ©r0   r4   rn   r   )r5   s   "r#   r6   r6   ~  s   € ÷ 
Fñ 
F¨ñ 
Fr"   c                 óÀ   € ^ RI Hp  \        P                  ! V P                  4      P                  4       pRpRV,           R,           V,           R,           \        ,           # )z×Emit the multi-graph driver as text, the same getsource path the others use.

The driver is a builder, so the section binds ``forward`` itself and then ends
in the same ``__main__`` hint as the single-graph drivers.rd  z%forward = _build_multigraph_forward()rk  rl  )r§   re  rm  rn  Ú_build_multigraph_forwardrh  rs  )rt  r9  r  s      r#   rÝ  rÝ  ~  sI   € õ 3ä×Ò˜V×=Ñ=Ó>×EÑEÓG€DØ5€GØ�$�;˜Õ! GÕ+¨hÕ6¼ÕEÐEr"   c               ó    € V ^8„  d   QhRRRR/# ro  r   )r5   s   "r#   r6   r6   ‹  s   € ÷ Bñ BÐ.ð B°4ñ Br"   c                ó6  € ^ RI Hp V P                  P                   Fx  pVP                  R8X  g   K  \        VP                  \        P                  P                  4      '       g   KL  V! VP                  4      f   Kb  \        RVP                   24      h	  R# )að  Enforce invariant 4 of Note [precompile programming model]: reject boundary
effects the AOT backend's standalone composition does not handle. Detected
directly from the captured graph -- no AOTAutograd coupling.

Input mutation (incl. module buffers, e.g. BatchNorm running stats), tensor-
subclass wrap/unwrap, output aliasing, and functionalized RNG are SUPPORTED:
AOTAutograd's codegen'd prelude/epilogue is composed into the artifact (see
torch._functorch.aot_autograd.compile_to_python), so they are not rejected here.

Effectful ops are not supported yet (an implementation gap, not a fundamental
limit), so raise here with a concrete reason rather than let the failure surface
deep in the cache layer. See _unsupported for the mechanical cause.
)Ú_get_effectÚcall_functionNzeffectful op )Útorch._higher_order_ops.effectsrý  rÚ   rû   rØ   r¦   rÜ   r§   Ú_opsÚ
OpOverloadÚ_unsupported)rÂ   rý  rá   s   &  r#   rÜ  rÜ  ‹  sm   € õ <à—‘—”ˆð �7‰7�oÖ%¬*Ø�K‰KœŸ™×.Ñ.÷+
ô +
ñ ˜4Ÿ;™;Ó'Ô3Ü" ]°4·;±;°-Ð#@ÓAÐAó r"   c               ó    € V ^8„  d   QhRRRR/# )r0   Úreasonrn   r4   r   r   )r5   s   "r#   r6   r6   ¥  s   € ÷ ñ ˜ð  ñ r"   c                ó    € \        R V  R24      # )z,precompile cannot compile this computation: z³. The graph contains an effectful op, which is not supported yet: its with_effects HOP is non-cacheable, so the compiled artifact cannot be saved and lowered to standalone source.)r   )r  s   &r#   r  r  ¥  s    € ÜØ
6°v°hð ?ð 	óð r"   c                  ó€   € ] tR tRtRtRRRRRR/R	 R
 llt]R R l4       tR R ltR R lt	R R lt
RR R lltRtR# )rr   i®  zBInternal holder for a precompiled computation / a loaded runnable.rm   r5  rq   r   r(   Nc          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r0   rh   ri   rm   rn   rq   r(   r'   r4   rK   r   )r5   s   "r#   r6   ÚPrecompiledModule.__annotate__±  sC   € ÷ ?Bñ ?Bà!ð?Bð ð	?Bð
 ð?Bð $ð?Bð 
ñ?Br"   c               	óÆ  € VR9  d   \        RV: R24      hVR9  d   \        RV: R24      hWn        W n        W0n        W@n        RV n        . V n        ^ V n        . V n        . V n	        . V n
        . V n        . V n        . V n        . V n        . V n        RV n        RV n        RV n        RV n        RV n        . V n        . V n        . V n        . V n        . V n        RV n        R# )r5  z6precompile backend must be 'inductor' or 'eager', got rÙ   z5precompile tracer must be 'make_fx' or 'dynamo', got Nr  r4  )r   r  )r�   Ú_fnró  Ú_tracerÚ_decompositionsÚ	_artifactrô  rõ  r¸   rö  r÷  rø  rù  rú  rû  rü  rï  rî  r´   Ú_graph_pythonÚ_artifact_bytesrý  rþ  rÿ  r   r  Ú_loaded_forward)r>   rh   rm   rq   r(   s   &&$$$r#   rz   ÚPrecompiledModule.__init__±  s  € ð Ð/Ô/ÜØHÈÉÐSTÐUóð ð Ð.Ô.ÜØGÈÁzÐQRÐSóð ð ŒØŒØŒØ-ÔØ!%ˆŒØ,.ˆÔØ)*ˆÔ!ð (*ˆÔØ(*ˆÔØ46ˆÔØ57ˆÔØ(*ˆÔØ)+ˆÔØ)+ˆÔØ*,ˆÔØ04ˆŒØ15ˆŒØ04ˆŒð #%ˆÔØ-1ˆÔð
 /1ˆÔ ð HJˆÔØ46ˆÔØ57ˆÔ ð .0ˆÔà=AˆÖr"   c               ó$   € V ^8„  d   QhRRRRRR/# )r0   r  ri   rm   rn   r4   rr   r   )r5   s   "r#   r6   r  ó  s(   € ÷ ñ à&ðð ð	ð
 
ñr"   c               ó&   € V ! RVR7      pWn         V# )aÐ  Build a runnable from load()'s reconstructed forward.

load() does not re-run capture/_compile, so reuse ``__init__`` for all the
defaults (the single definition of this object's state) and override only the
reconstructed forward. All the calling-convention metadata lives in the inlined
driver (``forward``) itself, so the __init__ fields (``_fn``, ``_gm``,
``_module_positions``, ``_out_spec``, ...) stay at their defaults; inspect the
artifact via python_code.
N©rm   )r  )Úclsr  rm   Úobjs   &&$ r#   Ú_from_loadedÚPrecompiledModule._from_loadedò  s   € ñ  �$ Ô(ˆØ%ÔØˆ
r"   c               ó    € V ^8„  d   QhRRRR/# rš   r   )r5   s   "r#   r6   r  	  s   € ÷ dñ dÐ/ð d°Dñ dr"   c                	óø  € V P                   R 8w  d   \        RV P                   : R24      hV P                  R8X  d   \        V4      '       d   \        R4      h\	        V P
                  WP                  4      pVP                  V n        VP                  V n
        VP                  V n        VP                  V n        VP                  V n        VP"                  V n        VP&                  V n        VP*                  V n        VP.                  V n        VP2                  V n        VP6                  V n        VP:                  V n        VP>                  V n         VPB                  V n"        VPF                  V n$        VPJ                  V n&        VPN                  V n(        VPR                  V n*        V P                  R8X  d   R# ^ RI+H,u H-p ^ RI.H/p ^ RI0H1p ^ RI2H3p R	R
/pVPh                  e   \k        VR4      '       d   R
VR&    VPm                  VPR                  VPn                  VR7      w  V n8        V n9        R#   T d   p\u        R4      ThRp?iT d#   pR\w        T4      9   d   \u        R4      Thh Rp?ii ; i)r   zprecompile tracer=z< is not implemented yet; use tracer='make_fx' (the default).r6  zxprecompile: mark_unbacked (dynamic shapes) is only supported with backend='inductor'; eager + unbacked is not supported.N)Úaot_autograd)ÚInductorError)ÚNoRunnableInductorModuleErrorÚsize_assertsTÚscalar_asserts)ÚoptionszÌthe inductor backend cannot lower a graph with no compute -- the traced fn returns its inputs or Python constants unchanged, producing no Inductor kernel. Return a computed tensor, or use backend='eager'.zUnexpected output typeszÜthe inductor backend cannot lower a graph whose output mixes a non-tensor Python value (e.g. float / complex / str) with computed tensors (int / bool / None outputs are fine). Return only tensors, or use backend='eager'.)<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×  rÿ  rØ  r   rÙ  r  rÂ  rï  rÔ  rî  r½  rý  rÂ   r´   Útorch._inductor.configÚ	_inductorrJ  Útorch._functorchr  Útorch._inductor.excr  Ú"torch._inductor.standalone_compiler  rW  ÚhasattrÚcompile_to_pythonrË  r  r  r   rn   )	r>   r1   ÚcaptureÚ_ind_configr  r  r  r   r‹   s	   &&       r#   r¥   ÚPrecompiledModule._compile	  sV  € ð �<‰<˜9Ô$Ü%Ø$ T§\¡\Ñ$4ð 52ð 2óð ð �=‰=˜GÔ#Ô(;¸D×(AÒ(AÜ%ðIóð ô ˜4Ÿ8™8 T×+?Ñ+?Ó@ˆØ!(×!9Ñ!9ˆÔØ$+×$?Ñ$?ˆÔ!Ø#×/Ñ/ˆÔØ$×1Ñ1ˆÔØ$×1Ñ1ˆÔØ%×3Ñ3ˆÔØ$×1Ñ1ˆÔØ%×3Ñ3ˆÔØ%×3Ñ3ˆÔØ&×5Ñ5ˆÔØ")×";Ñ";ˆÔØ")×";Ñ";ˆÔØ#*×#=Ñ#=ˆÔ Ø")×";Ñ";ˆÔØŸ™ˆŒØ ×)Ñ)ˆŒØ#*×#=Ñ#=ˆÔ Ø—:‘:ˆŒà�=‰=˜GÔ#ñ
 ÷ 	5Ð4Ý1Ý5ÝTð( '5°dÐ%;ˆØ×ÑÒ(¬W°[ÐBR×-SÒ-SØ(,ˆGÐ$Ñ%ð	Ø7C×7UÑ7UØ—
‘
˜G×-Ñ-°wð 8Vó 8Ñ4ˆDÔ Ö 4øð -ô 
	ô "ðUóð ð	ûð
 ô 	ð
 )¬C°«FÔ2Ü%ð.óð
 ðð ûð	ús*   È5H: È:I9ÉIÉI9ÉI9ÉI4É4I9c               ó$   € V ^8„  d   QhRRRRRR/# r/   r   )r5   s   "r#   r6   r  l	  s!   € ÷ 5ñ 5˜fð 5°ð 5¸6ñ 5r"   c                	óX   € V P                   f   \        R4      hV P                   ! V/ VB # )Nzvthis object is not runnable; serve a captured artifact with torch.compiler.precompile.load(artifact_path, cache_path).)r  r   r=   s   &*,r#   r?   ÚPrecompiledModule.__call__l	  s;   € ð ×ÑÒ'Ü!ðMóð ð ×#Ò# TÐ4¨VÑ4Ð4r"   c               ó   € V ^8„  d   QhRR/# rø  r   )r5   s   "r#   r6   r  v	  s   € ÷ >ñ > ñ >r"   c                ó  € V P                   e   \        R4      hV P                  R8X  d%   V P                  f   \        R4      h\	        V 4      # V P
                  '       g   \        R4      h\        W P
                  4      # )ai  Return the self-contained, executable Python artifact as a string.

It runs on its own, needing no cache (Note [precompile programming model],
"self-contained"). For the inductor backend it embeds the composed graph
module from aot_autograd.compile_to_python (kernels JIT-compile on first
call; AOTAutograd's prelude/epilogue inlined), the calling-convention
metadata, and a ``forward()`` that takes the same args the traced fn took
(the model(s) plus runtime inputs). For the eager backend it embeds the
captured ATen graph (both readable and executable) plus a driver that runs it
eagerly. No weights are embedded.
zÈthis object was produced by torch.compiler.precompile.load(); the python_code you passed in is the source artifact (load() does not re-capture, so there is no python_code to re-emit from this object).r6  z-internal: not compiled; call _compile() first)r  r   ró  r´   r`  r  rR  rE   s   &r#   r’   Ú PrecompiledModule.to_python_codev	  s{   € ð ×ÑÒ+Ü!ðWóð ð
 �=‰=˜GÔ#Ø�x‰xÒÜ%Ð&UÓVÐVÜ-¨dÓ3Ð3Ø×!×!Ð!Ü!Ð"QÓRÐRÜ# D×*<Ñ*<Ó=Ð=r"   c               ó    € V ^8„  d   QhRRRR/# )r0   r•   rÌ   r4   Úbytesr   )r5   s   "r#   r6   r  �	  s   € ÷ %ñ %¨*ð %Àñ %r"   c                óœ  € V P                   e   \        R4      hVf   V P                  4       p\        P                  ! VP                  4       4      P                  4       p\        P                  ! 4       p\        P                  ! R\        R\        RV P                  RV P                  RVRV P                  /V4       VP!                  4       # )a¦  Return the binary cache as bytes -- an ACCELERATION, not required to run.

``python_code`` is the single source of truth for the calling convention, so the
cache holds only the compiled artifact plus the integrity tag and code_hash. For
the inductor backend that artifact is the ``save_cache_artifacts`` bundle (load
primes the kernel caches with it, so a warm reload skips JIT); for the eager
backend it is None. See Note [precompile programming model], invariant 7.

``python_code`` defaults to what ``to_python_code()`` would emit; ``__call__``
threads in the exact string it already built so code_hash matches the bytes
returned to the user and the metadata is not rebuilt.
z¼this object was produced by torch.compiler.precompile.load(); the cache you passed in is the source artifact (load() does not re-capture, so there is no cache to re-emit from this object).r5   rç  rm   rq   rè  ré  )r  r   r’   rð  rñ  rò  ró  rì  rí  r§   rc   rî  rï  ró  r  r  rQ  )r>   r•   rè  ré  s   &&  r#   r“   Ú PrecompiledModule.to_cache_bytes�	  s´   € ð  ×ÑÒ+Ü!ðBóð ð
 ÒØ×-Ñ-Ó/ˆKÜ—N’N ;×#5Ñ#5Ó#7Ó8×BÑBÓDˆ	Ü�jŠj‹lˆÜ�
Š
àœ-Øœ>Ø˜4Ÿ=™=Ø˜$Ÿ,™,Ø˜YØ˜D×0Ñ0ðð ô
	
ð �|‰|‹~Ð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   r   r   r    rz   Úclassmethodr  r¥   r?   r’   r“   r!   r   r"   r#   rr   rr   ®  s\   † ÙLð?Bð "ð	?Bð
  ð?Bð '+÷?BðB ôó ðõ&dõL5õ>÷4%ó %r"   rr   Úwarnc               ó$   € V ^8„  d   QhRRRRRR/# )r0   r•   rn   r6  r,   r4   ri   r   )r5   s   "r#   r6   r6   ¸	  s$   € ÷ ?ñ ?Øð?Ø#ð?àñ?r"   c               ó˜   € V'       d   \         P                  R4       RR/p\        \        V RR4      V4       \	        RVR,          4      # )a®  Fallback: execute the self-contained python string (JITs kernels).

``python_code`` needs no cache -- the kernels (inductor) or graph (eager) are
inlined, so we just exec it and hand back its ``forward``. The returned
``forward`` takes the same args the traced fn took (model(s) plus runtime
inputs). ``warn`` is off only for the capture-time self-load, where the source
was just produced in-process and so is not untrusted input.zòtorch.compiler.precompile.load is about to EXEC python_code, which is untrusted executable input (it runs inlined kernels / graph code). Only exec python_code you produced or otherwise trust (Note [precompile programming model], invariant 7).r   Ú_precompiled_artifactz<precompile>Úexecri   r  )r>  Úwarningr:  Úcompiler   )r•   r6  Ú	module_nss   &$ r#   Ú_make_inlined_forwardr>  ¸	  sK   € ÷ Ü�‰ð0ô	
ð %/Ð0GÐ#H€IÜŒ�˜n¨fÓ	5°yÔAÜÐ'¨°9Õ)=Ó>Ð>r"   c               ó$   € V ^8„  d   QhRRRRRR/# )r0   Úpathrk   Úotherz'str | os.PathLike[str] | os.stat_resultr4   r,   r   )r5   s   "r#   r6   r6   Û	  s$   € ÷ ñ Ø
 ðØ)Pðà	ñr"   c                óN  €  \        V\        P                  4      '       d   TM\        P                  ! V4      p\        P                  ! V 4      pVP                  '       d   VP                  '       g   R# \        P
                  P                  W24      #   \         d     R# i ; i)a�  True when ``path`` resolves now to ``other`` (a path or a recorded stat).

False whenever either st_ino is 0: an inode number identifies a file only if it is
non-zero (a FAT/exFAT mount, CIFS mounted noserverino, Windows without
FILE_ID_INFO), and every name the writer compares lives in one directory, so
st_dev alone would call two DIFFERENT files the same one. Unknown identity must
never read as "same file".
F)r¦   ÚosÚstat_resultÚstatÚst_inor@  ÚsamestatrŠ   )r@  rA  ÚstÚheres   &&  r#   Ú_same_inoderJ  Û	  sn   € ðÜ  ¬¯©×7Ò7‰U¼R¿WºWÀU»^ˆÜ�wŠw�t‹}ˆØ�y�yˆy §§ ÙÜ�w‰w×Ñ Ó)Ð)øÜô Úðús   ‚AB Á"B Á6B ÂB$Â#B$c               ó    € V ^8„  d   QhRRRR/# )r0   r@  rk   r4   rK   r   )r5   s   "r#   r6   r6   ð	  s   € ÷ ñ Ð0ð °Tñ r"   c                óX   €  \         P                  ! V 4       R #   \         d     R # i ; ir:   )rC  ÚunlinkrŠ   )r@  s   &r#   Ú_unlink_quietlyrN  ð	  s$   € ðÜ
�	Š	�$ŽøÜô Úðús   ‚ š)¨)c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r0   rj   rk   rl   r•   rn   Úcacher2  r4   rK   r   )r5   s   "r#   r6   r6   ÷	  sA   € ÷ Kñ KØ)ðKà&ðKð ðKð ð	Kð
 
ñKr"   c                ó  aa€ . p. p W3W33 EF  w  rg\         P                  P                  \         P                  ! V4      4      pV'       d   \         P                  ! VRR7       \         P                  ! V4       R\         P
                  ! 4        R\        P                  ! 4       P                   R2p	VP                  W–34        \        P                  ! \         P                  ! V4      P                  4      R,          p
\         P                  \         P                  ,          \         P                   ,          \#        \         R^ 4      ,          oV
f   RMT
o\%        V	R	VV3R
 lR7      ;_uu_ 4       pTP'                  \)        V\*        4      '       d   VP-                  4       MT4       VP/                  4        \         P0                  ! VP3                  4       4       RRR4       V
e    \         P4                  ! Wš4       VP                  \         P                  ! V	4      4       EK   	  Tw  w  rÜw  rì\         P                  ! T 4       R\         P
                  ! 4        R\        P                  ! 4       P                   R2p  \         P:                  ! Y4       \         PL                  ! YÐ4       \         PL                  ! Yá4       \9        T4       T UUu0 uFB  w  rÆ\         P                  P                  \         P                  ! T4      4      ;'       g    RkKD  	  pppT FW  p \         P$                  ! T\         PZ                  4      p \         P0                  ! T4        \         P\                  ! T4       KY  	  R#   \         d    Rp
 EL’i ; i  + '       g   i     ELÀ; i  \         d     EL¶i ; i  \6         d    T F  w  rœ\9        T	4       K  	  h i ; i  \<         d     ELT\         dË   pTP>                  \@        9  g&   \         P                  PC                  T 4      '       g   h TP>                  \>        PD                  8X  dP   \G        \         R4      '       d:   \         P                  ! T 4      PH                  \         PJ                  ! 4       8w  d   h \         PL                  ! Y4        Rp?EL#Rp?ii ; i  \6         EdÊ    R;p;p;p;p;pp T^ ,          PN                  '       * pT^,          PN                  '       * p\Q        Y^ ,          4      ;'       g/    T;'       d%    \         P                  PS                  T4      '       * pT;'       dI    \Q        Y^,          4      ;'       g/    T;'       d%    \         P                  PS                  T4      '       * p\         P                  PS                  T4      pT;'       d%    \         P                  PS                  T 4      '       * pRp T'       g   T'       g   T'       g   RpMnT'       d*   T'       g	   T'       d   \         PL                  ! Yð4       RpM=T'       d   RpM2T'       d   \         PT                  ! T 4       RpM  \         d     Mi ; iT'       d   TMT pT'       d   TpM\Q        Y4      pT'       d·   T'       g¯   \         P                  PS                  T4      '       dŠ   T'       dB   \V        PY                  R\         P                  ! T 4      T\         P                  ! T4      4       MS\V        PY                  R\         P                  ! T 4      \         P                  ! T4      4       MT'       d   \9        T4       T F  w  rœ\9        T	4       K  	  h   T'       d   TMT pT'       d   TpM\Q        Y4      pT'       d·   T'       g¯   \         P                  PS                  T4      '       dŠ   T'       dB   \V        PY                  R\         P                  ! T 4      T\         P                  ! T4      4       MS\V        PY                  R\         P                  ! T 4      \         P                  ! T4      4       MT'       d   \9        T4       T F  w  rœ\9        T	4       K  	  i ; ii ; iu uppi   \         d     EK�  i ; i  \         d     ELai ; i  \         d     EK´  i ; i   \         P\                  ! T4       i   \         d     i i ; i; i)añ  Write the matched (python_code, cache) pair, creating parent directories.

Each half is written beside its target and renamed into place, so neither named file
is ever truncated or half-written. The two renames are not one atomic step: the
previous source is hard-linked to a backup first and put back if the second rename
raises, so a Python exception (a full disk, a permission error) leaves the previous
pair intact. Without hard links the previous source is MOVED aside instead, so an
interrupt before the undo's probes have run leaves the artifact NAME empty with that
source only in the ``.bak``, unreported and one rename from recovered. Which undo
runs, and whether it is reported, is read off the DISK, not from flags (the comment
on the undo has the reasoning). Process death between the renames is not covered, nor
a reader or a second writer racing them: that can leave one source beside the other's
cache, which ``load`` refuses on the cache's sha256, and can cost the previous source.
Nor is a SYMLINKED artifact name: ``os.link`` follows it, so the backup holds the
link's target while ``os.replace`` replaces the link itself, and an undo therefore
restores a regular file where the symlink stood.
The parent directory is fsync'd after, best effort.
T)Úexist_okrÙ   z.tmpiÿ  NÚO_BINARYi¶  Úwbc                ó4   <€ \         P                  ! V SS4      # r:   )rC  Úopen)r¼   rl  ÚflagsÚperms   &&€€r#   Ú<lambda>Ú!_write_artifact.<locals>.<lambda>&
  s   ø€ ´R·W²W¸QÀÀtÔ5Lr"   )Úopenerz.bakÚgeteuidFzÙprecompile could not put the previous artifact back at %s; that previous source is kept at %s, and the pair does not load until that file is moved back over the first path (the cache at %s is the one that matches it).z·precompile wrote the artifact at %s and then failed to write its cache at %s, and could not remove the artifact again; no cache beside it matches that file, so the pair does not load.)/rC  r@  ÚdirnameÚfspathÚmakedirsÚgetpidÚuuidÚuuid4Úhexrß   rE  ÚS_IMODEÚst_moderŠ   ÚO_WRONLYÚO_CREATÚO_EXCLrÞ   rV  Úwriter¦   rn   rò  ÚflushÚfsyncÚfilenoÚchmodr  rN  ÚlinkÚFileNotFoundErrorÚerrnoÚ_NO_HARD_LINK_ERRNOSÚisfileÚEPERMr&  Úst_uidr\  rZ  rF  rJ  ÚlexistsrM  r>  r;  ÚO_RDONLYÚclose)rj   rl   r•   rP  ÚwrittenÚ	new_statsr@  rx  ÚparentÚtmprD  ra  rl  Úartifact_tmpÚ	cache_tmpÚbackupr‹   ÚcompleteÚkeptÚlandedÚasideÚprobedÚundoneÚblind_artifactÚblind_cacher¯  Údrop_backupÚparentsÚfdrW  rX  s   &&&&                         @@r#   r‰   r‰   ÷	  s·  ù€ ð0 €GØ&(€Ið%Ø,Ð:¸ZÐ<OÔP‰MˆDÜ—W‘W—_‘_¤R§Y¢Y¨t£_Ó5ˆFßÜ—’˜F¨TÕ2ô —Y’Y˜t“_Ð% Q¤r§y¢y£{ m°1´T·Z²Z³\×5EÑ5EÐ4FÀdÐKˆCØ�N‰N˜C˜;Ô'ðÜ#'§<¢<´·²¸³×0EÑ0EÓ#FÈÕ#N�ô —K‘K¤"§*¡*Õ,¬r¯y©yÕ8¼7Ä2ÀzÐSTÓ;UÕUˆEØ šL‘5¨dˆDä�c˜4Õ(L×MÕMÐQRØ—‘¬J°wÄ×,DÒ,D˜Ÿ™Ô(È'ÔRØ—‘”	Ü—’˜Ÿ™›Ô$÷ Nð ÒðÜ—H’H˜SÔ'ð ×ÑœRŸWšW S›\×*ñA QðJ )0Ñ%Ñ€\‘~˜	Ü—	’	˜-Ó(Ð)¨¬2¯9ª9«;¨-°q¼¿º»×9IÑ9IÐ8JÈ$ÐO€Fðvð	.Ü�GŠG�MÔ*ô( 	�
Š
�<Ô/Ü
�
Š
�9Ô)ä˜Ôñx GNÔNÁg¹7¸1Œr�w‰w�‰œrŸyšy¨›Ó/×6Ð6°3Ò6Ág€GÑNó ˆð	Ü—’˜¤§¡Ó-ˆBð
	ô �HŠH�RŒLðÜ—’˜–ó øôe ô Ø“ðú÷
 N×MÐMûô ô Úðûô ô Û‰FˆCÜ˜CÖ ñ àðûô !ô 	ÚÜô 	.ð �w‰wÔ2Ô2¼"¿'¹'¿.¹.È×:WÒ:WØð —‘œ5Ÿ;™;Ô&ÜœB 	×*Ò*Ü—G’G˜MÓ*×1Ñ1´R·Z²Z³\ÔAàÜ�JŠJ�}×-Ò-ûð!	.ûô* õ Zð >CÐBˆÐB�4ÐB˜&ÐB 5ÐB¨6°FðM	%ð "+¨1¥×!4Ñ!4Ô4ˆNØ'¨�l×1Ñ1Ô1ˆKÜ  ¸!µÓ=÷ ð Ø×DÐD¤r§w¡w§¡°|Ó'DÔ#Dð ð ÷ ð Ü˜J°!­Ó5÷ Dð DØ×BÐB¬¯©¯©¸	Ó(BÔ$Bð ô —7‘7—?‘? 6Ó*ˆDØ×?Ð?¤§¡§¡°Ó!?Ô?ˆEØˆFðß§F¯dØ!‘FßŸv¯Ü—J’J˜vÔ5Ø!‘Fßð
 "‘Fßô —I’I˜mÔ,Ø!�FùÜô Ùðú÷
 #‘F¨ˆEßØ"‘ô *¨-Ó@�ßŸf¬¯©¯©¸×)?Ò)?ßô —K‘Kð4ô Ÿ	š	 -Ó0ØÜŸ	š	 *Ó-õô —K‘KðXô Ÿ	š	 -Ó0ÜŸ	š	 *Ó-õ÷ ô   Ô'Û!‘�Ü Ö$ñ "àø÷G #‘F¨ˆEßØ"‘ô *¨-Ó@�ßŸf¬¯©¯©¸×)?Ò)?ßô —K‘Kð4ô Ÿ	š	 -Ó0ØÜŸ	š	 *Ó-õô —K‘KðXô Ÿ	š	 -Ó0ÜŸ	š	 *Ó-õ÷ ô   Ô'Û!‘�Ü Ö$ò "úðqZüóv Oøô ô 	Ûð	ûô ô 	Úð	ûô
 ô ÛðûðÜ—’˜•øÜô Ùðýs0  ˆC O  Ã	;NÄA3O  Å7A,NÇ#O  Ç0N.È*O  Ê
O& Ê 7S ËA b#Ìb#Ì-%b)Íb<Í*cÎNÎO  ÎNÎO  ÎN+Î%	O  Î.N=Î9O  Î<N=Î=O  Ï #O#Ï&SÏ1S Ï4SÏ=SÏ>9SÐ8BSÒ=S ÓSÓS Ób Ó$A^Ô-	^Ô7-^Õ%^Õ?	^Ö	A^×'^×>Y6ØY6ØY6ØY6Ø^ØY6Ø!Y6Ø)Y6Ø1Y6Ù	^Ù
Y6ÙY6Ù^ÙY6ÙY6Ù5^Ù6ZÚ^ÚZÚ^Úb Úb Ú1b Ú9$b Ûb Û&Bb Ý/"b ÞbÞ&bÞ<bß$bß)bß1Bbá:"bâb â)b9â8b9â<cãc!ã
cãc!ãcãcã!dã#c:ã9dã:d	ädäd	ädc               ó$   € V ^8„  d   QhRRRRRR/# )r0   rj   rk   rl   r4   râ  r   )r5   s   "r#   r6   r6   Å
  s&   € ÷ ñ Ø)ðà&ðð ñr"   c           	     óŽ  €  \        V R4      ;_uu_ 4       pVP                  4       P                  4       pRRR4       \        VR4      ;_uu_ 4       pVP                  4       pRRR4       XV3#   + '       g   i     LA; i  + '       g   i     XX3# ; i  \        \        3 d   p\        RT : RT: RT 24      ThRp?ii ; i)a$  Read back a pair written by :func:`_write_artifact`.

Bytes, then decoded: the exact inverse of the byte-mode write, so a ``\r`` in
python_code survives the round trip instead of being translated to ``\n`` by a
text-mode read and failing the cache's code_hash. An ``OSError`` from either open (a
missing half, a path the filesystem cannot open) or a ``UnicodeDecodeError`` from the
decode (a readable file that is not the source half -- transposed arguments, say) is
a ``PrecompileError`` naming both paths, with the original as its ``__cause__``.
ÚrbNz;precompile could not read the artifact pair (artifact_path=z, cache_path=z): )rV  Úreadr  rŠ   ÚUnicodeDecodeErrorr   )rj   rl   ra  r•   rP  r‹   s   &&    r#   Ú_read_artifactr�  Å
  sº   € ð	Ü�- ×&Ô&¨!ØŸ&™&›(Ÿ/™/Ó+ˆK÷ 'ä�*˜d×#Ô# qØ—F‘F“HˆE÷ $ð ˜ÐÐ÷ '×&úç#Ö#ð ˜ÐÐûô Ô'Ð(ô ÜØIØÑ˜}¨Z©N¸#¸a¸SðBó
ð ð	ûðúsK   ‚B –A.µB ÁBÁ"B Á.A>	Á9B ÂB	ÂB ÂB ÂCÂ(B?Â?Cr�   Fc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r0   r•   rn   rP  r2  r�   r,   r4   r+   r   )r5   s   "r#   r6   r6   ß
  s8   € ÷ mDñ mDØðmDØ"ðmDØ15ðmDàñmDr"   c               ób  € ^ RI p\        V 4      p\        \        VR,          4      p\        \        VP	                  RR4      4      pRp VP
                  ! \        P                  ! V4      RR7      pVP	                  R4      \        8w  g   VP	                  R4      \        8w  dB   \        P                  R	VP	                  R4      VP	                  R4      \        \        4       RpVeñ   VP	                  R
4      V8w  d$   \        RVP	                  R
4      : RV: R24      hVP	                  RR4      V8w  d%   \        RVP	                  RR4      : RV: R24      h\        P                  ! V P                  4       4      P!                  4       p	VP	                  R4      V	8w  d$   \        RVP	                  R4      : RV	: R24      hVP	                  R4      pTe    TP(                  P+                  T4       \-        Y'       * R7      p\.        P1                  YµR7      #   \         d    h \"         d5   p
\        P                  R\%        T
4      P&                  T
4        Rp
?
LŒRp
?
ii ; i  \"         d5   p
\        P                  R\%        T
4      P&                  T
4        Rp
?
L®Rp
?
ii ; i)aD  Reconstruct a runnable from an in-memory ``(python_code, cache)`` pair.

The shared core of :func:`load` (which reads the pair off disk first) and the
capture-time self-load in :class:`_MakeFxCapture`. ``_trusted`` is set only for
that self-load, where the source was just produced in-process, to suppress the
exec warning.
Nr  r  r   T)Úweights_onlyr5   rç  z£torch.compiler.precompile got a cache with format=%r version=%r, expected %r / %r; it is likely from a different torch build. Falling back to JIT from python_code.rm   zcache backend z( does not match the python_code backend zD; the cache and python_code came from different precompile captures.rq   zcache tracer z' does not match the python_code tracer rè  z0cache does not match python_code (its code_hash z != sha256(python_code) z�); the cache and python_code came from different precompile captures. Pair each cache with the python_code from the same capture.ré  z¨torch.compiler.precompile could not read the cache envelope (%s: %s); the cache is likely corrupt or from a different torch build. Falling back to JIT from python_code.z°torch.compiler.precompile could not prime the cache from the artifact bundle (%s: %s); it is likely stale or from a different torch build. Falling back to JIT from python_code.)r6  r  )Útorch._dynamorH  r   rn   rï   Úloadrì  rí  rî  rï  r>  r;  r   rð  rñ  rò  ró  rÜ  rj  r   ÚcompilerÚload_cache_artifactsr>  rr   r  )r•   rP  r�   r§   Úmetarm   rq   ré  ÚblobÚexpected_code_hashr‹   r  s   &&$         r#   r”   r”   ß
  sŠ  € ó ô $ KÓ0€DÜ”3˜˜Y�Ó(€Gô ”#�t—x‘x ¨)Ó4Ó5€Fð €Hð1
Ø�zŠzœ"Ÿ*š* UÓ+¸$Ô?ˆØ�8‰8�HÓ¤Ô.°$·(±(¸9Ó2EÜô3
ô �K‰Kð?ð —‘˜Ó"Ø—‘˜Ó#ÜÜôð ˆDØÒØ�x‰x˜	Ó" gÔ-Ü%Ø$ T§X¡X¨iÓ%8Ñ$;ð <+Ø+2©+ð 6?ð?óð ð
 �x‰x˜ )Ó,°Ô6Ü%Ø# D§H¡H¨X°yÓ$AÑ#Dð E.Ø.4©Zð 8?ð?óð ô ")§¢°×0BÑ0BÓ0DÓ!E×!OÑ!OÓ!QÐØ�x‰x˜Ó$Ð(:Ô:Ü%ØFØ—x‘x Ó,Ñ/Ð/GØ)Ñ,ð -9ð9óð ð —x‘x 
Ó+ˆHð Òð		Ø�N‰N×/Ñ/°Ô9ô $ K´lÔC€Gä×)Ñ)¨'Ð)ÓCÐCøôG ô ØÜô 
Ü�‰ð'ô �‹G×ÑØ÷	
ñ 	
ûð
ûô$ ô 	Ü�K‰KðEô �Q“× Ñ Ø÷ñ ûð	ús7   Á
FH" Ç I/ È"I,È7I,È8*I'É'I,É/J.É:*J)Ê)J.rq   rm   r5  c               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R/# )r0   rh   ri   rj   rk   rl   rq   r&   rm   rn   r4   rV   r   )r5   s   "r#   r6   r6   O  sN   € ÷ Rñ RØðRð *ð	Rð
 'ðRð ðRð ðRð ñRr"   c              ó:  € \         P                  P                  R4       \        V \        P
                  4      '       d   \        R4      h\        V\        4      '       g#   \        R\        V4      P                   R24      h\        V VVVVP                  R7      # )a;  Capture ``fn`` across the calls YOUR loop makes, writing the artifact on exit.

.. warning::

    This is a prototype API. Its signature, error types and artifact
    format may change between releases without a deprecation cycle.

Capture is caller-driven: this returns a capture object rather than running
anything. Enter it as a context manager, call it exactly as you would ``fn``
inside the block (a :class:`MakeFxTracer` capture takes exactly one call) --
each call runs for real, folds what it exercised into the capture, and
returns that run's result -- and the ``(python_code, cache)`` artifact is
written to ``artifact_path`` / ``cache_path`` when the block exits::

    with torch.compiler.precompile.capture(
        fn, artifact_path="m.py", cache_path="m.cache"
    ) as cap:
        y = cap(model, x)
    f = torch.compiler.precompile.load("m.py", "m.cache")

Because the caller makes the calls, inputs flow through naturally and return
values stay available, so the capture drops into an ordinary pipeline loop.
To write the artifact before the block ends, call ``cap.save()`` inside it.
A block that raises writes nothing it has not already saved, and a block
that made no call raises ``PrecompileError`` on exit. A capture is single-use:
to capture again, call ``capture()`` again.

``tracer`` picks the capture front-end and carries its tracer-specific
configuration. :class:`MakeFxTracer` is one non-strict ATen trace: the capture
takes exactly ONE call, refuses a second, and specializes control flow and
shapes to that call, with the contract of Note [precompile programming model]
in ``torch/_precompile.py``. Arguments are matched positionally at capture and
at load. ``fn`` is the whole computation, e.g. ``lambda model, x: model(x)``:
the ``nn.Module`` arguments have their params/buffers lifted to graph inputs
(no weights are baked in) and the rest are the runtime inputs; the reloaded
callable is invoked with the same argument structure, and the runtime model
must match the captured model's parameter/buffer structure.

``backend`` selects how the captured graph is realized: ``"inductor"``
(default) lowers through AOTAutograd + Inductor into one self-contained
module, and the cache holds the bundle that primes the inductor kernel caches
on load; ``"eager"`` keeps the captured ATen graph and runs it as-is (no
kernels, so the cache carries no artifact). A ``fn`` that runs a backward
captures it: the trace runs with grad enabled, the resulting parameter
gradients are scattered onto the runtime model exactly like eager
``.backward()``, and the artifact returns ``fn``'s own result.

.. note::

    ``torch.compiler.precompile`` is NOT
    ``torch._dynamo.config.caching_precompile`` (a ``torch.compile``
    guard-serialization caching mode); it captures ``fn`` ahead of time and
    lowers it to a self-contained Python source artifact.
z!torch.compiler.precompile.capturezéprecompile.capture takes the function itself, not a functools.partial: the artifact rebuilds the call from the function's own parameters, so a pre-bound model or argument would not be one of them. Pass them as call arguments instead.z6precompile.capture tracer must be a MakeFxTracer, got rÙ   )rm   r(   )r§   Ú_CÚ_log_api_usage_oncer¦   Ú	functoolsÚpartialrñ  r&   rj  r   rf   r(   )rh   rj   rl   rq   rm   s   "$$$$r#   r(  r(  O  s—   € ô~ 
‡H�H× Ñ Ð!DÔEÜ�"”i×'Ñ'×(Ò(Üð!ó
ð 	
ô �fœl×+Ò+ÜØDÜ�F‹|×$Ñ$Ð% Qð(ó
ð 	
ô Ø
ØØØØ×,Ñ,ôð r"   c               ó$   € V ^8„  d   QhRRRRRR/# )r0   rj   rk   rl   r4   r+   r   )r5   s   "r#   r6   r6   ¤  s$   € ÷ &3ñ &3Ø)ð&3Ø7Mð&3àñ&3r"   c                óp   € \         P                  P                  R4       \        W4      w  r#\	        W#4      # )a1  Reconstruct a runnable from the two files a precompile capture wrote.

.. warning::

    This is a prototype API. Its signature, error types and artifact
    format may change between releases without a deprecation cycle.

Name the two files :func:`capture` wrote -- the ``python_code`` artifact and
its ``cache``. A readable, current-format cache loads only
against the ``python_code`` it was emitted with (it carries a sha256 of exactly
those bytes); an unreadable or other-format cache is ignored with a warning.

The driver runs from ``python_code`` -- the single source of truth for the whole
calling convention. ``load`` reads the source's ``BACKEND``, checks the cache's
``backend`` tag against it, primes the inductor kernel caches when the cache
carries a bundle so a warm reload loads precompiled kernels instead of
JIT-compiling, and then exec's ``python_code``. With no usable cache it degrades to JIT'ing from
``python_code``. Both files are trusted, EXECUTABLE input: load only artifacts
you produced or otherwise trust.

Call the result with the SAME argument structure ``fn`` took -- the model(s)
in their original positions plus the runtime inputs. The runtime model must
match the captured model's parameter/buffer structure; precompile re-derives
the param/buffer list from it. The result is a
:class:`torch.compiler.precompile.PrecompiledRunnable`.

Raises ``PrecompileError`` if either file cannot be read, if ``python_code`` is
not a ``torch.compiler.precompile`` artifact, or if the cache's ``backend``,
``tracer`` or ``code_hash`` does not match ``python_code`` -- the pair came from different
captures. A cache whose ``format``/``version`` does not match (a foreign or
different-build envelope) is NOT fatal: the cache is acceleration only, so
``load`` degrades to JIT'ing from ``python_code`` rather than crashing.
ztorch.compiler.precompile.load)r§   rœ  r�  r�  r”   )rj   rl   r•   rP  s   &&  r#   r”  r”  ¤  s0   € ôH 
‡H�H× Ñ Ð!AÔBÜ'¨ÓBÑ€KÜ˜{Ó2Ð2r"   r:   )€Ú__conditional_annotations__r    Ú
__future__r   r{  Údataclassesrp  rž  rð  rm  rì  Úloggingrè   rC  r}  rE  rÔ  r   ra  Úcollections.abcr   r   Útypingr   r   r   r   r§   Útorch.utils._pytreeÚutilsÚ_pytreerª   r	   Útorch._guardsr
   Ú"torch.fx.experimental.proxy_tensorr   Útorch.nn.utilsr   Útorch.utils._python_dispatchr   Ú	getLoggerr   r>  r   Útyping_extensionsr   rN  r   rK  r   Ú torch.compiler._precompile_typesr   r   r)   rî  rï  rø   r   rÆ   r2   Ú	_MarkSpecr�  Ú_LeafBoundsr   ÚRuntimeErrorr   Ú	dataclassr&   r+   rV   r~   rf   rÉ   rÏ   rÓ   rä   rõ   r¶   r¤   r  r  r*  r5  r=  rb  ri  rs  rw  r’  râ  r”  rO  r  rH  rR  r[  r`  rs  rP  rÒ  rÓ  r€  r”  rµ  r¸  rÁ  rÈ  rß  rö  rÝ  rÜ  r  rr   r>  Ú	frozensetrs  Ú
EOPNOTSUPPÚEMLINKÚEXDEVrq  rJ  rN  r‰   r�  r”   r(  r”  )r¢  s   @r#   Ú<module>rº     s  øðôõZ #ã Û Û Û Û Û Û 	Û Û Û 	Û Û Û 
Û Û Ý $Ý "ß 4Ó 4ã ß $Ð $Ý Ý *Ý 6Ý $Ý Fð ×Ò˜Ó!€÷ Ý'Ý&åFÝ<ÝBð €ˆÓ ð ,€Ø€ñ
 �~ sÓ+€ð �&˜# �* c¨D¥j°#¸µ*Ð<Õ=€	ð �3˜˜c D�j¨#°­*Ð4Õ5Ð5Õ6¸Õ=€ñ  0°Ó3€	ÐÓ 3ô"�lô "ð$ ×Ò˜dÔ#÷'ð 'ó $ð'÷>añ a÷:!"ñ !"ðJ8ð ôc�Wô cõL	õ
õ	õõõ(õD
õ,õ^õ"%õPõ*õ.P-õf!õH
õ:
õ,4H÷nM÷`-#ñ -#ð`#Ð õLIõXxõvð6Ð õ".ðb€õ1ð2 Ð ð* ð ð ð ð€õ*Cõ'õT%õPXõ 5
õpõ$põf='õ@
FõBõ4ôGÐ+ô GðT?Ø&*÷?ñ< !Ø
‡[�[�%×"Ñ" E§L¡L°%·+±+Ð>óÐ õ
õ*õKõ\ð4mDØ8=÷mDð`Rñ (›>ðRð ÷R÷j&3r"   