
    uki#
                        d Z ddlZddlmZ ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ  ej                  e       d	 Zd
efdZdej"                  dej$                  fdZ ej(                   ej*                  dee             y)z$Source mapping generator for Jaxprs.    N)Any)config)core)source_info_util)	sourcemap)commonc                 :    ~  t        j                  |      |i |S )N)jax
make_jaxpr)work_dirff_argsf_kwargs_s        _/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/jax/experimental/source_mapper/jaxpr.pycompile_jaxprr      s     		F	/h	//    	file_namec                 l    t         j                  j                  }|rt        j                  |d|       } | S )N )r   &hlo_source_file_canonicalization_regexvalueresub)r   patterns     r   canonicalize_filenamer   !   s.    99??'wI.I	r   jaxprreturnc                    g }| j                  |      }g }t        j                         }|D ]  }|j                          |D ]s  }|\  }}	}
~	t	        |
j
                        }||vr|j                  |       |j                  |      }|
j                  dz
  }|
j                  }|j                  ||||       u  |j                          t        j                  d|g |j                         g       }t        j                  ||d      S )N)
source_map      )versionsourcessources_contentmappingsnamesr   )r    generated_code	pass_name)pretty_printr   MappingsGenerator	new_groupr   r   appendindex
start_linestart_columnnew_segment	SourceMapr&   r   SourceMapDump)r   r   pprint_mappings
pprint_strused_source_filesr&   pprint_map_linepprint_segment	start_colend_colframer   file_idxsrc_linesrc_colr    s                   r   make_jaxpr_dumpr?   (   s%   68/!!_!=*((*(( Co) C"0i%
'8i	+	+  +"((3h!!A%h""g 9h'BCC ""  "* 
		
 r   )name
compile_fngenerate_dump)__doc__r   typingr   r
   jax._srcr   r   r   r   jax.experimental.source_mapperr   register_exclusion__file__r   strr   Jaxprr3   r?   register_passPass r   r   <module>rN      s    + 	  
   %  1 #  # #H -0
S 4:: v/C/C D   FKK %r   