
    rh                        d dl Z d dlZd dlZd dlZd dlmZ d Z ej                  e      Z	dZ
dZej                  j                  ed      Zee	j                  de d        e       Z
n-e	j                  de d        e       Z
e
j#                  e       d	Z ed
 e
D              Zer*	 e	j+                  d       ddl e	j+                  d       dZ ed e
D              Zer,es*	 e	j+                  d       ddl e	j+                  d       dZde
v Zer,es*	 e	j+                  d       ddl e	j+                  d       dZde
v Zer,es*	 e	j+                  d       ddl e	j+                  d       dZes(e	j+                  d       ddl e	j+                  d       yy# e$ r Ze	j+                  de       d	ZY dZ[dZ[ww xY w# e$ r Ze	j+                  de       d	ZY dZ[dZ[ww xY w# e$ r Ze	j+                  de       d	ZY dZ[dZ[ww xY w# e$ r Ze	j+                  de       d	ZY dZ[dZ[ww xY w)    N)Versionc                     d } ddl }t        |j                        t        d      k\  rddlm} |j                         D ch c]
  \  }}|s	| }}} |        r|j                  d       t        j                  dd      j                  d	      D ]  }|j                  |        |S t        j                         d
k(  r*t        j                  ddg      d   dk(  rdhS t!               S t        j                         dk(  rSddl}t!               }d|j"                  j$                  j&                  j(                  d   j+                  dd      v r|j                  d       d|j"                  j$                  j&                  j(                  d   j+                  dd      v r|j                  d       d|j"                  j$                  j&                  j(                  d   j+                  dd      v r|j                  d        |        r|j                  d       t        j                  dd      j                  d	      D ]  }|j                  |        |S t!               S c c}}w )a  
    Returns the set of supported CPU features, see
    https://github.com/numpy/numpy/blob/master/numpy/core/src/common/npy_cpu_features.h
    for the list of features that this set may contain per architecture.

    Example:
    >>> supported_instruction_sets()  # for x86
    {"SSE2", "AVX2", "AVX512", ...}
    >>> supported_instruction_sets()  # for PPC
    {"VSX", "VSX2", ...}
    >>> supported_instruction_sets()  # for ARM
    {"NEON", "ASIMD", ...}
    c                     t        j                         dk7  ryt        j                         dk7  rydd l} t	        | j
                        t	        d      k\  ry	 dd l} d| j                  j                  j                  j                  d   j                  dd      j                         v S # t        $ r8 t        t        d	      j!                  d       j#                  d
      dz        cY S w xY w)Naarch64FLinuxr   z2.0sveFeatures ctypes   i  @ )platformmachinesystemnumpyr   __version__numpy.distutils.cpuinfo	distutilscpuinfocpuinfogetsplitImportErrorbool
__import__CDLL	getauxval)r   s    _/var/www/html/ai-insurance-compliance-backend/venv/lib/python3.12/site-packages/faiss/loader.pyis_sve_supportedz4supported_instruction_sets.<locals>.is_sve_supported   s    *??'5$$%7	Q*EOO3377<<Q?CCJPRSYY[[[ 	Q
 
8,11$7AA"EOPP	Qs   AB) )>C*)C*r   Nz1.19)__cpu_features__SVEFAISS_DISABLE_CPU_FEATURESr
   z, 	
Darwinz/usr/sbin/sysctlzhw.optional.avx2_01AVX2r   avx2flagsavx512AVX512avx512_fp16
AVX512_SPR)r   r   r   numpy._core._multiarray_umathr    itemsaddosgetenvr   discardr   r   
subprocesscheck_outputr   setr   r   r   r   r   )r   r   r    kv	supportedfresults           r   supported_instruction_setsr;      s   "Q* u  !WV_4B $4#9#9#;A41aqQA	AMM% 7<BB:N 	!Aa 	! H$""$68L#MNrRVYY8O  5L 
	g	%&U__,,0055a8<<WbIIJJvu..2277:>>wKKJJx EOO3377<<Q?CCGRPPJJ|$JJu7<BB:N 	ANN1	5L5 Bs   
IIFAISS_OPT_LEVELzEnvironment variable zK is not set, so let's pick the instruction set according to the current CPUzUsing z as an instruction set.Fc              #   @   K   | ]  }d |j                         v   yw)r,   Nupper.0xs     r   	<genexpr>rC   h   s     I1\QWWY.I   z&Loading faiss with AVX512-SPR support.   )*z2Successfully loaded faiss with AVX512-SPR support.Tz7Could not load library with AVX512-SPR support due to:
c              #   @   K   | ]  }d |j                         v   yw)r*   Nr>   r@   s     r   rC   rC   t   s     A1QWWY&ArD   z"Loading faiss with AVX512 support.z.Successfully loaded faiss with AVX512 support.z3Could not load library with AVX512 support due to:
r&   z Loading faiss with AVX2 support.z,Successfully loaded faiss with AVX2 support.z1Could not load library with AVX2 support due to:
r!   zLoading faiss with SVE support.z+Successfully loaded faiss with SVE support.z0Could not load library with SVE support due to:
zLoading faiss.zSuccessfully loaded faiss.) r   r3   loggingr0   packaging.versionr   r;   	getLogger__name__loggerinstruction_setsopt_env_variable_nameenvironr   	opt_leveldebugr5   r/   loadedanyhas_AVX512_SPRr   swigfaiss_avx512_sprr   e
has_AVX512swigfaiss_avx512has_AVX2swigfaiss_avx2has_SVEswigfaiss_sve	swigfaiss     r   <module>r`      st      	 %FP 
		8	$  * JJNN0$7	
LL()>(? @Q Q R13
LL6)$;<=u#	I8HII<=+HI A0@AA
f89'DE %%F67%BC #
#
656$AB 
KK !
KK,-	 S  NqeTU  J1%PQ  HNO  GuMNs`   ,)F! ))G	 )G1 )H !G&GG	G.G))G.1H6HHH>H99H>