+
    ‹°³jg"  ã                   óº   € ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIt^ RIt] ! R R4      4       tRtR	 tR
 R lt]R8X  d
   ]! 4        R# R# )é    N)ÚArgumentParser)Ú	dataclass)ÚPath)ÚListc                   óT   a € ] tR t^t o RtRtRtRtRtRt	^t
^tRtRtV 3R ltRtV tR# )ÚCompileArgsz8
A class to contain arguments from command-line parser.
Ú Nc                ó°   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   S[ ;R&   S[ ;R&   S[ R,          ;R&   S[;R&   S[;R&   S[ R,          ;R	&   S[R,          ;R
&   # )é   ÚpathÚkernel_nameÚ	signatureÚgridNÚtargetÚ	num_warpsÚ
num_stagesÚout_nameÚout_path)ÚstrÚintr   )ÚformatÚ__classdict__s   "€ÚU/home/luca/screen-checking/.venv/lib/python3.14/site-packages/triton/tools/compile.pyÚ__annotate__ÚCompileArgs.__annotate__   s„   ø‡ ‚ ñ
 �Nñ ñ Ññ ñ Ññ ñ �Nñ ñ �$�JÑñ ñ Ññ ñ Ññ ñ �D�jÑñ ñ �T�kÑ ò ó    © )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r   r   r   r   r   r   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      s@   ø‡ € ñð €DØ€KØ€IØ€DØ€FØ€IØ€JØ€HØ €H÷ ƒ r   r   a½  
Triton ahead-of-time compiler:

This program compiles the kernel with name `kernel-name` in the file at the
provided `path` into self-contained C source-code that embeds the `cubin`
data along with utilities to load, unload and launch the kernel.

signature is provided as a list of (optionally divisibility-hinted) types
or constexpr values, e.g.

`compile.py --kernel-name kernel --signature "*fp32:16, i32:16, 1024, i32" --out-name kernel /path/to/kernel.py`

will compile triton.JITFunction of name `kernel` inside the file `/path/to/kernel.py`.
Said kernel will be specialized such that argument 0, 1 are assumed to be multiple of 16,
and argument 2 is assumed to be a compile-time constant of value 1024, i.e. it won't be part of the generated prototype.

The resulting entry point will have signature

CUresult kernel_{specialization_suffix}(CUstream stream, unsigned gX, unsigned gY, unsigned gZ, float* arg0, int32_t arg1, int32_t arg2)

Different such specialized entry points can be combined using the `linker.py` script.

NOTE: when resolving the scope of /path/to/kernel.py, the file will be executed from within its parent directory with the python interpreter
used to run this `compile.py` script
c            	      óL  € \        \        R 7      p V P                  RRR7       V P                  RR\        RRRR	7       V P                  R
R\        RRR7       V P                  RR\        ^RR7       V P                  RR\        ^RR7       V P                  RR\        RRR7       V P                  RR\
        RRR7       V P                  RR\        RRR7       V P                  RR \        R!RR7       V P                  4       p\        R"/ \        V4      B p\        V4       R# )#)Údescriptionr   zTPath to Python source containing desired kernel in its scope. File will be executed.)Úhelpz--kernel-namez-nr	   zName of the kernel to compileT)ÚtypeÚdefaultr(   Úrequiredz--targetz-tNz°The target to compile towards, in format of '<backend>:<arch>:<warp-size>'; e.g., 'cuda:80:32', 'hip:gfx942:64'. Default to None, which means using current machine's GPU target)r)   r*   r(   z--num-warpsz-wz$Number of warps to launch the kernelz--num-stagesz-nsz/Number of stages (meta-parameter of the kernel)z
--out-namez-onz Out name for the compiled kernelz
--out-pathz-ozOut filenamez--signaturez-szSignature of the kernel)r)   r(   r+   z--gridz-gzLaunch grid of the kernelr   )
r   ÚdescÚadd_argumentr   r   r   Ú
parse_argsr   ÚvarsÚcompile_kernel)ÚparserÚcli_argsÚargss      r   Úmainr4   9   s4  € ä¬Ô-€FØ
×Ñ˜Øsð ô uà
×Ñ˜¨´CÀÐJiØ!%ð ô 'à
×ÑØ�Dœs¨Dðoð ô pð ×Ñ˜ t´#¸qÐGmÐÔnØ
×Ñ˜¨´CÀØNð ô Pà
×Ñ˜ e´#¸tÐJlÐÔmØ
×Ñ˜ d´¸tÈ.ÐÔYØ
×Ñ˜ t´#Ð<UÐ`dÐÔeØ
×Ñ˜ $¬SÐ7RÐ]aÐÔbØ× Ñ Ó"€HÜÑ(œ˜h›Ñ(€DÜ�4Ör   c                ó$   € V ^8„  d   QhR\         /# )r   r3   )r   )r   s   "r   r   r   P   s   € ÷ #ñ #œñ #r   c                 ót  € V P                   '       d   V P                   MV P                  pV P                  '       d   V P                  M
\        V4      p\        V P                  4      p\
        P                  P                  ^ \        VP                  4      4       \        P                  P                  VP                  V4      p\        P                  P                  V4      pVP                  P                  V4       \!        WPP                  4      pV P"                  P%                  R4      p\'        V4      ^8X  g   Q h\)        \+        R V P,                  P%                  R4      4      4      pR R lp	RV P.                   RV P0                   2p
