+
    ߢ2j@                        R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtHtH	t	H
t
HtHtHtHt ^RIHt ^RIHt ^RIHt R t ! R R4      tR	 R
 ltR R ltR t]! ]4      t ! R R]4      t ! R R]]4      t ! R R]]4      tR# )zDTypes and functions to manage information on CPU microarchitectures.N)IOAnyDictListOptionalSetTupleUnion)schema)FEATURE_ALIASES)LazyDictionaryc                F   a  \         P                  ! S 4      V 3R l4       pV# )z`Decorator that automatically converts a known target name to a proper
Microarchitecture object.
c                    < \        V\        4      '       d5   V\        9  d   R p\        VP	                  V4      4      h\        V,          pS! W4      # )z "{0}" is not a valid target name)
isinstancestrTARGETS
ValueErrorformat)selfothermsgfuncs   && >lib/python3.14/site-packages/archspec/cpu/microarchitecture.py_impl"coerce_target_names.<locals>._impl   sE    eS!!G#8 E!233ENED      )	functoolswraps)r   r   s   f r   coerce_target_namesr      s'    
 __T! ! Lr   c                     a  ] tR t^$t o Rt]tR*V 3R lR llt]V 3R lR l4       t	V 3R lR lt
]V 3R lR	 l4       tV 3R
 lR lt]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       t]V 3R lR l4       tV 3R lR ltV 3R lR lt]P,                  ^3V 3R lR lltV 3R lR lt]V 3R lR l4       t]V 3R  lR! l4       tV 3R" lR# lt]V 3R$ lR% l4       tV 3R& lR' ltR(tV t R)# )+Microarchitecturez!A specific CPU micro-architecturec                   < V ^8  d   QhRS[ RS[R,          RS[ RS[S[ ,          RS[S[ S[S[S[ S[ 3,          ,          3,          RS[RS[ /# )	   nameparentsr    vendorfeatures	compilers
