K i\ ,ddlZddlZddlZddlZddlZddlZddlmZmZddl m Z ddl m Z ddl mZddlmZe ddd Zej$j'eZej$j-ed ZGd d eZd ZdiefdZdZdZy)N) ASTSource make_backend) GPUTarget)GluonASTSource)create_function_from_signature)ircudad FileCheckc(eZdZfdZfdZxZS) MatchErrorc2t||||_yN)super__init__ module_str)selfmessager __class__s W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/triton/_filecheck.pyrzMatchError.__init__s !$c>t|d|jS)N )r__str__r)rrs rrzMatchError.__str__s!'/#$Bt&788r)__name__ __module__ __qualname__rr __classcell__)rs@rrrs%99rrctj5}tjj |d}t |d5}|j |dddtjj |d}t |d5}|j |ddd tjt|d|dgtj dddy#1swYxYw#1swYNxYw#tj$r+}|jjd}t|d}~wwxYw#1swYyxYw)Nmodulewexpectedz --input-filez--dump-input-context=50)stderrunicode_escape)tempfileTemporaryDirectoryospathjoinopenwrite subprocess check_outputfilecheck_pathSTDOUTCalledProcessErroroutputdecode ValueError) namercheck_templatetempdir temp_moduletemp temp_expectederrordecodeds r run_filecheckr=#s  $ $ &&'ggll7H5 +s # #t JJz " # Wj9 - % ' JJ~ & ' &  # # Mfg!(( *&& # # ' ',, &ll))*:;GW% % &&&sY-D4C4D4C'D4#.C3C$ D4'C0 ,D43D1&D,,D11D44D=c$d|vrt|}d|d<t|}t|j|j|}||i|\}}}|j |||||\}} } } |j rtnt} | || | | } tj}tj||j||j|}|j}| j|||||}|jsJ|S)Nsanitize_overflowF)dictrr signatureparams _pack_argsis_gluonrrrcontext load_dialectsget_codegen_implementationget_module_mapmake_irverify) kernel_fnargskwargstargetbackendbinder bound_argsspecializationoptionsrB constexprsattrs source_clssrcrF codegen_fns module_mapr!s r run_parserr[6s&(f&+"#6"G +F +1$*A&*A'J,5,@,@&R\^lnu,v)GY E#,#5#5#7YJ Y :u =CjjlGW '"44W=K'')J [[+z7 KF ==?? Mrct|tjjsJt j |j }| tdt|}td|j|y)Nz=kernel function must have a docstring with FileCheck template placeholder) isinstancetritonruntime JITFunctioninspect getsourcefnr4r[r= str_nodebug)rLr6 mlir_modules rrun_filecheck_testrgQsa i!;!; << <&&y||4NXYYY'K-!8!8!:NKrcBtjfd}|S)Nctyr)rg)rdsrtest_fnzfilecheck_test..test_fn]s 2r) functoolswraps)rdrjs` rfilecheck_testrm[s%__R Nr)rkr(rbr-r&r_triton.compilerrrtriton.backends.compilerr"triton.experimental.gluon._runtimertriton.runtime.jitrtriton._C.libtritonr stub_targetr)dirname__file__ triton_dirr*r/r4rr=r[rgrmr>rrrws  3.=="R( WW__X & j+699&& ""[6Lr