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

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

self = <rpython.jit.backend.aarch64.test.test_zrpy_vmprof.TestZVMprof object at 0x0000000c586f8368>

    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:75: in meta_interp
    return self._compile_and_run(t, entry_point, entry_point_graph, args)
jit/backend/test/support.py:134: in _compile_and_run
    stdout = cbuilder.cmdexec(" ".join([str(arg) for arg in args]))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <rpython.translator.c.genc.CStandaloneBuilder object at 0x0000000c6ad6a4f0>
args = '1000000', env = None, err = False, expect_crash = False
exe = local('/var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/usession-pypy-HEAD-29/testing_1/testing_1')

    def cmdexec(self, args='', env=None, err=False, expect_crash=False, exe=None):
        assert self._compiled
        if sys.platform == 'win32':
            #Prevent opening a dialog box
            import ctypes
            winapi = ctypes.windll.kernel32
            SetErrorMode = winapi.SetErrorMode
            SetErrorMode.argtypes=[ctypes.c_int]
    
            SEM_FAILCRITICALERRORS = 1
            SEM_NOGPFAULTERRORBOX  = 2
            SEM_NOOPENFILEERRORBOX = 0x8000
            flags = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX \
                    | SEM_NOOPENFILEERRORBOX
            #Since there is no GetErrorMode, do a double Set
            old_mode = SetErrorMode(flags)
            SetErrorMode(old_mode | flags)
        if env is None:
            envrepr = ''
        else:
            envrepr = ' [env=%r]' % (env,)
            env.update(os.environ)
        if exe is None:
            exe = self.executable_name
        log.cmdexec('%s %s%s' % (exe, args, envrepr))
        res = self.translator.platform.execute(exe, args, env=env)
        if sys.platform == 'win32':
            SetErrorMode(old_mode)
        if res.returncode != 0:
            if expect_crash:
                if type(expect_crash) is int and expect_crash != res.returncode:
                    raise Exception("Returned %d, but expected %d" % (
                        res.returncode, expect_crash))
                return res.out, res.err
            print(res.err, file=sys.stderr)
>           raise Exception("Returned %d" % (res.returncode,))
E           Exception: Returned -11