generationcpu_part)r   r   r   r   int)r   __classdict__s   "r   __annotate__Microarchitecture.__annotate__+   sr     7& 7&7& )*7& 	7&
 c(7& T$sCx.1127& 7& 7&r   c                    Wn         W n        W0n        W@n        WPn        W`n        Wpn        RV n        RV n        RV n	        RV P                  9   d   V P                  P                  R4       R# R# )a  
Args:
    name: name of the micro-architecture (e.g. ``icelake``)
    parents: list of parent micro-architectures, if any. Parenthood is considered by
        cpu features and not chronologically. As such, each micro-architecture is
        compatible with its ancestors. For example, ``skylake``, which has ``broadwell``
        as a parent, supports running binaries optimized for ``broadwell``.
    vendor: vendor of the micro-architecture
    features: supported CPU flags. Note that the semantic of the flags in this field might
        vary among architectures, if at all present. For instance, x86_64 processors will
        list all the flags supported by a given CPU, while Arm processors will list instead
        only the flags that have been added on top of the base model for the current
        micro-architecture.
    compilers: compiler support to generate tuned code for this micro-architecture. This
        dictionary has as keys names of supported compilers, while values are a list of
        dictionaries with fields:

        * name: name of the micro-architecture according to the compiler. This is the name
            passed to the ``-march`` option or similar. Not needed if it is the same as
            ``self.name``.
        * versions: versions that support this micro-architecture.
        * flags: flags to be passed to the compiler to generate optimized code

    generation: generation of the micro-architecture, if relevant.
    cpu_part: cpu part of the architecture, if relevant.
Nssse3sse3)r#   r$   r%   r&   r'   r(   r)   
_ancestors_generic_familyadd)r   r#   r$   r%   r&   r'   r(   r)   s   &&&&&&&&r   __init__Microarchitecture.__init__+   sf    H 	 "$  @D7;6: dmm#MMf% $r   c                .   < V ^8  d   QhRS[ R,          /# r"   returnr    )r   )r   r+   s   "r   r,   r-   e   s      4 34 r   c                   a V P                   fS   V P                  R,          oV P                   F(  pSP                  V3R lVP                   4       4       K*  	  SV n         V P                   # )z,All the ancestors of this microarchitecture.:NNNc              3   8   <"   T F  qS9  g   K  Vx  K  	  R # 5iN ).0avalues   & r   	<genexpr>.Microarchitecture.ancestors.<locals>.<genexpr>j   s     K(81UNQQ(8s   
)r1   r$   extend	ancestors)r   parentr@   s   & @r   rD   Microarchitecture.ancestorsd   sS     ??"LLOE,,K(8(8KK '#DOr   c                0   < V ^8  d   QhRS[ S[,          /# r"   r9   )r   r   )r   r+   s   "r   r,   r-   n   s     C CS Cr   c           	         \        \        V 4      .V P                   Uu. uF  p\        V4      NK  	  up,           4      # u upi )z9Returns a set of the nodes in this microarchitecture DAG.)setr   rD   r   xs   & r   _to_setMicroarchitecture._to_setn   s4     CI;$..!A.Q#a&.!AABB!As   A 
c                :   < V ^8  d   QhRS[ S[R3,          RS[/# r"   r   r    r9   r	   r   bool)r   r+   s   "r   r,   r-   u   s&     
 
E#':":; 
 
r   c                   \        V\        4      '       g   \        # V P                  VP                  8H  ;'       d    V P                  VP                  8H  ;'       d    V P
                  VP
                  8H  ;'       d}    V P                  VP                  8H  ;'       d\    V P                  VP                  8H  ;'       d;    V P                  VP                  8H  ;'       d    V P                  VP                  8H  # r<   )
r   r    NotImplementedr#   r%   r&   r$   r'   r(   r)   r   r   s   &&r   __eq__Microarchitecture.__eq__t   s    %!233!! II# 0 0u||+0 0/0 0 -0 0 %//1	0 0
 5#3#330 0 /	
r   c                    < V ^8  d   QhRS[ /# rH   r*   )r   r+   s   "r   r,   r-      s      # r   c                ,    \        V P                  4      # r<   )hashr#   r   s   &r   __hash__Microarchitecture.__hash__   s    DIIr   c                :   < V ^8  d   QhRS[ S[R3,          RS[/# rP   rQ   )r   r+   s   "r   r,   r-      s&     ! !E#':":; ! !r   c                    W8X  * # r<   r=   rU   s   &&r   __ne__Microarchitecture.__ne__   s      r   c                :   < V ^8  d   QhRS[ S[R3,          RS[/# rP   rQ   )r   r+   s   "r   r,   r-      &     0 0E#':":; 0 0r   c                |    \        V\        4      '       g   \        # V P                  4       VP                  4       8  # r<   r   r    rT   rM   rU   s   &&r   __lt__Microarchitecture.__lt__   -    %!233!!||~//r   c                :   < V ^8  d   QhRS[ S[R3,          RS[/# rP   rQ   )r   r+   s   "r   r,   r-      &     1 1E#':":; 1 1r   c                "    W8H  ;'       g    W8  # r<   r=   rU   s   &&r   __le__Microarchitecture.__le__       004<0r   c                :   < V ^8  d   QhRS[ S[R3,          RS[/# rP   rQ   )r   r+   s   "r   r,   r-      rd   r   c                |    \        V\        4      '       g   \        # V P                  4       VP                  4       8  # r<   rf   rU   s   &&r   __gt__Microarchitecture.__gt__   ri   r   c                :   < V ^8  d   QhRS[ S[R3,          RS[/# rP   rQ   )r   r+   s   "r   r,   r-      rk   r   c                "    W8H  ;'       g    W8  # r<   r=   rU   s   &&r   __ge__Microarchitecture.__ge__   ro   r   c                    < V ^8  d   QhRS[ /# rH   r   )r   r+   s   "r   r,   r-      s     ; ;# ;r   c                P    V P                   P                   R V P                  : R2# )())	__class____name__r#   r\   s   &r   __repr__Microarchitecture.__repr__   s$    ..))*!DII=::r   c                    < V ^8  d   QhRS[ /# rH   ry   )r   r+   s   "r   r,   r-      s       r   c                    V P                   # r<   r#   r\   s   &r   __str__Microarchitecture.__str__   s    yyr   c                :   < V ^8  d   QhRS[ S[,          RS[RR/# )r"   fpindentr9   N)r   r   r*   )r   r+   s   "r   r,   r-      s&     & &r#w &S & &r   c                `   \        4       p^ V 3.pV'       d   VP                  4       w  rV\        RRV 2 VP                   2VR7       \	        VP
                  4       FJ  pVP                  V9   d   K  VP                  WR,           V34       VP                  VP                  4       KL  	  K  R# )zIFormat the partial order of this microarchitecture's ancestors as a tree. >)fileN)rJ   popprintr#   reversedr$   appendr4   )r   r   r   seenstacklevelcurrentrE   s   &&&     r   treeMicroarchitecture.tree   s    78$i["YY[NER%yM',,0r:"7??3;;$&enf56%	 4	 r   c                &   < V ^8  d   QhRS[ RS[/# )r"   featurer9   )r   rR   )r   r+   s   "r   r,   r-      s     ! !C !D !r   c           	         \        V\        4      '       g/   R p\        VP                  \        \	        V4      4      4      4      hWP
                  9   d   R# \        P                  P                  VR 4      pV! V 4      # )z3only objects of string types are accepted [got {0}]Tc                     R # )Fr=   rL   s   &r   <lambda>0Microarchitecture.__contains__.<locals>.<lambda>   s    ur   )	r   r   	TypeErrorr   typer&   r    feature_aliasesget)r   r   r   match_aliass   &&  r   __contains__Microarchitecture.__contains__   se    '3''GCCJJs4='9:;; mm# (77;;G_U4  r   c                   < V ^8  d   QhRR/# r8   r=   )r   r+   s   "r   r,   r-      s     	 	+ 	r   c                N   V P                   f   V .V P                  ,            Uu. uF  qP                  '       d   K  VNK  	  ppRpVRRP                  R V 4       4       R2,          p\        V4      ^8X  g   Q V4       hVP	                  4       V n         V P                   # u upi )z9Returns the architecture family a given target belongs toz>a target is expected to belong to just one architecture familyz[found , c              3   8   "   T F  p\        V4      x  K  	  R # 5ir<   ry   r>   rL   s   & r   rA   +Microarchitecture.family.<locals>.<genexpr>   s     &=u!s1vvu   ])r3   rD   joinlenr   )r   rL   rootsr   s   &   r   familyMicroarchitecture.family   s     <<!% 7K 71{{QQ 7EKRCWTYY&=u&==>a@@Cu:?'C'? 99;DL|| Ls
   B"B"c                   < V ^8  d   QhRR/# r8   r=   )r   r+   s   "r   r,   r-      s      , r   c                    V P                   fI   V .V P                  ,            Uu. uF  qP                  R8X  g   K  VNK  	  pp\        VR R7      V n         V P                   # u upi )zBReturns the best generic architecture that is compatible with selfgenericc                 ,    \        V P                  4      # r<   )r   rD   r   s   &r   r   +Microarchitecture.generic.<locals>.<lambda>   s    AKK8Hr   )key)r2   rD   r%   max)r   rL   genericss   &  r   r   Microarchitecture.generic   sY     == $(6DNN#:T#:ahh)>S#:HT.HIDM}} Us
   A#A#c                6   < V ^8  d   QhRS[ S[S[3,          /# rH   )r   r   r   )r   r+   s   "r   r,   r-      s     

 

c3h 

r   c                .   R\        V P                  4      R\        V P                  4      R\        R V P                   4       4      RV P
                  RV P                   Uu. uF  p\        V4      NK  	  upRV P                  RV P                  /# u upi )	z3Returns a dictionary representation of this object.r#   r%   r&   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir<   ry   r   s   & r   rA   ,Microarchitecture.to_dict.<locals>.<genexpr>   s     =}!s1vv}r   r(   r$   r'   cpupart)	r   r#   r%   sortedr&   r(   r$   r'   r)   rK   s   & r   to_dictMicroarchitecture.to_dict   sy     C		Nc$++&=t}}==$//51A5t}}
 	

 6s   "Bc                   < V ^8  d   QhRR/# r8   r=   )r   r+   s   "r   r,   r-      s     

 

. 

r   c                   \        V R,          V R,           Uu. uF  p\        V,          NK  	  upV R,          \        V R,          4      V P                  R/ 4      V P                  R^ 4      V P                  RR4      R	7      # u upi )
z?Construct a microarchitecture from a dictionary representation.r#   r$   r%   r&   r'   r(   r   r   )r#   r$   r%   r&   r'   r(   r)   )r    r   rJ   r   )datarL   s   & r   	from_dictMicroarchitecture.from_dict   su     !f)-i9AWQZZ9>j)*hh{B/xxa0XXi,
 	
9s   B
c                ,   < V ^8  d   QhRS[ RS[ RS[ /# )r"   compilerversionr9   ry   )r   r+   s   "r   r,   r-      s'     ]0 ]03 ]0 ]0 ]0r   c                   WP                   P                  9  d   R# WP                  9  d_   V P                   Uu. uF  q1VP                  9   g   K  VNK  	  up^ ,          pRpVP                  WVP                   4      p\	        V4      h\
        P                  ! RV4      '       g   Rp\        V4      hV P                  V,          pR pV F|  pV! W4      '       g   K  VR,          p	VP                  RV P                  4       VP                  RR	4      p
V
'       d   \        P                  ! V
4       V	P                  ! R/ VB pVu # 	  R
pV'       d5   V Uu. uF  q3R,          NK  	  ppVRRP                  V4       R2,          pM	VR,          pVP                  V P                  W4      p\	        V4      hu upi u upi )a  Returns a string containing the optimization flags that needs to be used to produce
code optimized for this micro-architecture.

The version is expected to be a string of dot-separated digits.

If there is no information on the compiler passed as an argument, the function returns an
empty string. If it is known that the compiler version we want to use does not support
this architecture, the function raises an exception.

Args:
    compiler: name of the compiler to be used
    version: version of the compiler to be used

Raises:
    UnsupportedMicroarchitecture: if the requested compiler does not support
        this micro-architecture.
    ValueError: if the version doesn't match the expected format
r   zf'{0}' compiler is known to optimize up to the '{1}' microarchitecture in the '{2}' architecture familyz^(?:\d+\.)*\d+$zXinvalid format for the compiler version argument. Only dot separated digits are allowed.c                     V R ,          P                  R4      w  r#\        V4      w  r$\        V4      w  r4\        V4      w  rR pV! V4      pV'       d   V! V4      pW!8  d   R# V'       d   V! V4      pW18  d   R# R# )versions:c                     \         ;QJ d#    . R  V P                  R4       4       F  NK  	  5# ! R  V P                  R4       4       4      # )c              3   8   "   T F  p\        V4      x  K  	  R # 5ir<   rY   )r>   ys   & r   rA   fMicroarchitecture.optimization_flags.<locals>.satisfies_constraint.<locals>.tuplify.<locals>.<genexpr>(  s     <^SVV^r   .)tuplesplit)vers   &r   tuplifySMicroarchitecture.optimization_flags.<locals>.satisfies_constraint.<locals>.tuplify'  s4    u<SYYs^<u<u<SYYs^<<<r   FT)r   version_components)entryr   min_versionmax_version_r   s   &&    r   satisfies_constraintBMicroarchitecture.optimization_flags.<locals>.satisfies_constraint  s    ',Z'8'>'>s'C$K 0<NK/<NK+G4JG= g&G%k2( %k2( r   flagsr#   warningsNzIcannot produce optimized binary for micro-architecture '{0}' with {1}@{2}r   z" [supported compiler versions are r   r   z! [no supported compiler versions]r=   )r   r'   rD   r   UnsupportedMicroarchitecturerematchInvalidCompilerVersion
setdefaultr#   r   r   warnr   )r   r   r   rL   best_targetr   compiler_infor   compiler_entry	flags_fmtwarning_messager   r   s   &&&          r   optimization_flags$Microarchitecture.optimization_flags   s   ( ;;000 >>)&*nnPnAKK8O11nPQRSKF  **XK4F4FGC.s33 xx*G449  )-- x0	2 ,N#N<<*73	 ))&$))< #1"4"4Z"F"MM/2!((:>: , Z/<=}!*}H=7		(8K7LANNC66CjjH6*3//G Q| >s   F;F;G )
r1   r3   r2   r'   r)   r&   r(   r#   r$   r%   N)    r   )!r~   
__module____qualname____firstlineno____doc__r   r   r5   propertyrD   rM   r   rV   r]   ra   rg   rm   rr   rv   r   r   sysstdoutr   r   r   r   r   staticmethodr   r   __static_attributes____classdictcell__)r+   s   @r   r    r    $   sA    + &O7& 7&r  C C 
 
  ! ! 0 0 1 1 0 0 1 1; ;  "%1 & &! ! 	 	  

 

 

 

]0 ]0r   r    c                0    V ^8  d   QhR\         R\        /# )r"   r#   r9   )r   r    )r   s   "r   r,   r,   P  s     _ _C _,= _r   c                2    \        V . R\        4       / R7      # )zuReturns a generic micro-architecture with no vendor and no features.

