L i UddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlZddlZej"eZddlZddlZddlmZddlmZddlmZmZddlmZddlm Z m!Z!dd l"m#Z#e jHd k(Z%e jHjMd Z'e jHjMd Z(e%rd ndZ)e%rdndZ*e%rdndZ+e%rdndZ,e%rdndZ-ej\j_e0Z1ej\jeej\jee1Z3ej\jie3dZ5e%rdndZ6dZ7dZ8e9e9e:dfe9e:dffZ;ee7dfe7dfe7dfe7dfdddddZ?e>e@d<dZAeAdfeAd feAd feAd!feAd!feAd"feAd"fd#ZBe>e@d$<gd%ZCd&eeDe=d'eDe=fd(ZEd'ee=fd)ZFd'ee=fd*ZGd'ee=fd+ZHd'e=fd,ZId'e=fd-ZJd.ZKd/ZLd0ZMd1ZNd2ZOejjrejjreGndZTeTreId3ndZUeTejjd4nd5ZVdZWejj5e9d6ejjjd7dd8DZWejjrejjreFndZYejjd9xsejjd:Z\ejjreHndZ^ejd;Z`gd<Zagd=Zbgd>Zcgd?Zde%sedjd@gdAZfe%r"efjdBefjdCd'e=fdDZgdEZhdFZidGZjdHgZkgekdIdJZleZmdKdLdMZndNZodOZpd'eqfdPZrd'eDe=fdQZsdRZtd'e=fdSZudTe=d'eqfdUZvd'e9eqe ffdVZwdWe=dXe d'dfdYZxdZZyd[Zzd\Z{Gd]d^e#Z|d_Z}d`Z~daZddbe=d'eDe=fdcZddbe=d'eDe=fddZ ddeee=eDe=fdfeeqdgeeqfdhZedid'eDe=fdjZdkZ ddlZdmZ ddnZ ddoe=dpeqdfeeqdgeeqd'df dqZdrZdeeDe=doe=dpeqdfeeqdgeeqd'df dsZ ddeeDe=doe=dpeqdfeeqdgeeqdteqd'dfduZdvZdwZdxZddyeeDe=d'eDe=fdzZddyeeDe=d'eDe=fd{Zd|e=dpeqd'e=fd}Zdpeqd'ee:fd~Zde=d'e##*auAJ# - >> >scHtjjdxstjjd}|tjd}|=tj j tj j |}nUtr,tjd}t|dk(rd}n|d}nd}tj j|sd}|r4tjjstjd ||S) zFind the CUDA install path. CUDA_HOME CUDA_PATHNnvccz7C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v*.*rrz/usr/local/cudaz.No CUDA runtime is found, using CUDA_HOME='%s')osenvirongetshutilwhichpathdirname IS_WINDOWSgloblenexiststorchcuda is_availableloggerwarning) cuda_home nvcc_path cuda_homess r?_find_cuda_homerX^s {+Jrzz~~k/JILL(   (BCI!YYMO z?a' "I *1 I- 77>>), 002GS ctjjdxstjjd}|tjd}|tj j tj j tj j|}tj j|dk(rCtj j |}n#d}tj j|r|}|r0tjjtjd||S)zFind the ROCm install path. ROCM_HOME ROCM_PATHhipcchipz /opt/rocmz.No ROCm runtime is found, using ROCM_HOME='%s')rErFrGrHrIrJrKrealpathbasenamerOrPversionr^rSrT) rocm_home hipcc_path fallback_paths r?_find_rocm_homerexs {+Jrzz~~k/JI\\'*  !  ,)./Iww *e3GGOOI6 (Mww~~m,) U]]&&.GS rYcxd}tjd}|[tjj tjj tjj |}|S t jjdxsg}|D]b}|jdk(stjj t|jjj}|S |S#t jj$rtj!dY|SwxYw)Nicpxz intel-sycl-rtz libsycl.sozMTrying to find SYCL_HOME from intel-sycl-rt package, but it is not installed.)rHrIrErJrKr_ importlibmetadatafilesnamerlocateparentresolvePackageNotFoundErrorrSrT) sycl_home icpx_pathrjfs r?_find_sycl_homerssI V$IGGOOBGGOO GG  Y '%)*   l&&,,_=CE 66\) "QXXZ0@0G0G0O0O0Q RI    !!66 l NNj k  ls67D.AD?D2D98D9clt tdtjjtg|S)z Join paths with ROCM_HOME, or raises an error if it ROCM_HOME is not set. This is basically a lazy way of raising an error for missing $ROCM_HOME only once we need to get any ROCm-specific path. zSROCM_HOME environment variable is not set. Please set it to your ROCm install root.)r[OSErrorrErJjoinpathss r?_join_rocm_homery7AB B 77<< *E **rYclt tdtjjtg|S)z Join paths with SYCL_HOME, or raises an error if it SYCL_HOME is not found. This is basically a lazy way of raising an error for missing SYCL_HOME only once we need to get any SYCL-specific path. zSYCL runtime is not dected. Please setup the pytorch prerequisites for Intel GPU following the instruction in https://github.com/pytorch/pytorch?tab=readme-ov-file#intel-gpu-support or install intel-sycl-rt via pip.) SYCL_HOMErurErJrvrws r?_join_sycl_homer}s6:; ; 77<< *E **rYa* !! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Your compiler (%s) may be ABI-incompatible with PyTorch!Please use a compiler that is ABI-compatible with GCC 5.0 and above.See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6for instructions on how to install GCC 5 or higher.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! WARNING !!as !! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Your compiler (%s) is not compatible with the compiler Pytorch wasbuilt with for this platform, which is %s on %s. Pleaseuse %s to to compile your extension. Alternatively, you maycompile PyTorch from source using %s, and then you can also use%s to compile your extension.See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for helpwith compiling PyTorch from source.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! WARNING !!zThe detected CUDA version (%s) mismatches the version that was used to compilePyTorch (%s). Please make sure to use the same CUDA versions.zThe detected CUDA version (%s) has a minor version mismatch with the version that was used to compile PyTorch (%s). Most likely this shouldn't be a problem.zCUDA was not found on the system, please set the CUDA_HOME or the CUDA_PATHenvironment variable or add NVCC to your system PATH. The extension compilation will fail.r^TFc#2K|]}t|ywN)int).0vs r? rsJAQJs. CUDNN_HOME CUDNN_PATHz\d+\.\d+\.\d+\w+\+\w+) z/MDz/wd4819z/wd4251z/wd4244z/wd4267z/wd4275z/wd4018z/wd4190z/wd4624z/wd4067z/wd4068z/EHsc)&base_class_has_different_dll_interfacefield_without_dll_interface#dll_interface_conflict_none_assumed(dll_interface_conflict_dllexport_assumed)z-D__CUDA_NO_HALF_OPERATORS__z-D__CUDA_NO_HALF_CONVERSIONS__z"-D__CUDA_NO_BFLOAT16_CONVERSIONS__z-D__CUDA_NO_HALF2_OPERATORS__z--expt-relaxed-constexpr)z-D__HIP_PLATFORM_AMD__=1z -DUSE_ROCM=1z -DHIPBLAS_V2-fPIC)z-DCUDA_HAS_FP16=1z-D__HIP_NO_HALF_OPERATORS__=1z-D__HIP_NO_HALF_CONVERSIONS__=1z!-DHIP_ENABLE_WARP_SYNC_BUILTINS=1z-fms-extensionsz-Wno-ignored-attributeschtrdnd}tj|dg}tjd|j j }|gdnt|j}ttt|}t|dk(sJd|d|d d |d d S) Nicxrg --version(\d+)\.(\d+)\.(\d+)0rrr%z&Failed to parse DPC++ compiler versionrr02r) rL subprocess check_outputresearchdecodestriplistgroupsmaprrN)rg compiler_infomatchras r?_get_icpx_versionrs5FD++T;,?@M II,m.B.B.D.J.J.L ME!&oD4HG3sG$%G w<1 FFF aj\'!*RB 88rYcdtjvrtjjdStjj }|Dcgc]}|j dr|}}dj|Scc}w)NTORCH_XPU_ARCH_LISTdg2,)rErFrGrPxpu get_arch_list startswithrv) arch_listxs r?_get_sycl_arch_listr'si *zz~~344 '')I&AqQ\\%-@AIA 88I Bs B+Bctd|Drytdk7r|jdy|jdy)Nc3>K|]}|jdyw)-fsycl-targets=Nrrflags r?rz2_append_sycl_targets_if_missing..6s A$4??, - Arz -fsycl-targets=spir64_gen,spir64z-fsycl-targets=spir64)anyrappendcflagss r?_append_sycl_targets_if_missingr5s: A& AA" 89  -.rYct|Dcgc]}|jds|}}|sJdt}|dk7r |d|dgz }|Scc}w)Nrz6bug: -fsycl-targets should have been amended to cflagsrz -Xs "-device r=)reversedrr)rrrflagsrs r?_get_sycl_device_flagsr@sf!( L1ALL9J,KQ LE L JJJ5#%IB M)A.// L Ms AAz-fsyclz -fsycl-linkz--offload-compressx86 x86_amd64)r z win-amd64 0x03090000ctr"tjjdd}|Stjjdd}|S)NCXXclc++)rLrErFrG)compilers r?r7r7^s;::>>%. O::>>%/ OrYc^tjtjj Sr)!BUILT_FROM_SOURCE_VERSION_PATTERNrrPra __version__rrYr?_is_binary_buildres 066u}}7P7PQ QQrYctrddgSgdS)Nclang++clang)zg++gcczgnu-c++zgnu-ccrr)IS_MACOSrrYr? _accepted_compilers_for_platformris#+Iw h1hhrYctjj|r*t|5}|j }ddd|k(ryt|d5}|j |dddy#1swY6xYw#1swYyxYw)z Equivalent to writing the content into the file but will not touch the file if it already had the right content (to avoid triggering recompile). Nw)rErJrOopenreadwrite)filename new_contentrrcontent source_files r? _maybe_writerms~  ww~~h (^ qffhG  k !  h ' +&''  ''sA1A=1A:=Bc|tjjtjj dS)a Return the path to the root folder under which extensions will built. For each extension module built, there will be one folder underneath the folder returned by this function. For example, if ``p`` is the path returned by this function and ``ext`` the name of an extension, the build folder for the extension will be ``p/ext``. This directory is **user-specific** so that multiple users on the same machine won't meet permission issues. torch_extensions)appname)rErJr_rP_appdirsuser_cache_dirrrYr?r)r)}s, 77  ENN99BT9U VVrYrctrytj|ytjj t fdtDrytjj}d|d< tj|dgtj|jt}t rt#j$d t"j&}t#j(||}t+|d k7rd |vStjj |d j-tjj/d k(rd|vryt fdtDSt0r|j3dSy#tj$r=tj|dgtj|jt}Y,wxYw)a Verify that the compiler is the expected one for the current platform. Args: compiler (str): The compiler executable to check. Returns: True if the compiler is gcc/g++ on Linux or clang/clang++ on macOS, and always True for Windows. TFc3&K|]}|v ywrrrrk compiler_paths r?rz1check_compiler_ok_for_platform..s PT4= PCLC_ALL-vstderrenvr^COLLECT_GCC=(.*)$rz clang versionrr gcc versionc3&K|]}|v ywrrrs r?rz1check_compiler_ok_for_platform..sXT4=(Xrz Apple clang)rLrHrIrErJr_rrrFcopyrrSTDOUTrSUBPROCESS_DECODE_ARGSCalledProcessErrorIS_LINUXrcompile MULTILINEfindallrNrr`rrrrversion_stringpatternresultsrs @r?r*r*sLL*MGG$$]3M P-M-O PP **// CCMMl00(D1A*J[J[adelloEF**12<<@**Wn5 w<1 #n4 4(()9)9);< 77  M *e 3 8WX5U5WXXX((77 '  ( (Ms00(K1HQ[QbQbhklssvLMMs9FA G'&G'cts dtdfStjj ddvr dtdfSt |sNt jt|tdtjtddtdfStr dtdfS trt}tj |ddg}n+t"}tj |tj$ }t'j(d |j*t,j/}|gd nt1|j3}|Dcgc]}t'j8d d|}}t;t=t>||k\rdtdjA|fS|ddjA|}t jtB|dtdjA|fS#t4$r?tj6\}}}t jd ||dtdfcYSwxYwcc}w)a Determine if the given compiler is ABI-compatible with PyTorch alongside its version. Args: compiler (str): The compiler executable name to check (e.g. ``g++``). Must be executable in a shell process. Returns: A tuple that contains a boolean that defines if the compiler is (likely) ABI-incompatible with PyTorch, followed by a `TorchVersion` string that contains the compiler version separated by dots. Tz0.0.0TORCH_DONT_CHECK_COMPILER_ABION1YESTRUEYrFz-dumpfullversionz -dumpversion)rrrz*Error checking compiler version for %s: %sz\Drrr<)"rr rErFrGr*rSrTWRONG_COMPILER_WARNINGrsysplatformrrMINIMUM_GCC_VERSIONrrMINIMUM_MSVC_VERSIONrrrrrrrr Exceptionexc_infosubtuplerrrvABI_INCOMPATIBILITY_WARNING) rminimum_required_versionrrra_errorrnumeric_versions r?r+r+s  l7+,, zz~~56:YYl7+,, *( 3-x9Y9[\]9^`c`l`loOoQRSoT U|G,--l7+,, . ': $&33X?QSa4bcM'; $&33HZEVEVWM 02F-2F2FH^2_2e2e2gh%*]/U\\^8L6==rvveR+=O= So &'+CCl388O#<=>>1SXXo678H NN.9 < 9: ;; .lln 5!CXuU|G,--.>s3B$G?I ?AII compiler_namecompiler_versionctstttjj tdt rdnd}tjj|std|dtdtj|dgjjt}tjd|}|y|j!d }t#|}t$j&j(yt#t$j&j(}||k7rt+|d d t-d |j.|j.k7r)tt0|t$j&j(t2j5t6|t$j&j(t8j:j=d r+tj>jAd dvr tCsy|j=drtDntF}||vrt2j5d||y||\} } d|vr |tFk(rd} dj tItJ| } dj tItJ| } d| d| } |tM| krtd|d|d|d| d|d| d |tM| k\rtd|d|d|d|d| d y)Nbinznvcc.exerDznvcc not found at 'z'. Ensure CUDA path 'z ' is correct.rzrelease (\d+[.]\d+)rmajorzsetuptools>=49.4.0 is requiredrrrrz:There are no %s version bounds defined for CUDA version %szV11.4.48rrz>=z, >$ "5dV;PQZP[[h ijjRz..k/BCIIKRRTjk9935EFL#))!,'(H }}! !3!34%% 8Wd + 3=> > >>/55 546F HZHZ[ [)+;U]]=O=OP LL # #G , JJNN: ;Cb b  >K>V>VW^>_':ev33SUbdtu:NO_:`77 ) ).BFW.W(/ %#&88C5I,J#K (+S:S1T(U% !9 :#>[=\] l+CD D3M?"EUDVW==M   # #$> ?  # #$: ;rYcLtd|Ds|jdyy)Nc3>K|]}|jdyw)z -sycl-std=Nrrs r?rz5_append_sycl_std_if_no_std_present..:s@t|,@rz-sycl-std=2020)rrrs r?"_append_sycl_std_if_no_std_presentr,9s# @@ @ &' ArYcTt}d|tjd|g}|S)Nz-fsycl-host-compiler=z-fsycl-host-compiler-options=)r7shlexquote)rhost_cxx host_cflagss r?_wrap_sycl_host_flagsr2>s7!H z* 3F8<=K rYczeZdZdZedZd fd Zd fd Zd dZfdZ de e e ffdZ d Zd Zd ZxZS) r,a A custom :mod:`setuptools` build extension . This :class:`setuptools.build_ext` subclass takes care of passing the minimum required compiler flags (e.g. ``-std=c++17``) as well as mixed C++/CUDA/SYCL compilation (and support for CUDA/SYCL files in general). When using :class:`BuildExtension`, it is allowed to supply a dictionary for ``extra_compile_args`` (rather than the usual list) that maps from languages/compilers (the only expected values are ``cxx``, ``nvcc`` or ``sycl``) to a list of additional compiler flags to supply to the compiler. This makes it possible to supply different flags to the C++, CUDA and SYCL compiler during mixed compilation. ``use_ninja`` (bool): If ``use_ninja`` is ``True`` (default), then we attempt to build using the Ninja backend. Ninja greatly speeds up compilation compared to the standard ``setuptools.build_ext``. Fallbacks to the standard distutils backend if Ninja is not available. .. note:: By default, the Ninja backend uses #CPUS + 2 workers to build the extension. This may use up too many resources on some systems. One can control the number of workers by setting the `MAX_JOBS` environment variable to a non-negative number. c "Gfdd|}|S)zReturn a subclass with alternative constructor that extends any original keyword arguments to the original constructor with the given options.c"eZdZfdZxZS)5BuildExtension.with_options..cls_with_optionscF|jt||i|yr)updatesuper__init__)selfr9kwargs __class__optionss r?r:z>BuildExtension.with_options..cls_with_options.__init__fs! g& $1&1rY)__name__ __module__ __qualname__r: __classcell__)r=r>s@r?cls_with_optionsr6es  2 2rYrCr)clsr>rCs ` r? with_optionszBuildExtension.with_optionsbs 2s 2  rYr:ct||i||jdd|_|jdd|_|jr+d}t st j|dd|_yyy)Nno_python_abi_suffixF use_ninjaTznAttempted to use ninja as the BuildExtension backend but %s. Falling back to using the slow distutils backend.zwe could not find ninja.)r9r:rGrGrHr4rSrT)r;r9r<msgr=s r?r:zBuildExtension.__init__lsp $)&)$*JJ/Eu$M!K6 >>KC%'s$>?!&( rYcJt||jrd|_yy)NT)r9finalize_optionsrHforce)r;r=s r?rKzBuildExtension.finalize_optionsys!  " >>DJ rYcj\}}d}d}tj}t|d}|r|s^|r\|jD]:}t j j|\}} | dk(rd}n| dk(rd}|s7|s:nt|d}|r|s|r\|rjsJd|rts t||jD]}t|jtr%dD] } | |jvsg|j| <"j|dtrj||j rj|dt"j%|d |jvsjrJd |j&d j(xj*gd z c_t,j.j0j3r j(xj*d gz c_j(j4dk(rNj(xj6ddgz c_j(j8j(j:nj(j<dfd dddfd } dfd } dd dfd } dfd } j(j4dk(r0jr| j(_nA| j(_n/jr| j(_n| j(_t?j@y)NF.cuT.syclz+ninja is required to build sycl extensions.)cxxrDsycl-DTORCH_API_INCLUDE_EXTENSION_Hz-DPy_LIMITED_API= nvcc_dlinkz;With dlink=True, ninja is required to build cuda extension r)rN.cuh.hiprOz.mmmsvcrTcjjdk(rdnd}|jddz}tfd|Ds|j |yy)NrVz/{}:z-{}=stdzc++17c3@K|]}|jywrr)rrcpp_flag_prefixs r?rzZBuildExtension.build_extensions..append_std17_if_no_std_present..sKDt7K)r compiler_typeformatrr)rcpp_format_prefixcpp_flagrZr;s @r?append_std17_if_no_std_presentzGBuildExtension.build_extensions..append_std17_if_no_std_presentsY+/--*E*E*OU[ /66u=O&0HKFKK h'LrYctddgz|zt|z}tjd}|%t d|Ds|j d|g|S)N--compiler-options'-fPIC'CCc3>K|]}|jdyw))-ccbinz--compiler-bindirNrrs r?rzKBuildExtension.build_extensions..unix_cuda_flags..s`QUDOO,KL`rrf)COMMON_NVCC_FLAGS_get_cuda_arch_flagsrEgetenvrextend)r_ccbins r?unix_cuda_flagsz8BuildExtension.build_extensions..unix_cuda_flagssc'+Y783F;.convert_to_absolute_paths_inplacesS s5z*=A77==q2#%77??58#<a=!rYcJtj|} jj}t |rut r t ddn tddg} jjd|t|tr|d}t rt|zt|z}n |}nt|tr|d}t r t|z} | |||||| jjd|y# jjdwxYw)Nrr]rD compiler_sorP)rdeepcopyrrt _is_cuda_fileIS_HIP_EXTENSIONry_join_cuda_homeset_executable isinstancedictCOMMON_HIPCC_FLAGS_get_rocm_arch_flagsr&) objsrcextcc_argsextra_postargspp_optsroriginal_compilerrDr`original_compiler;rls r?unix_wrap_single_compilezABuildExtension.build_extensions..unix_wrap_single_compiles]]>2F O$(MM$=$=! %?OOE7;UdejlrUstDMM00E!&$/!''!3f!.unix_wrap_ninja_compiles(4J .dmm.H.H I ,,Z-97-4nF 3Aw!MM66w}UM"mm77;OC w78IC w78I .$/,U3 ">2 .< *; 7# K+ nd3'5f'=$'+N';$#'7:NO_:`'`$'7:L'LO_'_$'67G'H$./?@7BC!u{{1~C C.win_cuda_flagsus%1&9: ;rYc:ttz|zt|zSr)r|r&r}rs r? win_hip_flagsz6BuildExtension.build_extensions..win_hip_flagsys&)99FBEYZ`Eaa brYc tj| _d} fd} | j_ |||||||| j_S# j_wxYw)Nc tjd fd|DDcgc]}|r|jd}}tjd fd|DDcgc]}|r|jd}}tjd fd|DDcgc]}|r|jd}}t|dk\r]t|dk\rN|d }|d }t |rt r t }n td d }tjtrjd }n)tjtr j}ng}t r |}n"|d d gz}tD] } dd| zg|z}tD] } d| g|z} |d|d|g|z|z}nxtjtr$tjdz}|||z }n:tjtr tjz}|||z }|Scc}wcc}wcc}w)Nz /T(p|c)(.*)c3@K|]}j|ywrr)relem src_regexs r?rzbBuildExtension.build_extensions..win_wrap_single_compile..spawn..(O4)>(Or[rz/Fo(.*)c3@K|]}j|ywrr)rr obj_regexs r?rzbBuildExtension.build_extensions..win_wrap_single_compile..spawn..rr[rz ((\-|\/)I.*)c3@K|]}j|ywrr)rr include_regexs r?rzbBuildExtension.build_extensions..win_wrap_single_compile..spawn..sHDm11$7Hr[rrrD -std=c++17--use-local-env-Xcudafe--diag_suppress= -Xcompilerz-cz-orP)rrrrNrvrw_get_hipcc_pathrxrzrr{rMSVC_IGNORE_CUDAFE_WARNINGSCOMMON_MSVC_FLAGS)cmdmsrc_listobj_list include_listrr~rDrignore_warningrrrrr`original_spawnr;rrs @@@r?spawnzOBuildExtension.build_extensions..win_wrap_single_compile..spawns9JJ}5 (O3(O#$GGAJ JJy1 (O3(O#$GGAJ !# ? ; ICH AGGAJ    x=A%#h-1*<"1+C"1+C$S)+#2#4D#25&#AD%dkk48%)[[%8F' T:%)[[F%'F+%26%:F%3F%;|M^>_%_F2Md*46H>6Y)Z]c)cd$5CD&2D%9F%BFC#T3c:\IFR#DKK6!2T[[5G!G6v>v #DKK6!2T[[!@6v>v %c**e   sH3%H8#H=)rrurrr)rrrrr(rrrrr`rrr;rrs r?win_wrap_single_compilez@BuildExtension.build_extensions..win_wrap_single_compile|sl--7DK!N5 +5 +n 5&+ #'V(4e](6A'5 #n #s AA,c jjsjjtjj |}jj jj||||||\} } }} } trD| D cgc]9} | jdr$dj| ddjddn| ;} } |xsg} g}|r&|jjjn%|jjj|| z| ztz}tr"t!||| jt"n| jtt%t't(|}t+|t,r|d}n t/|}tr t"|z}|d}d}|rdg}| D]$}|j1d|j1|&tsA|j1d t2D]'}|j1d |j1d |z)|j| t+|t,r|d }n t/|}tr |}n|}t5|}t5|}|rt5|}t5|}t+|t,rd |vr |d }nd}t7|| |||||ddd|d|d| Scc} w)N-Iz-I{}rr<\rPrrrrrrDrSTFr)r initialized initializerErJrprrrwrr]rrjcompile_options_debugcompile_optionsrr)r&rrrvrzr{rrrr@r)rrrrr(rrrr'rrrsrrrrrr common_cflagrrr`rrr;rrs r?win_wrap_ninja_compilez?BuildExtension.build_extensions..win_wrap_ninja_compiles==,, ((*4J .dmm.H.H I ,,Z-97-4nF 3Aw  ipqdeallSWFX6==12sD)AB^__qq)/RMF dmmAAB dmm;;<m+g58IIF&}e<$$%56$$%67C w78I .$/,U3 ">2 .< *; 7# K+n $15L&&|4&&|45(&&'89*EP#**:6#**+=+NOP""7+nd3'5f'=$'+N';$#'45E'F$'56F'G$#F+F(5K,[9 #12B#C .$/LN4R)7|8T)U&)-& 1''!1'= !%'+ *# !"NUrs>K<r:N)NNNrNNN)NNNrNNNF)! _check_abiiter extensionsnextrrErJsplitextrHrwr$rzextra_compile_argsr{_add_compile_flag_hipify_compile_flagspy_limited_apimin_supported_cpython_define_torch_extension_namerkrsrc_extensionsrPbackendsmpsis_builtr\_cpp_extensionsrr_compiler build_extensions)r;r r cuda_extsycl_extextension_iter extensionsourcerrrrrrr`rrrrrlrrs` @@@@@@@r?rzBuildExtension.build_extensions~s@*.//*;' 'doo.. i#++ ))&13%<#HG^#H  ^T2Ii >> P#P P> ,  /? @ wI)66=2?C)">">><> 44S9?  " "9.O P**95'' &&y4EF[E\2]^  - -i 8y;;;~~v)denesesdttu'vv~7 wB $$(HH$ >>   & & ( MM ( (UG 3 ( == & && 0 MM ) )eV_ < )#}}44 !]]00N#}}55  (   = O O404+/15*+2637,0s s j ; c04+/15*+2637,0I 5I 5X/3*.04)*1526+/16e e P == & && 0~~(> %(? %~~(? %)A &""4(rYct||}|jr-|jd}|dd|ddz}dj |}|S)Nr)r9get_ext_filenamerGsplitrv)r;ext_name ext_filenameext_filename_parts without_abir=s r?rzBuildExtension.get_ext_filename<s]w/9   $ $!-!3!3C!8 ,Sb14Frs4KKK88K0LrYct|jdr|jjd}n t}t |\}}t r1dt jvrdt jvr d}t|||fS)N compiler_cxxrVSCMD_ARG_TGT_ARCHDISTUTILS_USE_SDKzIt seems that the VC environment is activated but DISTUTILS_USE_SDK is not set.This may lead to multiple activations of the VC env.Please set `DISTUTILS_USE_SDK=1` and try again.) hasattrrrr7r+rLrErF UserWarning)r;rrrarIs r?rzBuildExtension._check_abiLsx 4==. 1}}11!4H')H?I 7 ."** %s) rzrr{rrrNrrrSinfo) r;rmodified_flagsrparts flag_part value_partmodified_flag_part modified_flags r?rz$BuildExtension._hipify_compile_flagses i22D 9f HdHd>dN!44V< 0??3'FdN4??SWCX JJsA.E5zQ05- :-6->->vua-P*+=*>a |(L )- VUA(F "))-8KK 94O"))$/ 0 4BI ( ( 0%?e 9rYcr|jjd}|d}d|}|j||y)Nrr-DTORCH_EXTENSION_NAME=)rkrr)r;rnamesrkdefines r?rz+BuildExtension._define_torch_extension_namezs= $$S)Ry*4&1 y&1rYr)r?r@rA__doc__ classmethodrEr:rKrrrrr rrrrrB)r=s@r?r,r,GsX4   ' |)|  !E#|"34 !6B*2rYr,c|jdg}|tz }||d<|jdg}|tz }||d<|jdg}|jd|jd|jd|jdds|jd tr|jd ||d<d |d <t j ||g|i|S) aM Create a :class:`setuptools.Extension` for C++. Convenience method that creates a :class:`setuptools.Extension` with the bare minimum (but often sufficient) arguments to build a C++ extension. All arguments are forwarded to the :class:`setuptools.Extension` constructor. Full list arguments can be found at https://setuptools.pypa.io/en/latest/userguide/ext_modules.html#extension-api-reference .. warning:: The PyTorch python API (as provided in libtorch_python) cannot be built with the flag ``py_limited_api=True``. When this flag is passed, it is the user's responsibility in their library to not use APIs from libtorch_python (in particular pytorch/python bindings) and to only use APIs from libtorch (aten objects, operators and the dispatcher). For example, to give access to custom ops from python, the library should register the ops through the dispatcher. Contrary to CPython setuptools, who does not define -DPy_LIMITED_API as a compile flag when py_limited_api is specified as an option for the "bdist_wheel" command in ``setup``, PyTorch does! We will specify -DPy_LIMITED_API=min_supported_cpython to best enforce consistency, safety, and sanity in order to encourage best practices. To target a different version, set min_supported_cpython to the hexcode of the CPython version of choice. Example: >>> # xdoctest: +SKIP >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CPP_EXT) >>> from setuptools import setup >>> from torch.utils.cpp_extension import BuildExtension, CppExtension >>> setup( ... name='extension', ... ext_modules=[ ... CppExtension( ... name='extension', ... sources=['extension.cpp'], ... extra_compile_args=['-g'], ... extra_link_args=['-Wl,--no-as-needed', '-lm']) ... ], ... cmdclass={ ... 'build_ext': BuildExtension ... }) r library_dirs librariesc10rP torch_cpurF torch_pythonsleefrlanguage)rGr0r1rrL setuptools Extension)rkrr9r<rrrs r?r-r-s\::nb1LMO#L)F>::nb1LMO#L)F> ;+I U W [! ::& .(!#F;F:   g ? ? ??rYc n|jdg}|tdz }||d<|jdg}|jd|jd|jd|jdd s|jd tr4|jd |jd |jd n3|jd|jd|jd||d<|jdg}tr ddlm}t j}|j |||t jj|dg|D cgc]!} t jj| #c} ddd} t} |D]t} t jj| } | | vr| | j| | jn| }| jt jj||vt| }|t!dz }||d<d|d<|jdg}|jdd xs|}|r|jdi}|jdg}|dgz }||Dcgc]}d| c}z }||Dcgc]}d| c}z }t"j$j&,t)t"j$j&d k\r|d!gz }||d<||d<t+j,||g|i|Scc} wcc}wcc}w)"a Create a :class:`setuptools.Extension` for CUDA/C++. Convenience method that creates a :class:`setuptools.Extension` with the bare minimum (but often sufficient) arguments to build a CUDA/C++ extension. This includes the CUDA include path, library path and runtime library. All arguments are forwarded to the :class:`setuptools.Extension` constructor. Full list arguments can be found at https://setuptools.pypa.io/en/latest/userguide/ext_modules.html#extension-api-reference .. warning:: The PyTorch python API (as provided in libtorch_python) cannot be built with the flag ``py_limited_api=True``. When this flag is passed, it is the user's responsibility in their library to not use APIs from libtorch_python (in particular pytorch/python bindings) and to only use APIs from libtorch (aten objects, operators and the dispatcher). For example, to give access to custom ops from python, the library should register the ops through the dispatcher. Contrary to CPython setuptools, who does not define -DPy_LIMITED_API as a compile flag when py_limited_api is specified as an option for the "bdist_wheel" command in ``setup``, PyTorch does! We will specify -DPy_LIMITED_API=min_supported_cpython to best enforce consistency, safety, and sanity in order to encourage best practices. To target a different version, set min_supported_cpython to the hexcode of the CPython version of choice. Example: >>> # xdoctest: +SKIP >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CPP_EXT) >>> from setuptools import setup >>> from torch.utils.cpp_extension import BuildExtension, CUDAExtension >>> setup( ... name='cuda_extension', ... ext_modules=[ ... CUDAExtension( ... name='cuda_extension', ... sources=['extension.cpp', 'extension_kernel.cu'], ... extra_compile_args={'cxx': ['-g'], ... 'nvcc': ['-O2']}, ... extra_link_args=['-Wl,--no-as-needed', '-lcuda']) ... ], ... cmdclass={ ... 'build_ext': BuildExtension ... }) Compute capabilities: By default the extension will be compiled to run on all archs of the cards visible during the building process of the extension, plus PTX. If down the road a new card is installed the extension may need to be recompiled. If a visible card has a compute capability (CC) that's newer than the newest version for which your nvcc can build fully-compiled binaries, PyTorch will make nvcc fall back to building kernels with the newest version of PTX your nvcc does support (see below for details on PTX). You can override the default behavior using `TORCH_CUDA_ARCH_LIST` to explicitly specify which CCs you want the extension to support: ``TORCH_CUDA_ARCH_LIST="6.1 8.6" python build_my_extension.py`` ``TORCH_CUDA_ARCH_LIST="5.2 6.0 6.1 7.0 7.5 8.0 8.6+PTX" python build_my_extension.py`` The +PTX option causes extension kernel binaries to include PTX instructions for the specified CC. PTX is an intermediate representation that allows kernels to runtime-compile for any CC >= the specified CC (for example, 8.6+PTX generates PTX that can runtime-compile for any GPU with CC >= 8.6). This improves your binary's forward compatibility. However, relying on older PTX to provide forward compat by runtime-compiling for newer CCs can modestly reduce performance on those newer CCs. If you know exact CC(s) of the GPUs you want to target, you're always better off specifying them individually. For example, if you want your extension to run on 8.0 and 8.6, "8.0+PTX" would work functionally because it includes PTX that can runtime-compile for 8.6, but "8.0 8.6" would be better. Note that while it's possible to include all supported archs, the more archs get included the slower the building process will be, as it will build a separate kernel image for each arch. Note that CUDA-11.5 nvcc will hit internal compiler error while parsing torch/extension.h on Windows. To workaround the issue, move python binding logic to pure C++ file. Example use: #include at::Tensor SigmoidAlphaBlendForwardCuda(....) Instead of: #include torch::Tensor SigmoidAlphaBlendForwardCuda(...) Currently open issue for nvcc bug: https://github.com/pytorch/pytorch/issues/69460 Complete workaround code example: https://github.com/facebookresearch/pytorch3d/commit/cb170ac024a949f1f9614ffe6af1c38d972f7d48 Relocatable device code linking: If you want to reference device symbols across compilation units (across object files), the object files need to be built with `relocatable device code` (-rdc=true or -dc). An exception to this rule is "dynamic parallelism" (nested kernel launches) which is not used a lot anymore. `Relocatable device code` is less optimized so it needs to be used only on object files that need it. Using `-dlto` (Device Link Time Optimization) at the device code compilation step and `dlink` step helps reduce the protentional perf degradation of `-rdc`. Note that it needs to be used at both steps to be useful. If you have `rdc` objects you need to have an extra `-dlink` (device linking) step before the CPU symbol linking step. There is also a case where `-dlink` is used without `-rdc`: when an extension is linked against a static lib containing rdc-compiled objects like the [NVSHMEM library](https://developer.nvidia.com/nvshmem). Note: Ninja is required to build a CUDA Extension with RDC linking. Example: >>> # xdoctest: +SKIP >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CPP_EXT) >>> CUDAExtension( ... name='cuda_extension', ... sources=['extension.cpp', 'extension_kernel.cu'], ... dlink=True, ... dlink_libraries=["dlink_lib"], ... extra_compile_args={'cxx': ['-g'], ... 'nvcc': ['-O2', '-rdc=true']}) rrQ) device_typerrrPrrFramdhip64c10_hip torch_hipcudartc10_cuda torch_cudarr hipify_python*T)project_directoryoutput_directoryheader_include_dirsincludes extra_files show_detailedis_pytorch_extensionhipify_extra_files_onlyrrdlink_librariesdlinkrrSz-dlink-Lz-lrz-dlto)rGr1rrwhipifyr"rEgetcwdrJrvrpset hipified_pathaddrelpathrr0rPrarQr rr)rkrr9r<rrrr" build_dirr hipify_resulthipified_sourcesrs_abshipified_s_absr,r-rextra_compile_args_dlinkrs r?r.r.sn::nb1LMf55L)F> ;+I U W [! ::& .($#%"$&#F;::nb1L)IIK %,,'& ,ggll9c235<=+=!%$(-  5 MFGGOOF+EEJmE[+E2@@L,E2@@SX   !K L  M'(Mf55L)F>F:jj!2B7O JJw & 9/E #ZZ(:%E$Gs&&L( L-- L2c|jdg}|tz }||d<|jdg}|jd|jd|jd|jd|jdds|jd |jd ||d<|jd g}|tz }||d <d |d <t j ||g|i|S)at Creates a :class:`setuptools.Extension` for SYCL/C++. Convenience method that creates a :class:`setuptools.Extension` with the bare minimum (but often sufficient) arguments to build a SYCL/C++ extension. All arguments are forwarded to the :class:`setuptools.Extension` constructor. .. warning:: The PyTorch python API (as provided in libtorch_python) cannot be built with the flag ``py_limited_api=True``. When this flag is passed, it is the user's responsibility in their library to not use APIs from libtorch_python (in particular pytorch/python bindings) and to only use APIs from libtorch (aten objects, operators and the dispatcher). For example, to give access to custom ops from python, the library should register the ops through the dispatcher. Contrary to CPython setuptools, who does not define -DPy_LIMITED_API as a compile flag when py_limited_api is specified as an option for the "bdist_wheel" command in ``setup``, PyTorch does! We will specify -DPy_LIMITED_API=min_supported_cpython to best enforce consistency, safety, and sanity in order to encourage best practices. To target a different version, set min_supported_cpython to the hexcode of the CPython version of choice. Example: >>> # xdoctest: +SKIP >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CPP_EXT) >>> from torch.utils.cpp_extension import BuildExtension, SyclExtension >>> setup( ... name='xpu_extension', ... ext_modules=[ ... SyclExtension( ... name='xpu_extension', ... sources=['extension.cpp', 'extension_kernel.cpp'], ... extra_compile_args={'cxx': ['-g', '-std=c++20', '-fPIC']}) ... ], ... cmdclass={ ... 'build_ext': BuildExtension ... }) By default the extension will be compiled to run on all archs of the cards visible during the building process of the extension. If down the road a new card is installed the extension may need to be recompiled. You can override the default behavior using `TORCH_XPU_ARCH_LIST` to explicitly specify which device architectures you want the extension to support: ``TORCH_XPU_ARCH_LIST="pvc,xe-lpg" python build_my_extension.py`` Note that while it's possible to include all supported archs, the more archs get included the slower the building process will be, as it will build a separate kernel image for each arch. Note: Ninja is required to build SyclExtension. rrrc10_xpurPrrFr torch_xpurrr)rGr1rr0rr)rkrr9r<rrrs r?r/r/sr::nb1LMO#L)F> ;+I U Y W [! ::& .( [!#F;::nb1LMO#L)F>F:   g ? ? ??rYrctjjtd}|tjj|ddddg}|dk(rQtrK|j tjj|d|j t d|S|dk(rtd}|dk7r|j |tjjdd x}r|dk7r|j |t3|j tjjtd|S|d k(r5|j td|j tdd |S) z Get the include paths required to build a C++ or CUDA or SYCL extension. Args: device_type: Defaults to "cpu". Returns: A list of include path strings. includerPcsrcapirQTHHz /usr/include CUDA_INC_PATHNrrQ) rErJrv _TORCH_PATHrwrryrxrFrGrr})r lib_includerxcuda_home_include cuda_inc_paths r?r0r0s1'',,{I6K  ['65)D E f!1 RWW\\+u56 _Y/0" L!  +I6  . LL* + ZZ^^OTB BM B/ LL '  ! LLj)< = L   _Y/0 _Y78 LrYctg}|dk(r]trWd}|jt|t3|jt j jtd|S|dk(rtr!t j jdd}nTd}t j jt|s*t j jtdrd}|jt|t3|jt j jt||S|dk(rtr!t j jdd}nTd}t j jt|s*t j jtdrd}|jt||S)z Get the library paths required to build a C++ or CUDA extension. Args: device_type: Defaults to "cpu". Returns: A list of library path strings. rQrx64lib64r) TORCH_LIB_PATHrwrryHIP_HOMErErJrvrLrOrxrr})rrxlib_dirs r?r1r1sP Ef!1 _W-.   LLh6 76 L5   ggll5%0GGGGNN?7#;<GGNN?5#9:  _W-.  ! LLj': ; L   ggll5%0GGGGNN?7#;<GGNN?5#9: _W-. LrYrrrcvt|t|tr|gn|||||||xs t|||| | | | | S)aG Load a PyTorch C++ extension just-in-time (JIT). To load an extension, a Ninja build file is emitted, which is used to compile the given sources into a dynamic library. This library is subsequently loaded into the current Python process as a module and returned from this function, ready for use. By default, the directory to which the build file is emitted and the resulting library compiled to is ``/torch_extensions/``, where ```` is the temporary folder on the current platform and ```` the name of the extension. This location can be overridden in two ways. First, if the ``TORCH_EXTENSIONS_DIR`` environment variable is set, it replaces ``/torch_extensions`` and all extensions will be compiled into subfolders of this directory. Second, if the ``build_directory`` argument to this function is supplied, it overrides the entire path, i.e. the library will be compiled into that folder directly. To compile the sources, the default system compiler (``c++``) is used, which can be overridden by setting the ``CXX`` environment variable. To pass additional arguments to the compilation process, ``extra_cflags`` or ``extra_ldflags`` can be provided. For example, to compile your extension with optimizations, pass ``extra_cflags=['-O3']``. You can also use ``extra_cflags`` to pass further include directories. CUDA support with mixed compilation is provided. Simply pass CUDA source files (``.cu`` or ``.cuh``) along with other sources. Such files will be detected and compiled with nvcc rather than the C++ compiler. This includes passing the CUDA lib64 directory as a library directory, and linking ``cudart``. You can pass additional flags to nvcc via ``extra_cuda_cflags``, just like with ``extra_cflags`` for C++. Various heuristics for finding the CUDA install directory are used, which usually work fine. If not, setting the ``CUDA_HOME`` environment variable is the safest option. SYCL support with mixed compilation is provided. Simply pass SYCL source files (``.sycl``) along with other sources. Such files will be detected and compiled with SYCL compiler (such as Intel DPC++ Compiler) rather than the C++ compiler. You can pass additional flags to SYCL compiler via ``extra_sycl_cflags``, just like with ``extra_cflags`` for C++. SYCL compiler is expected to be found via system PATH environment variable. Args: name: The name of the extension to build. This MUST be the same as the name of the pybind11 module! sources: A list of relative or absolute paths to C++ source files. extra_cflags: optional list of compiler flags to forward to the build. extra_cuda_cflags: optional list of compiler flags to forward to nvcc when building CUDA sources. extra_sycl_cflags: optional list of compiler flags to forward to SYCL compiler when building SYCL sources. extra_ldflags: optional list of linker flags to forward to the build. extra_include_paths: optional list of include directories to forward to the build. build_directory: optional path to use as build workspace. verbose: If ``True``, turns on verbose logging of load steps. with_cuda: Determines whether CUDA headers and libraries are added to the build. If set to ``None`` (default), this value is automatically determined based on the existence of ``.cu`` or ``.cuh`` in ``sources``. Set it to `True`` to force CUDA headers and libraries to be included. with_sycl: Determines whether SYCL headers and libraries are added to the build. If set to ``None`` (default), this value is automatically determined based on the existence of ``.sycl`` in ``sources``. Set it to `True`` to force SYCL headers and libraries to be included. is_python_module: If ``True`` (default), imports the produced shared library as a Python module. If ``False``, behavior depends on ``is_standalone``. is_standalone: If ``False`` (default) loads the constructed extension into the process as a plain dynamic library. If ``True``, build a standalone executable. Returns: If ``is_python_module`` is ``True``: Returns the loaded PyTorch extension as a Python module. If ``is_python_module`` is ``False`` and ``is_standalone`` is ``False``: Returns nothing. (The shared library is loaded into the process as a side effect.) If ``is_standalone`` is ``True``. Return the path to the executable. (On Windows, TORCH_LIB_PATH is added to the PATH environment variable as a side effect.) Example: >>> # xdoctest: +SKIP >>> from torch.utils.cpp_extension import load >>> module = load( ... name='extension', ... sources=['extension.cpp', 'extension_kernel.cu'], ... extra_cflags=['-O2'], ... verbose=True) keep_intermediates) _jit_compilerzr_get_build_directory)rkr extra_cflagsextra_cuda_cflagsextra_sycl_cflags extra_ldflagsextra_include_pathsrrrris_python_moduler'rPs r?r2r2/sVZ  - 7>/g>- //rYzWPyBind11 ABI handling is internal to PyBind11; this will be removed after PyTorch 2.9.0cgSrrrrYr?_get_pybind11_abi_build_flagsrZs IrYctsytjj}d|d< t j |dgtj |jt}tjdtj}tj||}t|dk7rytjj!|d j#}tjj%|d k(rd |vry y#t$rN t j |dgtj |jt}n#t$rYYywxYwYwxYw) NFrrrrrrrrrrT)rrErFrrrrrrrrrrrrNrJr_rr`rs r?r8r8s9  **// CCMl00(D1A*J[J[adelloEFjj-r||.listToStrings7 9M &G w} %F & rYcxtjddd|d|d|d|d|d|d|djS)Nz[ \n]+r<z z -x c++-header z -o z )rrr)r head_file head_file_pchrtorch_include_dirsrSrWs r?format_precompiler_header_cmdzW_check_and_build_extension_h_precompiler_headers..format_precompiler_header_cmdszvv   /)DqI[H\\]^q]rrsuAtBBCDQCRR   %'  rYc*|jdd}|S)Nr<r)r)r signatures r?command_to_signaturezN_check_and_build_extension_h_precompiler_headers..command_to_signaturesKKS) rYctjj|}|duryt|5}|j }||k(cdddS#1swYyxYw)NF)rErJisfilerr) file_pathrib_existfilers r?check_pch_signature_in_filezU_check_and_build_extension_h_precompiler_headers..check_pch_signature_in_filesP''..+ e  )_ (iikG'  ( ( (s AActjj|s t|j ddyy#t $r6}|j t jk7rtd||Yd}~yd}~wwxYw)NT)parentsexist_okzFail to create path ) rErJrOrmkdirruerrnoEEXISTr)path_direxcs r?_create_if_not_existzN_check_and_build_extension_h_precompiler_headers.._create_if_not_existsrww~~h' SX$$TD$A( S99 ,&)=hZ'HIsR- Ss? A>,A99A>ctjj|t|d5}|j ||j dddy#1swYyxYw)Nr)rErJrKrrclose)rmpch_signrrrys r?write_pch_signature_to_filezU_check_and_build_extension_h_precompiler_headers..write_pch_signature_to_filesNRWW__Y78 )S ! Q GGH  GGI   s "AA'c tj|dtjy#tj$r}t d||d}~wwxYw)NT)shellrz)Compile PreCompile Header fail, command: )rrrrr)pch_cmdes r?build_precompile_headerzQ_check_and_build_extension_h_precompiler_headers..build_precompile_headersN ]  # #G4 @Q@Q R,, ]!J7)TU[\ \ ]s&)AA  Ar<rz-I z-I {}r@rArRrrT) rr7r8rErJrvrDr] sysconfigget_pathrl)rSrWr'rb_is_gccrdrehead_file_signaturerbrgrjrpr}rextra_cflags_strr?extra_include_paths_strrErftorch_include_dirs_strrcommon_cflags_strrr| b_same_signrys @r?0_check_and_build_extension_h_precompiler_headersrs !H$X.H5 [)WmLIGGLLiBSTM'',,{IwHZ[  (S ] $L1!hh?R':;G2gY;XZ'',,{I6K k]y)))45rww||K&%ST **<=M ;<< lG,,M$]3+HiPacy|LNefG#G,H ww~~m$D0(#$7B12ExP %  #G , '(;X F ; ._remove_if_file_exists@s# 77>>) $ IIi  %rYr?rPr]r^)rErJrvrD)rrers r?r6r6?sM!GGLLiBSTM'',,{IwHZ[=)./rYcd| xs t|| } t|tr|g}|xsg}t|tr|g}|xsg}t|tr|g}|s|jdd|dur t || n t |g}|j dt|tr|g}t|tr|Dcic]}||}}n't|tstdt||jD]>\}}|r|j d|d|d|d $|j d|d |d |d @|j d ||z }tjj| d }t|dj||g}|r|s6|jdd|jdd|jddtjj| d}t|dj||j ||rr|s$|jdd|jddtjj| d}t|dj||j |t!||||||| | | | | |d|Scc}w)aY Load a PyTorch C++ extension just-in-time (JIT) from string sources. This function behaves exactly like :func:`load`, but takes its sources as strings rather than filenames. These strings are stored to files in the build directory, after which the behavior of :func:`load_inline` is identical to :func:`load`. See `the tests `_ for good examples of using this function. Sources may omit two required parts of a typical non-inline C++ extension: the necessary header includes, as well as the (pybind11) binding code. More precisely, strings passed to ``cpp_sources`` are first concatenated into a single ``.cpp`` file. This file is then prepended with ``#include `` Furthermore, if the ``functions`` argument is supplied, bindings will be automatically generated for each function specified. ``functions`` can either be a list of function names, or a dictionary mapping from function names to docstrings. If a list is given, the name of each function is used as its docstring. The sources in ``cuda_sources`` are concatenated into a separate ``.cu`` file and prepended with ``torch/types.h``, ``cuda.h`` and ``cuda_runtime.h`` includes. The ``.cpp`` and ``.cu`` files are compiled separately, but ultimately linked into a single library. Note that no bindings are generated for functions in ``cuda_sources`` per se. To bind to a CUDA kernel, you must create a C++ function that calls it, and either declare or define this C++ function in one of the ``cpp_sources`` (and include its name in ``functions``). The sources in ``sycl_sources`` are concatenated into a separate ``.sycl`` file and prepended with ``torch/types.h``, ``sycl/sycl.hpp`` includes. The ``.cpp`` and ``.sycl`` files are compiled separately, but ultimately linked into a single library. Note that no bindings are generated for functions in ``sycl_sources`` per se. To bind to a SYCL kernel, you must create a C++ function that calls it, and either declare or define this C++ function in one of the ``cpp_sources`` (and include its name in ``functions``). See :func:`load` for a description of arguments omitted below. Args: cpp_sources: A string, or list of strings, containing C++ source code. cuda_sources: A string, or list of strings, containing CUDA source code. sycl_sources: A string, or list of strings, containing SYCL source code. functions: A list of function names for which to generate function bindings. If a dictionary is given, it should map function names to docstrings (which are otherwise just the function names). with_cuda: Determines whether CUDA headers and libraries are added to the build. If set to ``None`` (default), this value is automatically determined based on whether ``cuda_sources`` is provided. Set it to ``True`` to force CUDA headers and libraries to be included. with_sycl: Determines whether SYCL headers and libraries are added to the build. If set to ``None`` (default), this value is automatically determined based on whether ``sycl_sources`` is provided. Set it to ``True`` to force SYCL headers and libraries to be included. with_pytorch_error_handling: Determines whether pytorch error and warning macros are handled by pytorch instead of pybind. To do this, each function ``foo`` is called via an intermediary ``_safe_foo`` function. This redirection might cause issues in obscure cases of cpp. This flag should be set to ``False`` when this redirect causes issues. no_implicit_headers: If ``True``, skips automatically adding headers, most notably ``#include `` and ``#include `` lines. Use this option to improve cold start times when you already include the necessary headers in your source code. Default: ``False``. Example: >>> # xdoctest: +REQUIRES(env:TORCH_DOCTEST_CPP_EXT) >>> from torch.utils.cpp_extension import load_inline >>> source = """ at::Tensor sin_add(at::Tensor x, at::Tensor y) { return x.sin() + y.sin(); } """ >>> module = load_inline(name='inline_extension', ... cpp_sources=[source], ... functions=['sin_add']) .. note:: Since load_inline will just-in-time compile the source code, please ensure that you have the right toolchains installed in the runtime. For example, when loading C++, make sure a C++ compiler is available. If you're loading a CUDA extension, you will need to additionally install the corresponding CUDA toolkit (nvcc and any other dependencies your code has). Compiling toolchains are not included when you install torch and must be additionally installed. During compiling, by default, the Ninja backend uses #CPUS + 2 workers to build the extension. This may use up too many resources on some systems. One can control the number of workers by setting the `MAX_JOBS` environment variable to a non-negative number. rz#include Tz*PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {z3Expected 'functions' to be a list or dict, but was zm.def("z", torch::wrap_pybind_function(z), "z");z", z, "}zmain.cpp z#include rz#include rz#include zcuda.cuz#include z sycl.syclF)r'rP)rRrzrinsertrr6rrr{rtypeitemsrErJrvrrQ)rk cpp_sources cuda_sources sycl_sources functionsrSrTrUrVrWrrrrrXwith_pytorch_error_handlingrPuse_pchno_implicit_headers module_defrr function_name docstringcpp_source_pathrcuda_source_pathsycl_source_paths r?r3r3Jsl&L)=dG)LO+s#"m %2L,$$~ %2L,$$~ 1<=$8GZ[.0  FG i %" I i &'01!A1I1It,RSWXaSbRcde e(1(9 ` $M9*!!GM?:YZgYhhlmvlwwz"{|!!GM?#m_CPY{Z]"^_  ` #z! ggll?J?O$))K"89G"   #= >   #6 7   #> ?77<<C%tyy'>?'("   #= >   #= >77<<E%tyy'>?'(  - //K2s J-rrc| r | r td| ttt|} td|xsgD}| ttt|} t j |}t j||||||g|| | | | }|dkDr<||k7r0|r.tjd|tjd||||d|}ttjj|d}|jrY ||k7r)d d lm}d d lm}|| 5}t&r| s|r|j||||ng|Dcgc]!}tjj)|#c}t+d tjjt,d g||d| }t/}|D]E}tjj)|}|j1||vr||j2n|Gt5|}t7|||xsg|xsg|xsg|xsg|xsg||| | |  dddn|rtj9d||j;n|j=|rtjd|| r t?||StA||| Scc}w#1swYbxYw#|j;wxYw)Nz>`is_python_module` and `is_standalone` are mutually exclusive.c3$K|]}d|v yw)cudnnNr)rrrs r?rz_jit_compile..'s?aW\?s)build_argumentsrrrrXr'rz:The input conditions for extension module %s have changed.z2Bumping to version %s and re-building as %s_v%s..._vlockrr!)GeneratedFileCleanerrOr#T) r$r%r&r(ignoresr) show_progressr* clean_ctx) rkrrSrTrUrVrWrrrrr'zSNo modifications detected for re-loaded extension module %s, skipping build step...zLoading extension module %s...)!rrrrvrJIT_EXTENSION_VERSIONER get_versionbump_version_if_changedrSrrrErJrv try_acquirer/r"hipify.hipify_pythonrrwrpryrDr1r3r2r#_write_ninja_file_and_build_libraryr(releasewait_get_exec_path_import_module_from_library)rkrrSrTrUrVrWrrrrrXr'rP with_cudnn old_versionrabatonr"rrrr6r7rr8s r?rQrQsMYZZM734 ?=+>B??JM734 )55d;K%== %'8-I\]')#> G{ k !g KKTVZ [ KKLgW[]d er'# bggll?F; N OOS)N !5!5J MMOs7J:)!J. &J)0CJ.4!J:)J..J73J::K cXtrtdk\rdnd}td|StddS)N)rz hipcc.exez hipcc.batrr])rL ROCM_VERSIONry) hipcc_exes r?rrrs-#/6#9K{ ui00ug..rYc8tt}t|| tt t |} | tt t |} tjj| d}| rtjd|tjj| s/| rtjd| tj| dt||||||||| ||dd| | | rtjdt!| | d y) N build.ninjaEmitting ninja build file %s...Creating directory %s...TrsrJrrrrrrrrrrldflagslibrary_targetrrzCompiling objects...z%Error compiling objects for extension error_prefix)r5r7r+rrrvrrErJrvrSr(rOmakedirs_write_ninja_filer_run_ninja_build)rrrrrrrrrrrrrrrbuild_file_paths r?rrzs!H.x8M734 M734 ggll?MBO 6H 77>>/ *  LL3_ E Od3 )5)5  *+= >rYr'c tt} t| | tt t |} | tt t |} t|xsg| || }tjj|d} |rtjd| tjj|s/|rtjd|tj|dt| |||xsg|xsg|xsg|xsg|xsg| | |  |rtj!d|t#||d|d  y) NrrrTr) rJrkrrSrTrUrVrWrrr'zBuilding extension module %s...zError building extension ''r)r5r7r+rrrvr_prepare_ldflagsrErJrvrSr(rOr"_write_ninja_file_to_build_libraryrr)rkrrSrTrUrVrWrrrrr'rrs r?rrs/!H.x8M734 M734 $ M ggll?MBO 6H 77>>/ *  LL3_ E Od3'  !'R+1r+1r#)r/52# % 5t<1$q9;rYcj tjdjy#t$rYywxYw)zxReturn ``True`` if the `ninja `_ build system is available on the system, ``False`` otherwise.zninja --versionTF)rrrrrrYr?r4r4s8 1 7 7 9: s #& 22c.ts tdy)zRaise ``RuntimeError`` if `ninja `_ build system is not available on the system, does nothing otherwise.zFNinja is required to load C++ extensions (pip install ninja to get it)N)r4rrrYr?r5r5s  cdd rYc.trtjjtj d}|j d|r|j d|j d|r"|j d|j d|j d|j dt|s|j d |j d|n|j d t|j d |r|j trd nd |j d|r|j trdnd|j d|s|j d|r|j dt|r|rtjdtrn|j dtdd|j dt7|j dtjjtdd|Stsd}tjjt|s*tjjtdrd}|j d t||j dt6|j d tjjtd|Str.|j d td|j d|S)Nlibszc10.libz c10_cuda.libz torch_cpu.libztorch_cuda.libz"-INCLUDE:?warp_size@cuda@at@@YAHXZz torch.libz /LIBPATH:ztorch_python.libr.z-lc10z -lc10_hipz -lc10_cudaz -ltorch_cpuz -ltorch_hipz -ltorch_cudaz-ltorchz-ltorch_pythonz -Wl,-rpath,z%Detected CUDA files, patching ldflagsrrIz cudart.librJz-lcudartz -lamdhip64)rLrErJrvrbase_exec_prefixrrKrwrSrrxrrOry)rVrrr'python_lib_path extra_lib_dirs r?rr s'',,s';';VDY'    0_-   !1 2  !E F[)y(89:  !3 4  9_,=!> ? r.!123W%   0@l S]+   2B WY'  !1 2   ;~.>!? @  KK? @   9_UE-J,K!L M   .%$$yj%QV1W0X%YZ "#MGGNN?=#ABGGNN?5#9:!&  2om&D%E!F G   ,%$$r"'',,z7*K)L%MN   2oe&<%=!> ?   . rYrc||D]}d|vrd|vs gcStjgd}gd}||Dcgc]}|dz c}z}tjj dd}|r|dk(rg}t t jjD]}t jj|} t jjD cgc]F} d | vr@td jtjd | jd d H} } t!d| D} t#| | } | dd| d } | |vs|j%| t'|}|dxxdz cc<|st j(j+r?t j(j-r!t j(j/dk(rudj|} t0j3d| nM|j5dd}|j7D]\}}|j5||}|jd}g}|D]} | |vrt9d| d| jdd}|jd\}}||}|j%d|d|| j;dsm|j%d|d|t't=|Scc}wcc} w)ad Determine CUDA arch flags to use. For an arch, say "6.1", the added compile flag will be ``-gencode=arch=compute_61,code=sm_61``. For an added "+PTX", an additional ``-gencode=arch=compute_xx,code=compute_xx`` is added. See select_compute_arch.cmake for corresponding named and supported arches when building with CMake. NTORCH_EXTENSION_NAMEarch))z Kepler+Tesla3.7)Keplerz3.5+PTX)z Maxwell+Tegra5.3)Maxwellz 5.0;5.2+PTX)Pascalz 6.0;6.1+PTX)z Volta+Tegra7.2)Voltaz7.0+PTX)Turingz7.5+PTX)z Ampere+Tegra8.7)Amperez 8.0;8.6+PTX)Adaz8.9+PTX)Hopperz9.0+PTX)zBlackwell+Tegrar) Blackwellz10.0;10.3;12.0;12.1+PTX)z3.5rz5.0z5.2rz6.0z6.1z6.2z7.0rz7.5z8.0z8.6rz8.9z9.0z9.0az10.0z10.0arz11.0az10.3z10.3az12.0z12.0az12.1z12.1az+PTXTORCH_CUDA_ARCH_LISTnativesm_rz\d+rrc30K|]}|dz|dzfyw)rNr)rsms r?rz'_get_cuda_arch_flags..| s"N2B"Hb2g#6"Nsrrr;zTORCH_CUDA_ARCH_LIST is not set, using TORCH_CUDA_ARCH_LIST='%s' for visible GPU architectures. Set os.environ['TORCH_CUDA_ARCH_LIST'] to override.r<zUnknown CUDA arch (z) or GPU not supported+z-gencode=arch=compute_z ,code=sm_z,code=compute_) collections OrderedDictrErFrGrnrPrQ device_countget_device_capabilityrrrvrrrmaxminrsorted distributedrRis_initializedget_rankrSr(rrrendswithr1)rr named_archessupported_archesrvalid_arch_strings _arch_listrrq capabilityr supported_smmax_supported_sm arch_list_str named_archarchivalrrarminornums r?rhrh? s D%-~  **,L"2*AQ,RAQZ,RR  6=J x/ uzz..01 'A99!WXggll#>/ *  LL= O Od3 rYctjjd}|3|jr#|rtj d|t |S|rtjdy)NMAX_JOBSz6Using envvar MAX_JOBS (%s) as the number of workers...zqAllowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N))rErFrGisdigitrSr(rr)rmax_jobss r?_get_num_workersr s\zz~~j)H 0 0 2  LLQS[ \8}  K  rYvc_archc ddlm}|jj|S#t$rC ddlm}|j|cYS#t$rddlm}|j|cYcYSwxYwwxYw)Nr distutils) _msvccompiler)rV)rr#r$ _get_vc_envAttributeErrorsetuptools._distutils!setuptools._distutils.compilers.CrV)r r#r$rVs r?r%r% sl -(&&227;; - - ; ,,W5 5 - >##G, , - -s, # A/AA/ A+&A/*A++A/rc ddg}t|}||jdt|gtjj }t rd|vrddlm}|jj}t|}t|jD cic]\} } | j| } } } |jD]\} } | j} | | vs| | | <!| } tj j#tj$j#d} t'j(|t xrt*|r| nt&j,t&j.|d| ycc} } w#t&j0$rf}tj2\}}}|}t5|d r/|j6r#|d |j6j8t:z }t=||d}~wwxYw) Nninjarz-jrrr"rT)rstdoutrcwdcheckroutput: )rrjrrErFrrLrr#util get_platformPLAT_TO_VCVARSr%rupperrr+flushrrrunrwPIPErrrrr.rrr)rrrcommand num_workersrr# plat_name plat_speckrvc_envuk stdout_filenorrr messages r?rr soG"7+Kc+./0 **// C*#5(NN//1 "9- +6y+A+G+G+IJ41a!'')Q,JJIIK DAqBr  !+    1!1$+=$$ -K<  ( ( +lln 5! 5( # /ELL//1GHIJ JG7#* +s E5.BE;;G4A!G//G4ctrttjddj dvrgt dtjddj dD}|s0tdtjddtj d<tjj||tS)NPATHrrc3K|]I}tjj|xr$tjj|tKywr)rErJrOsamefilerK)rps r?rz!_get_exec_path..; s>  GGNN1  E"''"2"21n"E E sAA) rLrKrErirrrFrJrvEXEC_EXT) module_namerJtorch_lib_in_paths r?rr9 snBIIfb,A,G,G,LL YYvr*005  !$2#31RYYvr5J4K!LBJJv  77<< hZ8 99rYctjj||t}|rtj j ||}|Jtj j|}t|jtjjsJ|jj||Stjj||Sr)rErJrvLIB_EXTrhr0spec_from_file_locationmodule_from_specrzloaderabcLoader exec_modulerPops load_library)rFrJrXfilepathspecmodules r?rrD sww||D[M'";K|]}|jdyw)z-std=Nrrs r?rz5_write_ninja_file_to_build_library.. sGDtw/Grrdrfrrrr<rr:ctjjtjj|d}t |r r|d}|St |r r|d}|S|d}|S)Nrz.cuda.oz.sycl.oz.o)rErJrr`rvr)r file_nametargetrrs r?object_file_pathz<_write_ninja_file_to_build_library..object_file_path s|GG$$RWW%5%5k%BCAF  %)"{'*F  ; 'I!{'*F "{"%F rYz-undefined dynamic_lookupr)'rrErJrpr0rrrLrr.r/rwr&rr@r|r}rgrhrrrirrr,rrrrvr2rrrr SHARED_FLAGrrErIr)!rJrkrrSrTrUrVrWrrr'rro user_includessystem_includespython_include_pathrr?r cuda_flagsrcc_envrr1rrrr]rrrrrs! `` r?rrS sr.::TDJJL:L:2CD$DD2CD$DD.;>? 8WXWBwi.XX ]S'Bu{{7345SS O\Iekk'&:%;<\\ ,/,>&6"  ?"= \(*<~*MNQ[[  \#|n4J' 3J .):; ;J /; ;J + +JGJGG!!,/YYt_F!&/*<  11 (( ' 4*;7 (* | x 'DOPD4<<w7PKPhh{+ ,[99 !2!7!7!9"8"EE !% c c 188$8G8"r FG23  )#(CvcU^N #5%];DD<HL,YS\VQ,9s@O7O<PP;P &P PPPP$P)c  d}||}||}||}||}||}||}||}||}|| } t| t| k(sJt| dkDsJt}dg}|jd|| s|rYdtjvrtj d}nt r t}n tdd}|jd||s|rtrd nd }|jd |t r t|z}d d j|g}|jdd j|| rF|jdd j||jdd j||jdd j||rF|jdd j||jdd j||jdd j||jdd j| | Dcgc]!}tjj|#} }dg}tr7t rdnd}|jd|dt sE|jdn3|jd|jd|jd| rqdg}d }tjj =tj d"d#d$k7r$|jd|jdd%}|jd&|d'|rd(g}|jd)g}t#| | D]\}}t%|xr| }t'|xr|}|rd*} n|rd+} nd,} tr$|j)d-d.}|j)d-d.}|j)d d/}|j)d d/}|jd0|d1| d ||rstjjtjj+| dd2}!d3g}"|"jd4d0|!d5d j| g}#| |!gz } ngg}#}"|rstjjtjj+| dd6}$d7g}%|%jd8d0|$d9d j| g}&| |$gz } ngg}&}%| d:g}'trt-j.d;dgj0t2j5d<}(t|(d=k\r3tjj+|(dj)d-d.})n t7d>|'jd?|)d@n|'jdAd0| dBd j| g}*dC| g}+nggg}+}*}'|||g},| r|,j|r|,j|,|"|%|'||#|&|*|+gz },dDjdE|,D}-|-dFz }-t9||-y!cc}w)GakWrite a ninja file that does the desired compiling and linking. `path`: Where to write this file `cflags`: list of flags to pass to $cxx. Can be None. `post_cflags`: list of flags to append to the $cxx invocation. Can be None. `cuda_cflags`: list of flags to pass to $nvcc. Can be None. `cuda_post_cflags`: list of flags to append to the $nvcc invocation. Can be None. `cuda_dlink_post_cflags`: list of flags to append to the $nvcc device code link invocation. Can be None. `sycl_cflags`: list of flags to pass to SYCL compiler. Can be None. `sycl_post_cflags`: list of flags to append to the SYCL compiler invocation. Can be None. `sycl_dlink_post_cflags`: list of flags to append to the SYCL compiler device code link invocation. Can be None. e. `sources`: list of paths to source files `objects`: list of desired paths to objects, one per source. `ldflags`: list of flags to pass to linker. Can be None. `library_target`: Name of the output library. Can be None; in that case, we do no linking. `with_cuda`: If we should be compiling with CUDA. cP|gS|Dcgc]}|jc}Scc}wr)r)rrs r?sanitize_flagsz)_write_ninja_file..sanitize_flags s& =I-23TDJJL3 33s#rzninja_required_version = 1.3zcxx = PYTORCH_NVCCrrDznvcc = rrgzsycl = z cflags = r<zpost_cflags = zcuda_cflags = zcuda_post_cflags = zcuda_dlink_post_cflags = zsycl_cflags = zsycl_post_cflags = zsycl_dlink_post_cflags = z ldflags = z rule compilez$cxxrz command = z2 /showIncludes $cflags -c $in /Fo$out $post_cflagsz deps = msvczD command = $cxx -MMD -MF $out.d $cflags -c $in -o $out $post_cflagsz depfile = $out.dz deps = gcczrule cuda_compilerN*TORCH_EXTENSION_SKIP_NVCC_GEN_DEPENDENCIESrrz?--generate-dependencies-with-compile --dependency-output $out.dz command = $nvcc z. $cuda_cflags -c $in -o $out $cuda_post_cflagszrule sycl_compilezF command = $sycl $sycl_cflags -c -x c++ $in -o $out $sycl_post_cflags cuda_compile sycl_compiler:z$:z$ zbuild r/zdlink.ozrule cuda_devlinkz5 command = $nvcc $in -o $out $cuda_dlink_post_cflagsz: cuda_devlink z sycl_dlink.ozrule sycl_devlinkz5 command = $sycl $in -o $out $sycl_dlink_post_cflagsz: sycl_devlink z rule linkwherez rz'MSVC is required to load C++ extensionsz command = "z)/link.exe" $in /nologo $ldflags /out:$outz% command = $cxx $in $ldflags -o $outz: link zdefault z c3>K|]}dj|yw)rN)rv)rbs r?rz$_write_ninja_file.. s71$))A,7rr)rNr7rrErFrirwrrxrLr&rvrJrprPrarQziprvrrrKrrrrrrr).rJrrrrrrrrrrrrrrrfrconfigrDrQrro compile_ruler cuda_compile_rule nvcc_gendepssycl_compile_rulebuildr object_fileis_cuda_sourceis_sycl_sourcerulecuda_devlink_outcuda_devlink_rule cuda_devlinksycl_devlink_outsycl_devlink_rule sycl_devlink link_rulecl_pathscl_pathlinkdefaultblocksrs. r?rr sD4 F #F -K -K%&67+,BC -K%&67+,BCW%G w<3w< '' ' w#((;"7!89: ~chh{&;%<=> *3884D+E*FGH LL,SXX6L-M,NOP ~chh{&;%<=> *3884D+E*FGH LL,SXX6L-M,NOP LL:chhw/012299rwwt$9G9##L"2 =/*@ @     0 R T01N+01  ==   )bii8dfi.jnq.q  $ $%9 :  $ $^ 4]L   .\ ] _01   T V E$'$9C [&{3A &{3A  !D !DD %--c48K%--c48K!))#t4 !))#t4  vk]"TF!K=ABC 77<< (CYO01  !XY !1 2/#((7BSATUV $%%*,b<77<< (C^T01  !XY !1 2/#((7BSATUV $%%*,b<! M >z..040677=v?UWW\W\]cWd 8}!''//(1+6>>sDI"#LMM   }WI5^_ `   D E(0A/BCDn-./#%r24 e\ *F '( '(  "3Y|UacgipqqFkk777G tOGwU:s&Yclt tdtjjtg|S)z Join paths with CUDA_HOME, or raises an error if it CUDA_HOME is not set. This is basically a lazy way of raising an error for missing $CUDA_HOME only once we need to get any CUDA-specific path. zSCUDA_HOME environment variable is not set. Please set it to your CUDA install root.)rBrurErJrvrws r?rxrx rzrYrJcddg}tr|jdtjj |d|vS)NrNrTrUr)rwrrErJrrJ valid_exts r?rvrv s;I 77  D !! $ 11rYcPdg}tjj|d|vS)NrOr)rErJrrs r?rr s( I 77  D !! $ 11rY)r) NNNNNNFNNTFT)F)NNNNNNNNNFNNTTTFF)Trr)rrMrh importlib.abcrErr.rHrrrrrpathlibrrulogging getLoggerr?rSrPtorch._appdirs file_batonr_cpp_extension_versionerrtypingrrtyping_extensionsr torch.torch_versionr r setuptools.command.build_extr rrLrrrrIrE CLIB_PREFIXCLIB_EXTr^rJrp__file___HERErKrDrvrKrrrrr VersionRanger{r VersionMapr$__annotations__MINIMUM_CLANG_VERSIONr(__all__rr@rXrersryr}rrrrrrQ _is_compiledrar^r[rLrwrrrBrFrGrrr|rrrrrgr&rr|rrrrrrrr2rr7boolrrrr)r*r+r$r)r,r2r,r-r.r/r0r1r2rZr8rr6r3rQrrrr4r5rrhr}rRrr%rrrrrrxrvrrrYr?rs4       8 $ !8"(52 \\W $ << " "8 , << " "7 +&E6RbE 6U"f  !ggoobggooe45 k51&0R%U38_eCHo56 #|# $ !' * ' * ' * ' *  !: " "G , "G , "G , "G , "G , "G , "G ,#Z  ?$s), ?c ?#4#,#, +s + +s +$2 2D ca#(**"9"9"; @Q@QO X\ %.?5 !D&29J9J9V4^c == J):):)@)@)Ebq)IJJL"'**"9"9"; @R@RO Y] ZZ^^L ) IRZZ^^L-I !&!7!7!9O t %/BJJ/G$H!S G$/078939 /   -. %R$Ri$s)i' W W-S-T-`1c:>:>:>D>:>D>:>'+:>R$:;c:;:;:;D>:;D>:;:;)-:;ze 8vg$s)!4gS gT$s)!4S : s T c F d x}  - -c3h -3+c3+D3+3+PT3+l: H:>HVB %)B H +s +222 222rY