
    iD	                     (    S SK r S SKrS SKrS rS rg)    Nc                     SSK n Sn[        R                  R                  U R                  5      n[        R                  R                  X!5      n[        R                  R                  U5      (       a  U$ [        R                  R                  U5      n[        R                  R                  USSSU5      n[        R                  " U5      nU(       a  US   $ [        R                  R                  [        R                  R                  [        R                  R                  [        5      SU5      5      n[        R                  R                  U5      (       a  U$ g)a  Get the path to the MPS ops library.

Searches in the following locations:
1. The torchao package directory (for pip-installed packages)
2. The build directory (for development installs from source)
3. The cmake-out directory relative to this file (for standalone CMake builds)
r   Nzlibtorchao_ops_mps_aten.dylibbuildzlib.*torchaozcmake-out/lib/)	r   ospathdirname__file__joinexistsglobabspath)r   libnametorchao_dirpip_libpath	repo_rootbuild_patternbuild_matchescmake_libpaths           a/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/torchao/experimental/ops/mps/utils.py_get_torchao_mps_lib_pathr      s     -G ''//'"2"23K'',,{4K	ww~~k"" ,IGGLLGWiQMIIm,MQ GGOO
RWW__X.0@'JM 
ww~~m$$    c                  j    [        SS5       HS  n [        [        R                  R                  SU  S35        [        [        R                  R                  SU  S35        MU     g! [
         a    [        5       nUc  [        S5      e [        R                  R                  U5        O#! [         a  n[        S	U S
U 35      eSnAff = f[        SS5       HS  n [        [        R                  R                  SU  S35        [        [        R                  R                  SU  S35        MU      gf = f)zLoad the MPS ops library.      _linear_fp_act_
bit_weight_pack_weight_bitNz`Could not find libtorchao_ops_mps_aten.dylib. Please build with TORCHAO_BUILD_EXPERIMENTAL_MPS=1zFailed to load library z: )
rangegetattrtorchopsr   AttributeErrorr   RuntimeErrorload_library	Exception)nbitlibpathes      r   _load_torchao_mps_libr*   1   s   B!QKDEII%%j'IJEII%%tfC'@A    B+-?E 	III""7+ 	I!8	A3GHH	I !QKDEII%%j'IJEII%%tfC'@A  Bs7   A#A& &"D2	B)(D2)
C	3CC		A&D21D2)r   r   r!   r   r*    r   r   <module>r,      s     	 !HBr   