translator/c/genc.py:318: Exception
---------- Captured stdout call ----------
in get_rpath_flags, rel_libdirs is not fixed up ['/opt/homebrew/lib']
---------- 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 / 1006 blocks   (79%)
[rtyper] specializing: 900 / 1070 blocks   (84%)
[rtyper] specializing: 1000 / 1070 blocks   (93%)
[rtyper] -=- specialized 295 more blocks -=-
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 2 more blocks -=-
[rtyper] -=- specialized 6 more blocks -=-
[rtyper] specializing: 1100 / 1101 blocks   (99%)
[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] -=- 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
[rtyper] specializing: 1700 / 33542 blocks   (5%)
[rtyper] specializing: 3600 / 35819 blocks   (10%)
[rtyper] specializing: 6000 / 39536 blocks   (15%)
[rtyper] specializing: 8500 / 42103 blocks   (20%)
[rtyper] specializing: 10700 / 42447 blocks   (25%)
[rtyper] specializing: 12800 / 42447 blocks   (30%)
[rtyper] specializing: 14900 / 42457 blocks   (35%)
[rtyper] specializing: 17000 / 42457 blocks   (40%)
[rtyper] specializing: 19300 / 42796 blocks   (45%)
[rtyper] specializing: 23700 / 47283 blocks   (50%)
[rtyper] specializing: 26200 / 47473 blocks   (55%)
[rtyper] specializing: 28500 / 47494 blocks   (60%)
[rtyper] specializing: 30900 / 47494 blocks   (65%)
[rtyper] specializing: 32500 / 47494 blocks   (68%)
[rtyper] specializing: 34700 / 47494 blocks   (73%)
[rtyper] specializing: 37200 / 47593 blocks   (78%)
[rtyper] specializing: 39600 / 47593 blocks   (83%)
[rtyper] specializing: 41900 / 47593 blocks   (88%)
[rtyper] specializing: 44300 / 47593 blocks   (93%)
[rtyper] specializing: 46700 / 47593 blocks   (98%)
[rtyper] specializing: 47500 / 47595 blocks   (99%)
[rtyper] -=- specialized 46484 more blocks -=-
[rtyper] specializing: 47600 / 47621 blocks   (99%)
[rtyper] -=- specialized 26 more blocks -=-
[rtyper] -=- specialized 0 more blocks -=-
[rtyper] -=- specialized 25 more blocks -=-
[rtyper] specializing: 47700 / 50110 blocks   (95%)
[rtyper] -=- specialized 2527 more blocks -=-
[rtyper] specializing: 50200 / 50249 blocks   (99%)
[rtyper] -=- specialized 76 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
[backendopt:inlining] inlined 1644 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 35 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[rtyper] -=- specialized 17 more blocks -=-
[rtyper] -=- specialized 12 more blocks -=-
[rtyper] -=- specialized 5 more blocks -=-
[rtyper] -=- specialized 0 more blocks -=-
[c]     1000 nodes  [ array: 1118  framework rtti: 18  func: 191  group: 1  struct: 2354 ]
[c]     2000 nodes  [ array: 3118  framework rtti: 18  func: 191  group: 1  struct: 2354 ]
[c]     3000 nodes  [ array: 4189  framework rtti: 19  func: 264  group: 1  struct: 2377 ]
[c]     4000 nodes  [ array: 4189  framework rtti: 19  func: 264  group: 1  struct: 2377 ]
[c]     5000 nodes  [ array: 4189  framework rtti: 19  func: 264  group: 1  struct: 2377 ]
[c]     6000 nodes  [ array: 4189  framework rtti: 19  func: 264  group: 1  struct: 2377 ]
[c]     7000 nodes  [ array: 4265  framework rtti: 22  func: 402  group: 1  struct: 2456 ]
[c]     8000 nodes  [ array: 4475  framework rtti: 38  func: 878  group: 1  struct: 3075 ]
[c]     9000 nodes  [ array: 4766  framework rtti: 45  func: 1184  group: 1  struct: 3516 ]
[c]    10000 nodes  [ array: 4811  framework rtti: 77  func: 1591  group: 1  struct: 5322 ]
[c]    11000 nodes  [ array: 4811  framework rtti: 214  func: 1825  group: 1  struct: 5459 ]
[c]    12000 nodes  [ array: 4904  framework rtti: 284  func: 2092  group: 1  struct: 5690 ]
[c]    13000 nodes  [ array: 5118  framework rtti: 284  func: 2266  group: 1  struct: 5776 ]
[c]    14000 nodes  [ array: 5169  framework rtti: 293  func: 2781  group: 1  struct: 5973 ]
[c]    15000 nodes  [ array: 5225  framework rtti: 298  func: 3648  group: 1  struct: 6069 ]
[c]    16000 nodes  [ array: 5258  framework rtti: 302  func: 4349  group: 1  struct: 6183 ]
[c:database] GC transformer: finished helpers
[c]    17000 nodes  [ array: 5713  framework rtti: 316  func: 4441  group: 1  struct: 6937 ]
[c]    18000 nodes  [ array: 5773  framework rtti: 363  func: 5170  group: 1  struct: 7074 ]
[c]    19000 nodes  [ array: 5810  framework rtti: 375  func: 6402  group: 1  struct: 7950 ]
[c]    20000 nodes  [ array: 5828  framework rtti: 378  func: 8269  group: 1  struct: 7996 ]
[c]    21000 nodes  [ array: 5828  framework rtti: 378  func: 8310  group: 1  struct: 7997 ]
[c]    22000 nodes  [ array: 5828  framework rtti: 378  func: 8360  group: 1  struct: 7997 ]
[c]    23000 nodes  [ array: 5886  framework rtti: 391  func: 8682  group: 1  struct: 8149 ]
[c]    24000 nodes  [ array: 6021  framework rtti: 423  func: 9147  group: 1  struct: 8526 ]
[rtyper] specializing: 50300 / 50342 blocks   (99%)
[rtyper] -=- specialized 59 more blocks -=-
[backendopt:inlining] phase with threshold factor: 32.4
[backendopt:inlining] heuristic: rpython.translator.backendopt.inline.inlining_heuristic
[backendopt:inlining] inlined 4 callsites.
[backendopt:malloc] starting malloc removal
[backendopt:malloc] removed 16 simple mallocs in total
[backendopt:mergeifblocks] starting to merge if blocks
[c:database] GC transformer: finished tables
[gctransform:info] assigned 1190 typeids
[gctransform:info] added 24359 push/pop stack root instructions
[gctransform:info] inserted 601 write barrier calls
[gctransform:info] inserted 221 write_barrier_from_array calls
[gctransform:info] found 3 static roots
[c:database] Inlining GC helpers and postprocessing
[c]    24661 nodes  [ array: 6108  framework rtti: 455  func: 9413  group: 1  struct: 8684 ]
[c:database] Completed
[c:writing] structdef.h
[c:writing] forwarddecl.h
[c:writing] preimpl.h
[c:writing] data_rpython_flowspace.c
[c:writing] data_rpython_jit_backend.c
[c:writing] data_rpython_jit_backend_aarch64.c
[c:writing] data_rpython_jit_backend_arm.c
[c:writing] data_rpython_jit_backend_llsupport.c
[c:writing] data_rpython_jit_backend_llsupport_test.c
[c:writing] data_rpython_jit_codewriter.c
[c:writing] data_rpython_jit_metainterp.c
[c:writing] data_rpython_jit_metainterp_optimizeopt.c
[c:writing] data_rpython_memory_gc.c
[c:writing] data_rpython_memory_gctransform.c
[c:writing] data_rpython_rlib.c
[c:writing] data_rpython_rlib_rjitlog.c
[c:writing] data_rpython_rlib_rvmprof.c
[c:writing] data_rpython_rtyper.c
[c:writing] data_rpython_rtyper_lltypesystem.c
[c:writing] nonfuncnodes.c
[c:writing] data_rpython_jit_backend_aarch64_1.c
[c:writing] data_rpython_jit_backend_llsupport_1.c
[c:writing] data_rpython_jit_codewriter_1.c
[c:writing] data_rpython_jit_metainterp_1.c
[c:writing] data_rpython_memory_gc_1.c
[c:writing] data_rpython_rlib_1.c
[c:writing] data_rpython_rlib_rvmprof_1.c
[c:writing] data_rpython_rtyper_lltypesystem_1.c
[c:writing] implement.c
[c:writing] rpython_flowspace.c
[c:writing] rpython_jit_backend.c
[c:writing] rpython_jit_backend_aarch64.c
[c:writing] rpython_jit_backend_aarch64_1.c
[c:writing] rpython_jit_backend_arm.c
[c:writing] rpython_jit_backend_llsupport.c
[c:writing] rpython_jit_backend_llsupport_test.c
[c:writing] rpython_jit_codewriter.c
[c:writing] rpython_jit_metainterp.c
[c:writing] rpython_jit_metainterp_1.c
[c:writing] rpython_jit_metainterp_2.c
[c:writing] rpython_jit_metainterp_3.c
[c:writing] rpython_jit_metainterp_4.c
[c:writing] rpython_jit_metainterp_optimizeopt.c
[c:writing] rpython_jit_metainterp_optimizeopt_1.c
[c:writing] rpython_jit_metainterp_optimizeopt_2.c
[c:writing] rpython_jit_metainterp_optimizeopt_3.c
[c:writing] rpython_memory.c
[c:writing] rpython_memory_gc.c
[c:writing] rpython_memory_gctransform.c
[c:writing] rpython_rlib.c
[c:writing] rpython_rlib_rjitlog.c
[c:writing] rpython_rlib_rvmprof.c
[c:writing] rpython_rtyper.c
[c:writing] rpython_rtyper_lltypesystem.c
[c:writing] rpython_rtyper_lltypesystem_1.c
[c:writing] rpython_rtyper_lltypesystem_2.c
[c:writing] rpython_rtyper_lltypesystem_3.c
[c:writing] rpython_rtyper_lltypesystem_module.c
[c:writing] rpython_tool_algo.c
[c:writing] rpython_translator.c
[c:writing] rpython_translator_c.c
[platform:execute] make  in /var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/usession-pypy-HEAD-29/testing_1
---------- Test starting ---------- 
[c:cmdexec] /var/folders/df/djsxfhc17x95674wsm_g8s980000gn/T/usession-pypy-HEAD-29/testing_1/testing_1 1000000

 (somefailed=True in jit/backend/aarch64/test/test_zrpy_vmprof.py)
builder: rpython-macos-arm64 build #804*
test: jit/backend/aarch64/test/test_zrpy_vmprof.py::TestZVMprof::()::test_vmprof