Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

jit/backend/x86/test/test_zrpy_vmprof.py::TestZVMprof::()::test_vmprof

self = <rpython.jit.backend.x86.test.test_zrpy_vmprof.TestZVMprof object at 0x000000000f1020c8>

    def test_vmprof(self):
        from rpython.rlib import rvmprof
    
        class MyCode:
            _vmprof_unique_id = 0
            _vmprof_weak_list = RWeakListMixin() ; _vmprof_weak_list.initialize()
            def __init__(self, name):
                self.name = name
    
        def get_name(code):
            return code.name
    
        code2 = MyCode("py:y:foo:4")
        rvmprof.register_code(code2, get_name)
    
        try:
            rvmprof.register_code_object_class(MyCode, get_name)
        except rvmprof.VMProfPlatformUnsupported as e:
            py.test.skip(str(e))
    
        def get_unique_id(code):
            return rvmprof.get_unique_id(code)
    
        driver = JitDriver(greens = ['code'], reds = ['i', 's', 'num'],
            is_recursive=True, get_unique_id=get_unique_id)
    
        @rvmprof.vmprof_execute_code("xcode13", lambda code, num: code)
        def main(code, num):
            return main_jitted(code, num)
    
        def main_jitted(code, num):
            s = 0
            i = 0
            while i < num:
                driver.jit_merge_point(code=code, i=i, s=s, num=num)
                s += (i << 1)
                if i % 3 == 0 and code is not code2:
                    main(code2, 100)
                i += 1
            return s
    
        tmpfilename = str(udir.join('test_rvmprof'))
    
        def f(num):
            rthread.get_ident() # register TLOFS_thread_ident
            code = MyCode("py:x:foo:3")
            rvmprof.register_code(code, get_name)
            fd = os.open(tmpfilename, os.O_WRONLY | os.O_CREAT, 0666)
            period = 0.0001
            rvmprof.enable(fd, period)
            res = main(code, num)
            #assert res == 499999500000
            rvmprof.disable()
            os.close(fd)
            return 0
    
        def check_vmprof_output():
            from vmprof import read_profile
            tmpfile = str(udir.join('test_rvmprof'))
            stats = read_profile(tmpfile)
            t = stats.get_tree()
            assert t.name == 'py:x:foo:3'
            assert len(t.children) == 1 # jit
    
>       self.meta_interp(f, [1000000], inline=True)

jit/backend/llsupport/test/zrpy_vmprof_test.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
jit/backend/test/support.py:73: in meta_interp
    warmrunnerdesc.finish()
jit/metainterp/warmspot.py:298: in finish
    self.annhelper.finish()
rtyper/annlowlevel.py:219: in finish
    self.finish_rtype()
rtyper/annlowlevel.py:254: in finish_rtype
    perform_normalizations(rtyper.annotator)
rtyper/normalizecalls.py:408: in perform_normalizations
    normalize_call_familes(annotator)
rtyper/normalizecalls.py:19: in normalize_call_familes
    normalize_calltable(annotator, callfamily)
rtyper/normalizecalls.py:33: in normalize_calltable
    raise_call_table_too_complex_error(callfamily, annotator)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

callfamily = <rpython.annotator.description.CallFamily object at 0x0000000014dd3de0>
annotator = <rpython.annotator.annrpython.RPythonAnnotator object at 0x000000000ebed050>

    def raise_call_table_too_complex_error(callfamily, annotator):
        msg = []
        items = callfamily.calltables.items()
        for i, (shape1, table1) in enumerate(items):
            for shape2, table2 in items[i + 1:]:
                if shape1 == shape2:
                    continue
                row1 = table1[0]
                row2 = table2[0]
                problematic_function_graphs = set(row1.values()).union(set(row2.values()))
                pfg = [str(graph) for graph in problematic_function_graphs]
                pfg.sort()
                msg.append("the following functions:")
                msg.append("    %s" % ("\n    ".join(pfg), ))
                msg.append("are called with inconsistent numbers of arguments")
                msg.append("(and/or the argument names are different, which is"
                           " not supported in this case)")
                if shape1[0] != shape2[0]:
                    msg.append("sometimes with %s arguments, sometimes with %s" % (shape1[0], shape2[0]))
                else:
                    pass # XXX better message in this case
                callers = []
                msg.append("the callers of these functions are:")
                for tag, (caller, callee) in annotator.translator.callgraph.iteritems():
                    if callee not in problematic_function_graphs:
                        continue
                    if str(caller) in callers:
                        continue
                    callers.append(str(caller))
                callers.sort()
                for caller in callers:
                    msg.append("    %s" % (caller, ))
>       raise TyperError("\n".join(msg))
E       TyperError: the following functions:
E           (rpython.jit.metainterp.optimizeopt.info:120)NonNullPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:336)InstancePtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:360)StructPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:379)AbstractRawPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:632)ArrayPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:716)ConstPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:83)PtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:862)FloatConstInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.intutils:1264)IntBound.make_guards
E           (rpython.jit.metainterp.optimizeopt.vstring:121)StrPtrInfo.make_guards
E       are called with inconsistent numbers of arguments
E       (and/or the argument names are different, which is not supported in this case)
E       the callers of these functions are:
E           (rpython.jit.metainterp.optimizeopt.info:336)InstancePtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.info:632)ArrayPtrInfo.make_guards
E           (rpython.jit.metainterp.optimizeopt.shortpreamble:382)AbstractShortPreambleBuilder.use_box
E           (rpython.jit.metainterp.optimizeopt.virtualstate:483)NotVirtualStateInfoInt._generate_guards_unkown
E           (rpython.jit.metainterp.optimizeopt.vstring:121)StrPtrInfo.make_guards

rtyper/normalizecalls.py:76: TyperError
---------- Captured stderr call ----------
[rtyper] specializing: 100 / 671 blocks   (14%)
[rtyper] specializing: 200 / 760 blocks   (26%)
[rtyper] specializing: 300 / 762 blocks   (39%)
[rtyper] specializing: 400 / 762 blocks   (52%)
[rtyper] specializing: 500 / 762 blocks   (65%)
[rtyper] specializing: 600 / 767 blocks   (78%)
[rtyper] specializing: 700 / 767 blocks   (91%)
[rtyper] -=- specialized 771 blocks -=-
[rtyper] -=- specialized 4 more blocks -=-
[rtyper] specializing: 800 / 1059 blocks   (75%)
[rtyper] specializing: 900 / 1059 blocks   (84%)
[rtyper] specializing: 1000 / 1059 blocks   (94%)
[rtyper] -=- specialized 284 more blocks -=-
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] -=- specialized 15 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
[backendopt:inlining] inlined 2 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 1 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[rtyper] specializing: 1100 / 1100 blocks   (100%)
[rtyper] -=- specialized 8 more blocks -=-
[jitcodewriter:info] making JitCodes...
[jitcodewriter:info] There are 4 JitCode instances.
[jitcodewriter:info] There are 12 -live- ops. Size of liveness is 22 bytes
[jitcodewriter] compute_bitstrings:
[jitcodewriter]   4 effectinfos:
[jitcodewriter]     0 descrs for arrays
[jitcodewriter]     0 descrs for fields
[jitcodewriter]     0 descrs for interiorfields
[jitcodewriter] -> 1 bitstrings, mean length 0.0, max length 0
 (somefailed=True in jit/backend/x86/test/test_zrpy_vmprof.py)
builder: rpython-linux-x86-64 build #814*
test: jit/backend/x86/test/test_zrpy_vmprof.py::TestZVMprof::()::test_vmprof