Args:
    name: name of the micro-architecture
r   )r$   r%   r&   r'   )r    rJ   r   s   &r   generic_microarchitecturer   P  s     T2i#%[]^^r   c                R    V ^8  d   QhR\         R\        \         \         3,          /# )r"   r   r9   )r   r   )r   s   "r   r,   r,   Y  s"     " " "c3h "r   c                    \         P                  ! R\        V 4      4      pV'       g   R# VP                  ^4      pVP                  ^4      pW#3# )zDecomposes the version passed as input in version number and
suffix and returns them.

If the version number or the suffix are not present, an empty
string is returned.

Args:
    version: version to be decomposed into its components
z([\d.]*)(-?)(.*))r   r   )r   r   r   group)r   r   version_numbersuffixs   &   r   r   r   Y  sD     HH(#g,7E[[^N[[^F!!r   c                    a V3R lo/ p \         P                  R,          pV F  pW 9   d   K  S! W!V 4       K  	  \        P                  ! 4       pV P	                  V\        V4      4       V # )zReturns a dictionary of the known micro-architectures. If the
current host platform is unknown, add it too as a generic target.
c           
     j  < W,          pVR,          pV F  pWR9   d   K  S! WQV4       K  	  V Uu. uF  qRP                  V4      NK  	  ppVR,          p\        VR,          4      pVP                  R/ 4      p	VP                  R^ 4      p
VP                  RR4      p\        WWxWVR7      W &   R	# u upi )
a>  Recursively fills targets by adding the micro-architecture
passed as argument and all its ancestors.

Args:
    name (str): micro-architecture to be added to targets.
    data (dict): raw data loaded from JSON.
    targets (dict): dictionary that maps micro-architecture names
        to ``Microarchitecture`` objects
fromr%   r&   r'   r(   r   r   )r(   r)   N)r   rJ   r    )r#   r   targetsvaluesparent_namesrE   r$   r%   r&   r'   r(   r)   fill_target_from_dicts   &&&         r   r  8_known_microarchitectures.<locals>.fill_target_from_dictr  s      f~"F !&8	 #
 6BB\6;;v&\B!vj)*JJ{B/	ZZa0
::i,)6YX`
 Cs   B0microarchitectures)r
   TARGETS_JSONplatformmachiner   r   )known_targetsr   r#   host_platformr  s       @r   _known_microarchitecturesr  m  si    

> M34D d-8	  $$&M],Em,TUr   c                       ] tR tRtRtRtR# )ArchspecErrori  z%Base class for errors within archspecr=   Nr~   r   r   r   r   r   r=   r   r   r  r    s    /r   r  c                       ] tR tRtRtRtR# )r   i  z[Raised if a compiler version does not support optimization for a given
micro-architecture.
r=   Nr  r=   r   r   r   r     s    r   r   c                       ] tR tRtRtRtR# )r   i  zHRaised when an invalid format is used for compiler versions in archspec.r=   Nr  r=   r   r   r   r     s    Rr   r   )r   r   r  r   r   r   typingr   r   r   r   r   r   r   r	   r   r
   aliasr   r   r   r    r   r   r  r   	Exceptionr  r   r   r   r=   r   r   <module>r     s   
 K   	 
  C C C  " "$i0 i0X	_"(0h 2
30I 0=* S]J Sr   