+
    ÓåûjÊ1  ã            	      ó°  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
  ! R R]
4      tR R ltR R	 ltR$tR
^ RRR^R^/tR^ R^ R^ /tR%tR&t]! ]4      ]! ]4      8:  g%   ]! R]! ]! ]4      ]! ]4      ,
          4       24      h]tRtR R ltR R lt]! ^^4      t]P8                  ! R4      tR R ltR R ltR R lt R R lt!R  R! lt"R" R# lt#R# )'aa  Validating loader and identity helpers for native-AOT declarations.

The MECHANISM half of the declaration contract; the contract itself is
documented in tools/native_aot/decl.py, which re-exports this module.
Read that file to write a declaration, this one to change how they load.

Lives in torchgen, not tools/, because the wheel ships torchgen but not
tools/ -- and installed torchgen must load declarations out of tree
(`python -m torchgen.gen --source-path <site-packages>/torchgen/packaged
/ATen`), which a tools-side home broke with FileNotFoundError. It cannot
live under torch/ either: torchgen must not import torch, since stage-1
codegen runs before torch is built.

Torch-free for the same reason. Note that is the real constraint on
declaration modules too -- their module scope may import torchgen (pure
Python, no torch dependency), just not torch.
)ÚannotationsN)ÚAnyÚProtocolc                  óp   € ] tR t^t$ R]R&   R]R&   R]R&   R]R&   R R ltR	 R
 ltR R ltR R ltRt	R# )ÚAotDeclarationÚstrÚATEN_OPÚDISPATCH_KEYÚKERNEL_MODULEútuple[str, ...]ÚARCHSc               ó   € V ^8„  d   QhRR/# )é   Úreturnz
list[dict]© )Úformats   "ÚTC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torchgen\native_aot_decl.pyÚ__annotate__ÚAotDeclaration.__annotate__'   s   € ×7Ñ7¨
Ñ7ó    c                	ó   € R # ©Nr   )Úselfs   &r   Úkernel_precompile_gridÚ%AotDeclaration.kernel_precompile_grid'   s   € ±Cr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úargsr   Úkwargsr   Údictr   )r   s   "r   r   r   (   s   € ×BÑB #ÐB°ÐB¸ÑBr   c                	ó   € R # r   r   )r   r   r   s   &*,r   Úcovered_axesÚAotDeclaration.covered_axes(   s   € ¹sr   c               ó    € V ^8„  d   QhRRRR/# )r   Úspecr   r   r   r   )r   s   "r   r   r   )   s   € ×2Ñ2 Ð2¨#Ñ2r   c                	ó   € R # r   r   )r   r#   s   &&r   Úcpp_dispatchÚAotDeclaration.cpp_dispatch)   s   € ©sr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r#   r   Ú	launch_fnr   r   r   )r   s   "r   r   r   *   s   € ×@Ñ@˜tÐ@°Ð@¸Ñ@r   c                	ó   € R # r   r   )r   r#   r(   s   &&&r   Ú
cpp_launchÚAotDeclaration.cpp_launch*   s   € ¹Sr   r   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__r   r    r%   r*   Ú__static_attributes__r   r   r   r   r      s*   ‡ ØƒLØÓØÓð Óå7ÝBÝ2ß@Ñ@r   r   c               ó    € V ^8„  d   QhRRRR/# )r   Úaten_opr   r   r   )r   s   "r   r   r   -   s   € ÷ 	%ñ 	%˜Cð 	% Cñ 	%r   c                ó&   € V P                  RR4      # )aq  C-identifier for an op name: overload dots become underscores
("gt.Tensor" -> "gt_Tensor"). Names the DispatchStub, the generated
kernel fn, the artifact directory and the covers op.

One rule, one home: the runtime resolving covers_<id>, the C++
generator emitting its schema, and torchgen naming the stub must
agree exactly or the coverage fast path silently misses.
Ú.Ú_)Úreplace)r3   s   &r   Údecl_id_for_opr8   -   s   € ð �?‰?˜3 Ó$Ð$r   c               ó    € V ^8„  d   QhRRRR/# )r   Údr   r   r   r   )r   s   "r   r   r   9   s   € ÷ %ñ %ˆ~ð % #ñ %r   c                ó,   € \        V P                  4      # )z(decl_id_for_op for a loaded declaration.)r8   r   ©r:   s   &r   Údecl_idr=   9   s   € ä˜!Ÿ)™)Ó$Ð$r   r   r    r%   r*   Úcpp_dispatch_preludeÚcpp_helpersÚ
cpp_coversz;EXPORTABLE_ARCHES names arches this tooling cannot target: zsm_\d+a?c               ó    € V ^8„  d   QhRRRR/# )r   Únamer   Úpathr   )r   s   "r   r   r   n   s   € ÷ ñ �sð  #ñ r   c                óø   € \         P                  P                  W4      pVe   VP                  f   \	        RV 24      h\         P                  P                  V4      pVP                  P                  V4       V# )aã  Import a module from an explicit file path.