V	! WŠ.,           4      pR p\3        V4       UUu/ uF.  w  rÞRV9   g   K  V3V! VP%                  R4      ^,          4      bK0  	  pppVP5                  4        UUu/ uF  w  ppVf   K  VVbK  	  ppp\3        V4       UUu/ uF  w  rÞVP6                  V,          V! V4      bK!  	  pppVP5                  4        UUu/ uF  w  ppVf   K  VVbK  	  pppVP5                  4        F,  w  ppV^8X  g   K  VVVP6                  V^ ,          ,          &   K.  	  \3        V4       UUu/ uF/  w  rÞVP6                  V,          VP%                  R4      ^ ,          bK1  	  pppV F  pR
VV&   K
  	  RP9                  VP;                  4        Uu. uF  p\        V4      NK  	  up4      pVP5                  4        UUu. uF  w  ppV RV 2NK  	  pppVRV P.                   2RV P0                   2.,          pVP;                  4        F  pVR:9   d   K  Q RV 24       h	  VP5                  4        UUu/ uF  w  ppV^8X  g   K  VR^..bK  	  pppVP=                  4        VP?                  VVVVR7      pV P@                  '       dB   \B        PD                  PF                  PH                  ! V P@                  P%                  R4      !  M1\B        PJ                  PL                  PN                  PQ                  4       p\B        PF                  PS                  V4      pRV P.                  RV P0                  /pVPU                  V4      p\B        PV                  ! VVVPX                  R7      p\!        VPZ                  R^ 4      ^ 8”  d   \]        R4      hVPZ                  P^                  ^ 8”  d   \]        R4      h. p. p . p!. p"\3        VP6                  4       F�  w  pp#V#V9  dU   VPa                  V#4       V Pa                  VV#,          4       V!Pa                  V#4       V"Pa                  VV#,          4       Ka  VPc                  V3R	4      ^8X  g   K{  VPa                  V#4       V Pa                  R4       KŸ  	  Rp$\3        VP;                  4       4       FP  w  pp%VPc                  V3R	4      ^8X  d   V$V R2,          p$VPc                  V3R	4      ^8X  g   KD  V$V R2,          p$KR  	  RP9                  WV$.4      p&VPd                  VPf                  ,          p'\        \h        Pj                  ! V'4      4      ^R; p(\B        PJ                  PL                  PN                  Pl                  p)VPn                  p*/ RV&bRV P                  bR\'        V'4      bR R!P9                  \q        V(R",          V(R#,          4       U+U,u. uF  w  p+p,R$V+ V, 2NK  	  up,p+4      bR%R!P9                  \q        V!V"4       U-U%u. uF  w  p-p%V)! V%4       R&V- 2NK  	  up%p-4      bR'R!P9                  \q        VV 4       U-U%u. uF  w  p-p%V)! V%4       R&V- 2NK  	  up%p-4      bR(R!P9                  V! U.u. uF  p.R)V. 2NK
  	  up.R*.,           R+.,           4      bR,\'        V!4      ^,           bR-VbR.VPZ                  Pr                  bRV P.                  bR/RP9                  VV
