+
    "Ý³j2  ã                   ó  € R t ^ RIHtHt ^ RIHt ^ RIHt ^ RIH	t	 ]! RR7       ! R R4      4       t
]! RR7       ! R	 R
4      4       t ! R R]	4      t]! RR7       ! R R4      4       t ! R R4      t ! R R]	4      t ! R R4      tR# )aS  Synchronous execution-boundary extensions, independent of persistence.

Boundary objects are borrowed for the duration of on_boundary only. An
extension must quiesce before treating results as complete. Retaining a
boundary or using it from a worker thread is an error. No tensor serialization
or checkpoint format belongs in this module.
)ÚFutureÚwait)Ú	dataclass)Ú	get_ident)ÚProtocolT)Úfrozenc                   ó0   a € ] tR t^t o RtV 3R ltRtV tR# )ÚLoopStepz?An execution identity, separate from transformer-layer indices.c                ó>   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[ ;R&   # )é   ÚkindÚindexÚname)ÚstrÚint)ÚformatÚ__classdict__s   "€Ú[/home/luca/screen-checking/.venv/lib/python3.14/site-packages/gptqmodel/looper/extension.pyÚ__annotate__ÚLoopStep.__annotate__   s)   ø‡ ‚ ñ �Iñ	 ñ
 �Jñ ñ �Iò ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r   s   @r   r	   r	      s   ø‡ € áI÷ ƒ r   r	   c                   ó8   a € ] tR t^t o R tR tV 3R ltRtV tR# )ÚLoopPlanc                óÂ   € \        V P                  4      \        Jg7   \        \	        V P                  4      4      \        V P                  4      8w  d   \        R 4      hR# )z=execution plan requires an immutable sequence of unique stepsN)ÚtypeÚstepsÚtupleÚlenÚsetÚ
