+
    –°³j]  ã                  ó  a € 0 t $ R t^ RIHt ^ RIt^ RIHt ^ RIHtH	t	H
t
 ]'       d   ^ RIt. ROtRRR	R
RR/tR]R&   RRRRRR/tR]R&   ]P                   R R l4       t]P                   R R l4       tR R ltRtR R ltR R ltR# ) z&Stream utilities for Inductor codegen.)ÚannotationsN)ÚTYPE_CHECKING)ÚDEFAULT_STREAMÚDEFAULT_STREAM_IDXÚSTREAM_NAME_TEMPLATEÚAOTI_SUPPORTED_STREAM_OP_NAMESÚ"AOTI_UNSUPPORTED_STREAM_OP_REASONSz&torch.ops.streams.record_event.defaultÚrecord_eventz$torch.ops.streams.wait_event.defaultÚ
wait_eventz+torch.ops.streams.synchronize_event.defaultÚsynchronize_eventzdict[str, str]z,torch.ops.streams.synchronize_stream.defaultz~Host-blocking sync ops are not supported inside an AOTI Run(). Use record_event + wait_event for device-side ordering instead.z,torch.ops.streams.synchronize_device.defaultzKHost-blocking device synchronization is not supported inside an AOTI Run().z%torch.ops.streams.wait_stream.defaultz‡wait_stream is not supported in AOTI cpp_wrapper. Use explicit record_event on the waited-on stream + wait_event on the waiting stream.c               ó    € V ^8„  d   QhRRRR/# )é   Ú
stream_idxÚintÚreturnÚstr© )Úformats   "Ú]/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/_inductor/stream_utils.pyÚ__annotate__r   8   s   € ÷ 
Bñ 
B ð 
B¨ñ 
Bó    c                óJ   € V ^ 8X  d   \         # \        P                  ! V R7      # )z¬Generate CUDA Stream name from stream index number.

Args:
    stream_idx: Non-negative index number. 0 refers to the default stream, others refer to side
        streams.
©r   )r   r   r   r   s   &r   Úget_stream_namer   7   s"   € ð �Q„ÜÐä#×*Ò*°jÔAÐAr   c               ó    € V ^8„  d   QhRRRR/# ©r   Ú
device_idxr   r   r   r   )r   s   "r   r   r   F   s   € ÷ %ñ %¨Cð %°Cñ %r   c                ó   € R V  2# )Ú
raw_streamr   )r   s   &r   Ú_raw_stream_name_for_devicer   E   s   € à˜
�|Ð$Ð$r   c               ó    € V ^8„  d   QhRRRR/# r   r   )r   s   "r   r   r   J   s   € ÷ 3ñ 3 Cð 3¨Cñ 3r   c                óB   € ^ RI Hp V! 4       '       d   R# \        V 4      # )zCGenerate variable name for a raw stream handle on the given device.©Ú_coor_enabledr   )Ú"torch.fx.experimental.proxy_tensorr#   r   )r   r#   s   & r   Úget_raw_stream_namer%   J   s   € õ Aá‡‚ÙÜ& zÓ2Ð2r   Ú_coor_device_idxc               ó    € V ^8„  d   QhRRRR/# )r   Údeviceztorch.device | Noner   r   r   )r   s   "r   r   r   Z   s   € ÷ 
ñ 
Ð/ð 
°Cñ 
r   c                ó^   € ^ RI Hp V! 4       '       d   V e   V P                  # \        V 4      # )zòDevice string to emit into generated code (benchmark and autotune harnesses).

Under compile-on-one-rank drop the index (``cuda:0`` -> ``cuda``) so the emitted text
is rank-identical and its tensors land on the running rank's current device.
r"   )r$   r#   Útyper   )r(   r#   s   & r   Úcoor_device_strr+   Z   s(   € õ Aá‡‚˜6Ò-Ø�{‰{ÐÜˆv‹;Ðr   c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r   ztuple[str | None, int | str]r   )r   s   "r   r   r   g   s   € ÷ Bñ B¨#ð BÐ2Nñ Br   c                ó¦   € ^ RI Hp V! 4       '       g   RV 3# ^ RIHp VP                  P
                  P                  4       p\         RV 2\        3# )aÖ  (preamble line, index token) for a Triton kernel's benchmark harness.

The harness is emitted into the kernel's own source, which is what the kernel hash
covers, so under compile-on-one-rank it must resolve the device at run time rather
than bake a rank-specific index -- otherwise kernels are not rank-identical whenever
``config.benchmark_kernel`` is on. The preamble line (when not None) must be emitted
inside the harness function before the returned token is used.
r"   N)ÚVz = )r$   r#   Útorch._inductor.virtualizedr.   ÚgraphÚ
device_opsÚcurrent_device_idx_exprÚCOOR_DEVICE_IDX_VAR)r   r#   r.   Úexprs   &   r   Úcoor_benchmark_device_idxr5   g   sM   € õ Aá�?Š?Ø�ZÐÐå-à�7‰7×Ñ×5Ñ5Ó7€DÜ!Ð" # d VÐ,Ô.AÐAÐAr   )r   r   r   r   r   r%   r   )Ú__conditional_annotations__Ú__doc__Ú
__future__r   Ú	functoolsÚtypingr   Ú torch._inductor.stream_constantsr   r   r   ÚtorchÚ__all__r   Ú__annotations__r   Ú	lru_cacher   r   r%   r3   r+   r5   )r6   s   @r   Ú<module>r@      sÇ   øðÜ ,å "ã Ý  ÷ñ ÷ Ûò€ð -¨nØ*¨Lð 2Ð3Fð2Ð  ó ð 3ð	Jð 3ØUà+ð	Sð6Ð " Nó ð ×Ñô
Bó ð
Bð ×Ñô%ó ð%õ3ð )Ð õ
÷Br   