.4      bR0V^ ,          bR1V^,          bR2V^,          bR3RbR4VPt                  bR5V*/Cp/. p0\        \v        4      P                  R6,          V*,          p1V1Py                  R74       FŠ  p2V2Pz                  p3VP}                  R8V RV$ V3 24      p4V4P                  R94      ;_uu_ 4       p5V5P�                  V2Pƒ                  4       P„                  ! R</ V/B 4       R	R	R	4       V0Pa                  V44       KŒ  	  V&V03# u uppi u uppi u uppi u uppi u uppi u upi u uppi u uppi u up,p+i u up%p-i u up%p-i u up.i   + '       g   i     Lo; i)=r   Ú,c                 ó$   € V P                  R 4      # )Ú )Ústrip)Úss   &r   Ú<lambda>Ú compile_kernel.<locals>.<lambda>_   s   €  1§7¡7¨3¤<r   c                ó:   € V ^8„  d   QhR\         \        ,          /# )r   r   )r   r   )r   s   "r   r   Ú$compile_kernel.<locals>.__annotate__a   s   € ÷ !ñ !¤$¤s¥)ñ !r   c                 ó¶   € \         P                  ! 4       pVP                  R P                  V 4      P	                  4       4       VP                  4       R,          # )r9   :Né   N)ÚhashlibÚsha256ÚupdateÚjoinÚencodeÚ	hexdigest)r   Úms   & r   Úhash_signatureÚ&compile_kernel.<locals>.hash_signaturea   s=   € Ü�NŠNÓˆØ	�‰�—‘˜)Ó$×+Ñ+Ó-Ô.Ø�{‰{‹}˜RÕ Ð r   ÚwarpsÚxstagesc                 ó€   €  \        V 4      pV#   \         d     Mi ; i \        T 4      pT#   \         d     R # i ; i)N)r   Ú
ValueErrorÚfloat)r;   Úrets   & r   Ú	constexprÚ!compile_kernel.<locals>.constexpri   sO   € ð	Ü�a“&ˆCØˆJøÜô 	Ùð	úð	Ü˜“(ˆCØˆJøÜô 	ØÙð	ús   ‚ �œ¡. ®=¼=Ú:NrQ   ÚxÚ=z
num_warps=znum_stages=z#Only 1 and 16 are valid hints, got ztt.divisibility)ÚfnÚ
constexprsr   Úattrsr   r   )r   ÚoptionsÚglobal_scratch_sizezMAOT compiling kernels with global scratch requirements is not yet implementedzNAOT compiling kernels with profile scratch requirements is not yet implementedÚi32r	   ÚcÚdÚ_r   Útriton_kernel_nameÚbin_sizeÚbin_dataz, :NNr   :é   Nr   Ú0xr   r9   Úfull_signatureÚarg_pointersÚ&z&global_scratchz&profile_scratchÚnum_argsÚkernel_docstringÚsharedÚ	algo_infoÚgridXÚgridYÚgridZÚ_placeholderÚ	warp_sizeÚbackend_nameÚextraz	compile.*Ú.Úw)rb   é   éÿÿÿÿr   )Cr   r   r   r   r   ÚsysÚinsertr   ÚparentÚ	importlibÚutilÚspec_from_file_locationÚstemÚmodule_from_specÚloaderÚexec_moduleÚgetattrr   ÚsplitÚlenÚlistÚmapr   r   r   Ú	enumerateÚitemsÚ	arg_namesrE   ÚvaluesÚcreate_binderÚ	ASTSourcer   ÚtritonÚbackendsÚcompilerÚ	GPUTargetÚruntimeÚdriverÚactiveÚget_current_targetÚmake_backendÚparse_optionsÚcompileÚ__dict__ÚmetadataÚRuntimeErrorÚprofile_scratch_sizeÚappendÚgetÚasmÚ
binary_extÚbinasciiÚhexlifyÚmap_python_to_cpp_typeÚbackendÚzipri   ro   Ú__file__ÚglobÚsuffixÚwith_suffixÚopenÚwriteÚ	read_textr   )6r3   r   r   Úarg_pathÚspecÚmodÚkernelr   r   rI   Úmeta_sigÚsig_hashrQ   Úir;   ÚhintsÚkÚvÚ	constantsÚkeyÚvalueÚ	const_sigÚ
doc_stringÚhrX   Úsrcr   r¡   ÚkwargsrY   Úccinfor‡   Ú	arg_typesÚarg_names_not_1Úarg_types_not_1Úarg_namer¥   ÚtyÚ	func_namerœ   Úhex_Ú	ty_to_cpprp   rT   ÚyÚnameÚargÚparamsÚoutput_filesÚtemplate_dirÚtemplate_pathÚextÚoutput_fileÚfps6   &                                                     r   r0   r0   P   s¸  € Ø $§§ ˆt�}Š}°4×3CÑ3C€HØ $§§ ˆt�}Š}´4¸³>€Hô �D—I‘I‹€HÜ‡H�H‡O�O�A”s˜8Ÿ?™?Ó+Ô,Ü�>‰>×1Ñ1°(·-±-ÀÓJ€DÜ
�.‰.×
)Ñ
)¨$Ó
/€CØ‡K�K×Ñ˜CÔ Ü�S×*Ñ*Ó+€FØ�9‰9�?‰?˜3Ó€DÜˆt‹9˜Œ>Ðˆ>ô ”SÑ/°·±×1EÑ1EÀcÓ1JÓKÓL€Iõ!ð
 �t—~‘~Ð& g¨d¯o©oÐ->Ð?€HÙ˜i¨*Õ4Ó5€Hòô <EÀYÔ;OÔ\Ñ;O±4°1ÐSVÐZ[ÑS[Ô.ˆaˆU‘I˜aŸg™g c›l¨1�oÓ.Ò.Ñ;O€EÑ\Ø#Ÿk™kœmÔ=™m‘d�a˜¨qŒTˆQ�ŠT™m€EÑ=Ü?HÈÔ?SÔTÑ?S±t°q�×!Ñ! !Õ$¡i°£lÒ2Ñ?S€IÑTØ"+§/¡/Ô"3ÔEÑ"3™$˜!˜Q°q”��A’Ñ"3€IÑEØ—k‘k–m‰
ˆˆUØ�AŽ:Ø27ˆI�f×&Ñ& s¨1¥vÕ.Ó/ñ $ô CLÈIÔBVÔWÑBV¹$¸!�×!Ñ! !Õ$ a§g¡g¨c£l°1¥oÒ5ÑBV€IÑWÛˆØ$ˆ	�#‹ñ à—‘¨)×*:Ñ*:Ô*<Ó=Ñ*< Qœ#˜až&Ñ*<Ñ=Ó>€IØ)2¯©Ô):Ô;Ñ):¡  A�Q�C�q˜˜“*Ñ):€JÑ;Ø�Z §¡Ð/Ð0°KÀÇÁÐ?PÐ2QÐRÕR€Jà�\‰\Ž^ˆØ�GŽ|ÐFÐBÀ1À#ÐFÓFˆ|ñ à6;·k±k´mÔO±m©d¨a°ÀqÈBÁwÔ)ˆQÐ# RÐ(Ð)Ò)±m€EÑOØ
×ÑÔØ
×
Ñ
˜f°ÀiÐW\Ð
Ó
]€Cà�;�;ˆ;ô �_‰_×%Ñ%×/Ò/°·±×1BÑ1BÀ3Ó1GÒHÜ"ŸN™N×1Ñ1×8Ñ8×KÑKÓMð ä�o‰o×*Ñ*¨6Ó2€GØ˜4Ÿ>™>¨<¸¿¹ÐI€FØ×#Ñ# FÓ+€GÜ�^Š^˜C¨¸×8HÑ8HÔI€Fäˆv�‰Ð 5°qÓ9¸AÔ=ÜÐjÓkÐkØ‡�×+Ñ+¨aÔ/ÜÐkÓlÐlà€IØ€IØ€OØ€OÜ  ×!1Ñ!1Ö2‰ˆˆ8Ø˜9Ô$Ø×Ñ˜XÔ&Ø×Ñ˜Y xÕ0Ô1Ø×"Ñ" 8Ô,Ø×"Ñ" 9¨XÕ#6Ö7Ø�Y‰Y˜�u˜dÓ# qÖ(Ø×Ñ˜XÔ&Ø×Ñ˜UÖ#ñ 3ð €FÜ˜9×+Ñ+Ó-Ö.‰ˆˆ2Ø�9‰9�a�U˜DÓ! QÔ&Ø˜˜˜1�gÕˆFØ�9‰9�a�U˜DÓ! RÖ'Ø˜˜˜1�gÕŠFñ	 /ð
 —‘˜(¨fÐ5Ó6€IØ
�*‰*�W×'Ñ'Õ
(€CäŒx×Ò Ó$Ó% a¨Ð+€Dä—‘×%Ñ%×,Ñ,×CÑC€IØ—>‘>€LðØ�yðà˜d×.Ñ.ðð 	”C˜“Hðð 	�D—I‘I´s¸4À½9ÀdÈ4ÅjÔ7QÔRÑ7Q©t¨q°!  A 3 q c›{Ñ7QÒRÓSð	ð
 	�T—Y‘YÌ#ÈoÐ_nÔJoÔpÑJo¹h¸dÀB¡9¨R£= /°°4°&Ó 9ÑJoÒpÓqðð 	˜$Ÿ)™)ÌsÐS\Ð^gÔOhÔ$iÑOhÁ8À4È©	°"« °a¸°vÓ%>ÑOhÒ$iÓjðð 	˜Ÿ	™	¹Ó"H¹° Q s e£9¹Ñ"HÐL]ÐK^Õ"^ÐbtÐauÕ"uÓvðð 	”C˜Ó(¨1Õ,ðð 	˜Jðð 	�&—/‘/×(Ñ(ðð 	�T—^‘^ðð 	�S—X‘X˜y¨(Ð3Ó4ðð 	��a•ðð 	��a•ðð 	��a•ðð  	˜ð!ð" 	�V×%Ñ%ð#ð$ 	˜ñ%€Fð( €LÜœ“>×(Ñ(¨7Õ2°\ÕA€LØ%×*Ñ*¨;Ö7ˆØ×"Ñ"ˆØ×*Ñ*¨Q¨x¨j¸¸&¸À#ÀÐ+GÓHˆØ×Ñ˜c×"Ô" bØ�H‰H�]×,Ñ,Ó.×5Ò5Ñ?¸Ñ?Ô@÷ #à×Ñ˜KÖ(ñ 8ð �lÐ"Ð"ùós ]ùÛ=ùÛTùÛEùó Xùò >ùÛ;ùó
 Pùó` SùÛpùÛ$iùÚ"H÷$ #×"úsl   Æ3e!Ç$e!Ç=	e'Èe'È#%e-É	e3É,e3Ë5e9Ì'e?ÍfÏf
Ï
f
ÝfÞfÞ>fß/f"ä0f'æ'f7Ú__main__)rž   rB   Úimportlib.utilry   rv   Úargparser   Údataclassesr   Úpathlibr   Útypingr   r‹   Útriton.backendsr   r,   r4   r0   r   r   r   r   Ú<module>rÖ      sc   ðÛ Û Û Û 
Ý #Ý !Ý Ý ã Û ð ÷!ð !ó ð!ð€ò6õ.#ðD ˆzÔÙ†Fñ r   