ValueError©Úselfs   &r   Ú__post_init__ÚLoopPlan.__post_init__   sE   € Ü�—
‘
Ó¤5Ó(¬C´°D·J±J³Ó,@ÄCÈÏ
É
ÃOÔ,SÜØOóð ñ -Tr   c                óF   € V P                   P                  V4      ^,           # )é   )r%   r   )r+   Ústeps   &&r   ÚafterÚLoopPlan.after#   s   € Ø�z‰z×Ñ Ó%¨Õ)Ð)r   c                ó:   <€ V ^8„  d   Qh/ S[ S[R3,          ;R&   # )r   .r%   )r&   r	   )r   r   s   "€r   r   ÚLoopPlan.__annotate__   s   ø‡ ‚ á‘˜3�ÕÑò r   r   N)	r   r   r   r   r,   r1   r   r   r   r    s   @r   r"   r"      s   ø‡ € òò*÷ ƒ r   r"   c                   óZ   a € ] tR t^'t o RtV 3R lR ltV 3R lR ltV 3R lR ltRtV t	R	# )
ÚLoopExecutionzBPlacement identity and scheduler continuation owned by the looper.c                óF   <€ V ^8„  d   QhRS[ S[S[S[,          3,          /# ©r   Úreturn)Údictr   Úlist)r   r   s   "€r   r   ÚLoopExecution.__annotate__*   s   ø€ ×AÑA©©S±$±sµ)¨^Õ(<ÑAr   c                ó   € R # ©Nr   r*   s   &r   Úexecution_device_poolsÚ$LoopExecution.execution_device_pools*   ó   € ¹cr   c                ó    <€ V ^8„  d   QhRS[ /# r8   ©r:   )r   r   s   "€r   r   r<   ,   s   ø€ ×/Ñ/¡dÑ/r   c                ó   € R # r>   r   r*   s   &r   Úexecution_state_dictÚ"LoopExecution.execution_state_dict,   s   € ©Cr   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Ústater9   NrC   )r   r   s   "€r   r   r<   .   s   ø€ ×AÑA©tÐA¸ÑAr   c                ó   € R # r>   r   )r+   rH   s   &&r   Úload_execution_state_dictÚ'LoopExecution.load_execution_state_dict.   rA   r   r   N)
r   r   r   r   r   r?   rE   rJ   r   r   r    s   @r   r6   r6   '   s   ø‡ € ÙLçAÐAç/Ð/çAÖAr   r6   c                   ó0   a € ] tR t^1t o RtV 3R ltRtV tR# )ÚLoopContextNc                ód   <€ V ^8„  d   Qh/ S[ ;R&   S[;R&   S[;R&   S[;R&   S[R,          ;R&   # )r   ÚplanÚmodelÚ
processorsÚshared_stateNÚ	execution)r"   Úobjectr&   r:   r6   )r   r   s   "€r   r   ÚLoopContext.__annotate__1   sG   ø‡ ‚ á
�Nñ ñ �Mñ ñ Ññ	 ñ
 Ññ ñ ˜tÕ#Ñ*ò r   r   )r   r   r   r   rS   r   r   r   r    s   @r   rM   rM   1   s   ø‡ € ð '+€I÷ ƒ r   rM   c                   óD   a € ] tR t^:t o V 3R lR ltV 3R lR ltRtV tR# )ÚLoopBoundaryc                ó:   <€ V ^8„  d   QhRS[ RS[S[R3,          /# )r   r0   Úfutures.)r	   r&   r   )r   r   s   "€r   r   ÚLoopBoundary.__annotate__;   s$   ø€ ÷ ñ ™Xð ±±f¸c°kÕ0Bñ r   c                óJ   € Wn         W n        \        4       V n        R V n        R# )TN)r0   Ú_futuresr   Ú_ownerÚ_active)r+   r0   rY   s   &&&r   Ú__init__ÚLoopBoundary.__init__;   s   € ØŒ	ØŒÜ“kˆŒØˆŽr   c                ó4   <€ V ^8„  d   QhRS[ S[R3,          /# )r   r9   .)r&   rT   )r   r   s   "€r   r   rZ   A   s    ø€ ÷ Bñ B™™v s˜{Õ+ñ Br   c                óR  € \        4       V P                  8w  d   \        R4      hV P                  '       g   \        R4      hV P                  '       d   \        V P                  4       \        ;QJ d    . R V P                   4       F  NK  	  5# ! R V P                   4       4      # )z½Drain all preceding finalizers, then return results or raise.

Waiting for every future before raising prevents one failed worker
from leaving other workers mutating state during recovery.
z2Loop boundaries belong to the orchestration threadz!Loop boundary is no longer activec              3   ó@   "  € T F  qP                  4       x € K  	  R # 5ir>   )Úresult)Ú.0Úfutures   & r   Ú	<genexpr>Ú'LoopBoundary.quiesce.<locals>.<genexpr>M   s   é € ÐA±=¨—]‘]—_�_³=ùs   ‚)r   r]   ÚRuntimeErrorr^   r\   r   r&   r*   s   &r   ÚquiesceÚLoopBoundary.quiesceA   sr   € ô ‹;˜$Ÿ+™+Ô%ÜÐSÓTÐTØ�|�|ˆ|ÜÐBÓCÐCØ�=�=ˆ=Ü�—‘ÔßŒuÑA°4·=²=ÓA�uÐAˆuÑA°4·=²=ÓAÓAÐAr   )r^   r\   r]   r0   N)r   r   r   r   r_   rj   r   r   r    s   @r   rW   rW   :   s   ø‡ € ÷ð ÷Bö Br   rW   c                   ó2   a € ] tR t^Pt o V 3R lR ltRtV tR# )ÚLoopExtensionc                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Úboundaryr9   N)rW   )r   r   s   "€r   r   ÚLoopExtension.__annotate__Q   s   ø€ ÷ ñ ¡Lð °Tñ r   c                ó   € R# )zBObserve a step before the next step can mutate continuation state.Nr   )r+   ro   s   &&r   Úon_boundaryÚLoopExtension.on_boundaryQ   s   € ár   r   N)r   r   r   r   rr   r   r   r    s   @r   rm   rm   P   s   ø‡ € ÷ö r   rm   c                   ó\   a € ] tR t^Vt o RtR
R ltR tV 3R lR ltR
V 3R lR lltRt	V t
R	# )ÚLoopExtensionszFOwn extension dispatch and outstanding work on the coordinator thread.c                ó4   € \        V4      V n        . V n        R # r>   )r&   Ú_extensionsÚ_pending)r+   Ú
extensionss   &&r   r_   ÚLoopExtensions.__init__Y   s   € Ü  Ó,ˆÔØ&(ˆŽr   c                ó,   € \        V P                  4      # r>   )Úboolrw   r*   s   &r   Ú__bool__ÚLoopExtensions.__bool__]   s   € Ü�D×$Ñ$Ó%Ð%r   c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   Úcontextr9   )rM   r   )r   r   s   "€r   r   ÚLoopExtensions.__annotate__`   s   ø€ ÷ ,ñ ,™[ð ,©Sñ ,r   c                ó–  € . pV P                    F�  p\        VRR4      pVf   K  V! V4      pVf   K$  \        V4      \        Jg/   ^ Tu;8:  d%   \	        VP
                  P                  4      8:  g   M \        R4      hVP                  V4       Kƒ  	  \	        \        V4      4      ^8”  d   \        R4      hV'       d
   V^ ,          # ^ # )zALet extensions install continuation before any planned step runs.Úon_startNz.extension returned an invalid execution cursorz1extensions returned conflicting execution cursors)
rw   Úgetattrr$   r   r'   rO   r%   r)   Úappendr(   )r+   r€   ÚcursorsÚ	extensionÚcallbackÚcursors   &&    r   ÚstartÚLoopExtensions.start`   sº   € àˆØ×)Ô)ˆIÜ˜y¨*°dÓ;ˆHØÔ#Ù! 'Ó*�ØÔ%Ü˜F“|¬3Ó.°a¸6ö 7ÄSØŸ™×*Ñ*óFö 7ô )ØLóð ð —N‘N 6Ö*ñ *ô Œs�7‹|Ó˜qÔ ÜÐPÓQÐQß$ˆw�q�zÐ+¨!Ð+r   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   r0   r9   N)r	   )r   r   s   "€r   r   r�   s   s   ø€ ÷ 
ñ 
™Hð 
°Tñ 
r   c                óÊ  € V '       g   R # V P                   P                  V4       \        V\        V P                   4      4      p V P                   F  pVP                  V4       K  	  RVn        V P                    Uu. uFE  pVP                  4       '       d+   VP                  4       '       g   VP                  4       f   KC  VNKG  	  upV n         R #   RTn        i ; iu upi )NF)
rx   ÚextendrW   r&   rw   rr   r^   ÚdoneÚ	cancelledÚ	exception)r+   r0   rY   ro   r‡   rf   s   &&&   r   ÚpublishÚLoopExtensions.publishs   s·   € ßÙØ�‰×Ñ˜WÔ%Ü ¤e¨D¯M©MÓ&:Ó;ˆð	%Ø!×-Ô-�	Ø×%Ñ% hÖ/ñ .ð  %ˆHÔð
 Ÿ-š-ó
á'�Ø—;‘;—=’= F×$4Ñ$4×$6Ò$6¸&×:JÑ:JÓ:L÷ ˆFÙ'ñ
ˆŽøð  %ˆHÕüò
s$   Á$C Á?C ÂC Â0C ÃC Ã	C)rw   rx   N)r   )r   r   r   r   r   r_   r}   rŠ   r’   r   r   r    s   @r   ru   ru   V   s+   ø‡ € ÙPô)ò&÷,ð ,÷&
÷ 
ð 
r   ru   N)r   Úconcurrent.futuresr   r   Údataclassesr   Ú	threadingr   Útypingr   r	   r"   r6   rM   rW   rm   ru   r   r   r   Ú<module>r˜      s¢   ðñ÷ ,Ý !Ý Ý ñ �$Ô÷ð ó ðñ �$Ô÷
*ð 
*ó ð
*ôB�Hô Bñ �$Ô÷+ð +ó ð+÷Bñ Bô,�Hô ÷-
ó -
r   