THE canonical copy for native-AOT code: torchgen ships in the wheel,
so tools/ and torch/ can both reach it. (tools/shared/module_loader.py
looks equivalent, but tools/ is not a wheel package, so neither
installed torchgen nor torch can import it.)

By path rather than by import because declaration modules must load
where their package is not importable: torchgen reads
torch/_native/ops/*/aot.py during stage 1, before torch is built.
zcannot load module from )Ú	importlibÚutilÚspec_from_file_locationÚloaderÚImportErrorÚmodule_from_specÚexec_module)rB   rC   r#   Úmods   &&  r   Úload_by_pathrM   n   sd   € ô �>‰>×1Ñ1°$Ó=€DØ‚|�t—{‘{Ò*ÜÐ4°T°FÐ;Ó<Ð<Ü
�.‰.×
)Ñ
)¨$Ó
/€CØ‡K�K×Ñ˜CÔ Ø€Jr   c               ó    € V ^8„  d   QhRRRR/# )r   r:   r   r   r   r   )r   s   "r   r   r   ‚   s   € ÷ 6ñ 6�ð 6 ?ñ 6r   c                ó6   € \        \        V R\        4      4      # )z½The declaration's architectures, defaulted when it omits ARCHS.

Read this instead of d.ARCHS: ARCHS is optional in a source
declaration and the loader validates it without writing it back.r   )ÚtupleÚgetattrÚ_DEFAULT_ARCHSr<   s   &r   Úarchs_ofrS   ‚   s   € ô
 ”˜˜G¤^Ó4Ó5Ð5r   zsm_([1-9][0-9]{1,2})a?c               ó    € V ^8„  d   QhRRRR/# )r   Úarchr   r   ztuple[int, int]r   )r   s   "r   r   r   ”   s   € ÷  ñ  �ð  ˜ñ  r   c                ó:  € \         P                  V 4      pVf   \        RV : R24      h\        \	        VP                  ^4      4      ^
4      w  r#V\        9  d@   \        RV : RV RV R\        P                   R\        P                  ^,
           R24      hW#3# )	aæ  sm string -> compute capability. "sm_90" -> (9, 0), "sm_103a" -> (10, 3).

Shared, because the exporter (matching a detected arch against ARCHS) and the
generator (grouping sidecars by capability) must agree what an sm string
means: they disagreed while one compared capabilities and the other strings,
and a declaration pinning ('sm_100a',) disowned the 'sm_100' its own on-device
export produced.

Refuses what it cannot parse rather than computing a capability: "sm_9" gives
(0, 9) and "sm_1000" (100, 0), each a gate no device satisfies, so the op
ships, links and declines every call unreported. Suffixes other than the
arch-conditional "a" (CUDA 12.9+'s family-conditional "f") are refused too --
they mean something the generator has not been taught.

_KNOWN_MAJORS would reject "sm_9" and "sm_1000" anyway (as capability 0.9 and
100.0), so the digit count in _SM_SPELLING is there for the DIAGNOSTIC: a
malformed string should be reported as unreadable, not as hardware that does
not exist.z+cannot read a compute capability from arch z6: expected sm_<major><minor>[a], e.g. sm_90a or sm_100zarch z parses as compute capability r5   z, outside the known range Ú-z%; a gate for it would match no device)	Ú_SM_SPELLINGÚ	fullmatchÚRuntimeErrorÚdivmodÚintÚgroupÚ_KNOWN_MAJORSÚstartÚstop)rU   ÚmÚmajorÚminors   &   r   Úcc_ofrd   ”   sµ   € ô& 	×Ñ˜tÓ$€AØ‚yÜØ9¸$¹ð B:ð ;ó
ð 	
ô œ#˜aŸg™g a›j›/¨2Ó.�L€EØ”MÔ!ÜØ�D‘8Ð9¸%¸ÀÀ%Àð I'Ü'4×':Ñ':Ð&;¸1Ü×!Ñ! AÕ%Ð&Ð&KðMó
ð 	
ð
 ˆ<Ðr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   rB   r   Úwantr\   rC   r   ÚNoner   )r   s   "r   r   r   ·   s(   € ÷ 
ñ 
˜Cð 
 sð 
°#ð 
¸$ñ 
r   c                ó\  € \        W4      p\        P                  ! V4      P                  P	                  4        Uu. uF.  pVP
                  VP                  VP                  39   g   K,  VNK0  	  pp\        V4      pWr8w  d%   V^ 8X  d   RMRp\        V RV RV RV RV 2	4      hR# u upi )é    zper-op (no-arg)zper-point (spec-taking)ú: z	 must be z, expected z positional parameter(s), got N)
rQ   ÚinspectÚ	signatureÚ
parametersÚvaluesÚkindÚPOSITIONAL_ONLYÚPOSITIONAL_OR_KEYWORDÚlenrZ   )	rL   rB   rf   rC   ÚfnÚpÚparamsÚnro   s	   &&&&     r   Ú_check_arityrw   ·   sÃ   € Ü	�Ó	€Bô ×"Ò" 2Ó&×1Ñ1×8Ñ8Ô:óá:ˆAØ�6‰6�a×'Ñ'¨×)@Ñ)@ÐAÑA÷ 	
ˆÙ:ð ð ô
 	ˆF‹€AØ„yØ$(¨A¤IÑ Ð3LˆÜØˆf�B�t�f˜I d V¨;°t°fð =!Ø!" ð%ó
ð 	
ñ ùòs   ¼)B)Á*B)c               ó$   € V ^8„  d   QhRRRRRR/# )r   rC   r   Úlabelr   rg   r   )r   s   "r   r   r   Ç   s!   € ÷ .ñ .�sð . 3ð .¨4ñ .r   c                óê  € \          F6  p\        \        WR 4      \        4      '       d   K%  \	        V RV RV 24      h	  \
        P                  4        FF  w  rE\        \        WR 4      4      '       g   \	        V RV RV R24      hVf   K:  \        WWQ4       KH  	  \        P                  4        F!  w  rE\        WR 4      f   K  \        WWQ4       K#  	  \        V 4      pV'       d;   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   \	        V RV RV: 24      hV F  p \        V4       K  	  V P                  4       p	\        V	\        4      '       d	   V	'       g   \	        V RV R
24      hV	 F5  p
\        V
\        4      '       d   K  \	        V RV R\!        V
4       24      h	  R #   \         d   p\	        T RT R	T: RT 24      ThR p?ii ; i)Nrj   z missing or non-str constant z missing required function z()c              3  óˆ   "  € T F8  p\        V\        4      ;'       d    \        P                  ! \        V4      x € K:  	  R # 5ir   )Ú
isinstancer   ÚrerY   Ú_SM_RE)Ú.0Úas   & r   Ú	<genexpr>Ú_validate.<locals>.<genexpr>Ù   s0   é € ð Ù@E¸1Œ
�1”cÓ×6Ð6œrŸ|š|¬F°AÓ6Ô6Ãùs
   ‚Až$AFTzT ARCHS must be a non-empty sequence of sm strings (e.g. ('sm_90a', 'sm_100a')), got z ARCHS entry z6 kernel_precompile_grid() must return a non-empty listz! grid entries must be dicts, got )Ú_REQUIRED_CONSTSr|   rQ   r   rZ   Ú_REQUIRED_FNSÚitemsÚcallablerw   Ú_OPTIONAL_FNSrS   Úallrd   r   Úlistr   Útype)r:   rC   ry   ÚconstrB   ÚarityÚarchsr€   ÚeÚgridÚpoints   &&&        r   Ú	_validater‘   Ç   s÷  € ß!ˆÜœ' !¨DÓ1´3×7Ô7Ü $  r¨%¨Ð0MÈeÈWÐUÓVÐVñ "ô %×*Ñ*Ö,‰ˆÜœ ¨Ó.×/Ò/Ü $  r¨%¨Ð0KÈDÈ6ÐQSÐTÓUÐUØÔÜ˜ %Ö.ñ	 -ô
 %×*Ñ*Ö,‰ˆÜ�1˜DÓ!Ô-Ü˜ %Ö.ñ -ô �Q‹K€EßŸ›ñ Ù@EóŸŸšñ Ù@Eó÷ ò ô Øˆf�B�u�gð 9Ø9>¹	ðCó
ð 	
ó ˆð	QÜ�!ŽHñ ð ×#Ñ#Ó%€DÜ�dœD×!Ò!¯ÜØˆf�B�u�gÐSÐTó
ð 	
ó ˆÜ˜%¤×&Ô&ÜØ�&˜˜5˜'Ð!BÄ4ÈÃ;À-ÐPóð ó øô ô 	QÜ $  r¨%¨°¸a¹UÀ"ÀQÀCÐHÓIÈqÐPûð	Qús   Ä?G
Ç
G2ÇG-Ç-G2c               ó    € V ^8„  d   QhRRRR/# )r   rC   r   r   zlist[AotDeclaration]r   )r   s   "r   r   r   ø   s   € ÷ ñ ˜Cð Ð$8ñ r   c                óª  € \        \        P                  P                  \        P                  P	                  V 4      4      R,           V 4      p\        VRR4      pVeh   V! 4       p\        V\        4      '       d	   V'       g   \        V  R24      h\        V4       F#  w  rE\        WPRV R\        VRR4       R	24       K%  	  V# \        WR
4       V.# )zîLoad and validate one aot.py: a single-op module (the module IS
the declaration) or a family module (exports declarations() -> list
of declaration objects). Raises RuntimeError naming the offending
path/declaration on contract violations.Ú_aotÚdeclarationsNz-: declarations() must return a non-empty listzdeclarations()[z] (r   Ú?z):Ú )rM   ÚosrC   ÚbasenameÚdirnamerQ   r|   r‰   rZ   Ú	enumerater‘   )rC   rL   ÚfamilyÚdeclsÚir:   s   &     r   Úload_declarationsrŸ   ø   s¹   € ô
 ”r—w‘w×'Ñ'¬¯©¯©¸Ó(=Ó>ÀÕGÈÓ
N€Cä�S˜.¨$Ó/€FØÒÙ“ˆÜ˜%¤×&Ò&¯eÜ $ Ð'TÐUÓVÐVÜ˜eÖ$‰DˆAÜ�a °°°3´w¸qÀ)ÈSÓ7QÐ6RÐRTÐUÖVñ %àˆäˆc˜ÔØˆ5€Lr   c               ó    € V ^8„  d   QhRRRR/# )r   rC   r   r   r   r   )r   s   "r   r   r     s   € ÷ ñ ˜3ð  >ñ r   c                ó|   € \        V 4      p\        V4      ^8w  d   \        V  R\        V4       24      hV^ ,          # )zASingle-declaration convenience: exactly one declaration expected.z%: expected a single declaration, got )rŸ   rr   rZ   )rC   r�   s   & r   Úload_declarationr¢     s;   € ä˜dÓ#€EÜ
ˆ5ƒz�Q„Ü˜d˜VÐ#HÌÈUËÈÐUÓVÐVØ��8€Or   c               ó    € V ^8„  d   QhRRRR/# )r   Úops_dirr   r   z%dict[tuple[str, str], AotDeclaration]r   )r   s   "r   r   r     s   € ÷ ñ  3ð Ð+Pñ r   c           	     óè  € / p\         P                  P                  V 4      '       g   V# \        \         P                  ! V 4      4       F¥  p\         P                  P                  WR4      p\         P                  P                  V4      '       g   KJ  \        V4       FL  pVP                  VP                  3pWQ9   d(   \        V RVP                   RVP                   24      hWAV&   KN  	  K§  	  V# )z\All (dispatch_key, op) -> declaration under ops_dir. Duplicate
(op, key) pairs are an error.zaot.pyz: duplicate declaration for Ú@)r˜   rC   ÚisdirÚsortedÚlistdirÚjoinÚexistsrŸ   r	   r   rZ   )r¤   r�   ÚentryrC   r:   Úkeys   &     r   Údiscover_declarationsr®     sÄ   € ð 46€EÜ�7‰7�=‰=˜×!Ò!ØˆÜœŸ
š
 7Ó+Ö,ˆÜ�w‰w�|‰|˜G¨HÓ5ˆÜ�w‰w�~‰~˜d×#Ò#ÙÜ" 4Ö(ˆAØ—>‘> 1§9¡9Ð-ˆCØŒ|Ü"Ø�fÐ8¸¿¹¸À1ÀQÇ^Á^ÐDTÐUóð ð �#‹Jó )ñ	 -ð €Lr   )r   r	   r
   )Úsm_90Úsm_90aÚsm_100Úsm_100aÚsm_103Úsm_103a)r¯   r°   r±   r²   )$Ú__doc__Ú
__future__r   Úimportlib.utilrE   rk   r˜   r}   Útypingr   r   r   r8   r=   rƒ   r„   r‡   ÚKNOWN_ARCHESÚEXPORTABLE_ARCHESÚsetÚAssertionErrorr¨   rR   r~   rM   rS   Úranger^   ÚcompilerX   rd   rw   r‘   rŸ   r¢   r®   r   r   r   Ú<module>r¿      s  ðñõ$ #ã Û Û 	Û 	ß  ôA�Xô Aõ"	%õ%ð
 @Ð ð
 ˜aØ�DØ�AØ�!ð€ð ˜AØ�1Ø�!ð€ð M€ð =Ð Ù
ÐÓ¡ \Ó!2Ô2Ù
Ø
EÙ‘#Ð'Ó(©3¨|Ó+<Õ<Ó=Ð
>ð	@óð ð €à	€õõ(6ñ �a˜“€ð �zŠzÐ3Ó4€õ õF
õ .õbõ(÷r   