+
    öäûjg  ã                   ó    € R t ^ RIt]P                  P                  '       d   ^RIHt ^RIHt M^RIH	t ^RI
Ht R
R R llt ! R R	4      tR# )zHPaged CK integer attention over a growing, fixed-capacity decode prefix.N)Úhip)Ú_dl)Úcuda)Ú_wrap_for_dlpackc                óR   € V ^8„  d   QhR\         P                  R,          R\        /# )é   ÚdeviceNÚreturn)Útorchr   Úbool)Úformats   "ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\comfy_kitchen\int8_decode.pyÚ__annotate__r      s#   € ÷ ñ œŸ™¨Õ,ð ¼ñ ó    c                óâ  € V e   V P                   R8w  d   R# \        P                  P                  4       '       g   R# \        P
                  ;'       dœ    \        \        P                  R4      ;'       dz    \        \        P                  R4      ;'       dX    \        P                  P                  '       d   \        P                  ! 4       # \        P                  P                  V 4      R8¬  # )zBReturn whether the native growing INT8 cache supports this device.r   FÚ_int8_decode_updateÚ_int8_decode)é   é    )Útyper
   r   Úis_availableÚbackendÚ_EXT_AVAILABLEÚhasattrÚ_CÚversionr   Úhas_wmmaÚget_device_capability)r   s   &r   r   r      s¹   € àÒ˜fŸk™k¨VÔ3ÙÜ�:‰:×"Ñ"×$Ò$Ùä×Ñ÷ 	nð 	nÜ”G—J‘JÐ 5Ó6÷	nð 	nä”G—J‘J Ó/÷	nð 	nô $)§=¡=×#4×#4Ð#4ŒW×ÒÓð	ô ;@¿*¹*×:ZÑ:ZÐ[aÓ:bÐflÑ:lð	r   c                   ó6   a € ] tR t^t o R tRR ltR tRtV tR# )ÚInt8DecodeCachec                óÊ  € R pW5,           ^,
          V,          p\         P                  ! WW%R3\         P                  VR7      V n        \         P                  ! WVRV3\         P                  VR7      V n        \         P                  ! WW%^@,          ^,          3\         P                  VR7      V n        \         P                  ! WVR3\         P                  VR7      V n        R# )i   é   ©Údtyper   N)	r
   ÚzerosÚint8ÚkeyÚemptyÚvalueÚfloat32Ú	key_scaleÚvalue_scale)ÚselfÚbatchÚheadsÚcapacityr   Ú	page_sizeÚpagess   &&&&&  r   Ú__init__ÚInt8DecodeCache.__init__   s¦   € Øˆ	ØÕ%¨Õ)¨iÕ7ˆÜ—;’; ¨eÀÐDÌEÏJÉJÐ_eÔfˆŒÜ—[’[ %°°s¸IÐ!FÌeÏjÉjÐagÔhˆŒ
ÜŸš e°EÈ½?ÈQÕ;NÐ%OÔW\×WdÑWdÐmsÔtˆŒÜ Ÿ;š;¨°e¸SÐ'AÌÏÉÐ_eÔfˆÖr   c                ó*  € \         P                  P                  ! . \        \        WV P
                  V P                  V P                  V P                  V34      OVN\        P                  P                  VP                  4      P                  N5!   R# )aË  Refresh the last two pages, or initialize the prefix. length is one CUDA int64.

All batches share the length. After initialization the committed length may
advance by at most one page per call. BF16 sources are [B,H,rows,256].
Initialization reads the full prefix. Updates can instead read a page-aligned
circular source: absolute row i lives at i % rows. The caller must retain both
pages being refreshed, including through speculative writes and rollback.
N)r   r   r   ÚmapÚwrap_for_dlpackr&   r(   r*   r+   r
   r   Úcurrent_streamr   Úcuda_stream)r,   r&   r(   ÚlengthÚ
initializes   &&&&&r   ÚupdateÚInt8DecodeCache.update#   ss   € ô 	�
‰
×&Ò&ð 	KÜ” 3¨t¯x©x¸¿¹ÀTÇ^Á^ÐUY×UeÑUeÐgmÐ"nÓoð	Kàð	KäŸ
™
×1Ñ1°#·*±*Ó=×IÑIö	Kr   c                óÒ  € VP                   w  r4rVV P                  P                   ^,          pWG,          V,          pVP                  W7W†4      P                  4       p	\        P
                  ! V	\        P                  R7      p
\        P                  ! W7^@3\        P                  V	P                  R7      pV P                  P                   ^,          \        P                  P                  '       d   ^M^,          p\        P                  ! W<WxV3V	P                  V	P                  R7      p\        P                  ! VP                   RR \        P                  V	P                  R7      p\        P                  ! W5WF,          3V	P                  V	P                  R7      p\        P                  ! W4V3\        P                  V	P                  R7      p\        P                  P                  ! . \!        \"        WšW°P                  V P$                  V P&                  V P(                  W-WïV34      OVN\        P*                  P-                  V	P                  4      P.                  N5!   VV3# )zÞBF16 query [B,H,S,256]; return [B,S,H*256] and natural-log LSE [B,H,S].

Every query attends the same committed prefix. The caller merges the current
causal/tree rows separately, preserving speculative rollback semantics.
)r#   r"   Néÿÿÿÿ)Úshaper&   ÚreshapeÚ
contiguousr
   Ú
empty_liker%   r'   r)   r   r   r   r#   r   r   r   r5   r6   r(   r*   r+   r   r7   r8   )r,   Úqueryr9   r-   r.   ÚseqÚdimÚkv_headsÚrowsÚqÚqiÚqsÚsplitsÚpartialÚlseÚoutÚout_lses   &&&              r   ÚattendÚInt8DecodeCache.attend0   s¹  € ð "'§¡Ñˆ�cØ—8‘8—>‘> !Õ$ˆØÕ  3Õ&ˆØ�M‰M˜%¨4Ó5×@Ñ@ÓBˆÜ×Ò˜a¤u§z¡zÔ2ˆÜ�[Š[˜%¨2Ð.´e·m±mÈAÏHÉHÔUˆØ—‘—‘ Õ"¬5¯=©=×+<×+<Ð+<¡aÀ!ÕDˆÜ—+’+˜u¨h¸cÐBÈ!Ï'É'ÐZ[×ZbÑZbÔcˆÜ�kŠk˜'Ÿ-™-¨¨Ð,´E·M±MÈ!Ï(É(ÔSˆÜ�kŠk˜5 u¥{Ð3¸1¿7¹7È1Ï8É8ÔTˆÜ—+’+˜u¨SÐ1¼¿¹ÈqÏxÉxÔXˆÜ�
‰
×Òð 	BÜ” 1¨"¯h©h¸¿
¹
ÀDÇNÁNÐTX×TdÑTdØ'-¸À'ð#Kó Lð	Bð ð	Bô —‘×*Ñ*¨1¯8©8Ó4×@Ñ@ô	Bð �Gˆ|Ðr   )r&   r*   r(   r+   N)F)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r2   r;   rP   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r      s   ø‡ € ògôK÷ð r   r   )N)Ú__doc__r
   r   r   Úbackendsr   Úbackends.hipr   r6   r   Úbackends.cudar   r   r   © r   r   Ú<module>r^      s6   ðÙ NÛ à‡=�=××ÐÝ(Þ4å)ÝB÷÷+ó +r   