This is an archive of the discontinued LLVM Phabricator instance.

Run ExecutionEngine/MCJIT/remote tests only if threads enabled
ClosedPublic

Authored by JOE1994 on Apr 7 2023, 11:50 AM.

Details

Summary

Using LLVM built with LLVM_ENABLE_ASSERTION=On & LLVM_ENABLE_THREADS=Off,
12 LIT tests under llvm/test/ExecutionEngine/MCJIT/remote/ fail (on x86_64
linux host) with the same error message (and same backtrace).

Error Message:

llvm-project/build/bin/lli-child-target error: this tool requires threads, but LLVM was built with LLVM_ENABLE_THREADS=Off

If running these tests require LLVM_ENABLE_THREADS=On, there's no point in
running them when using LLVM built with LLVM_ENABLE_THREADS=Off. This commit
updates the appropriate lit.local.cfg file so that these tests are only run
if LLVM_ENABLE_THREADS=On.

Diff Detail

Event Timeline

JOE1994 created this revision.Apr 7 2023, 11:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 11:50 AM
Herald added a subscriber: pengfei. · View Herald Transcript
JOE1994 requested review of this revision.Apr 7 2023, 11:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2023, 11:50 AM

git bisect led me to the following commit as where the tests began to fail (only when using LLVM built with LLVM_ENABLE_THREADS=Off):

commit 6498b0e991babe71e69ab02e1afa7f5535f2be0f
Author: Lang Hames <lhames@gmail.com>
Date:   Sun Sep 26 10:53:21 2021 +1000

    Reintroduce "[ORC] Introduce EPCGenericRTDyldMemoryManager."

    This reintroduces "[ORC] Introduce EPCGenericRTDyldMemoryManager."
    (bef55a2b47a938ef35cbd7b61a1e5fa74e68c9ed) and "[lli] Add ChildTarget dependence
    on OrcTargetProcess library." (7a219d801bf2c3006482cf3cbd3170b3b4ea2e1b) which were
    reverted in 99951a56842d8e4cd0706cd17a04f77b5d0f6dd0 due to bot failures.

    The root cause of the bot failures should be fixed by "[ORC] Fix uninitialized
    variable." (0371049277912afc201da721fa659ecef7ab7fba) and "[ORC] Wait for
    handleDisconnect to complete in SimpleRemoteEPC::disconnect."
    (320832cc9b7e7fea5fc8afbed75c34c4a43287ba).

Below is the error message & stacktrace output by LLVM (at commit 653a82e95257a7cd3f22c24e40d54459a6608429, Release build, LLVM_ENABLE_THREADS=Off) when running the tests on x86_64 Linux:
(some sensitive paths are removed)

lli: ~/llvm-project/llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp:23: virtual llvm::orc::SimpleRemoteEPC::~SimpleRemoteEPC(): Assertion `Disconnected && "Destroyed without disconnection"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: ~/llvm-project/build/bin/lli -jit-kind=mcjit -remote-mcjit -mcjit-remote-process=~/llvm-project/build/bin/lli-child-target -O0 -relocation-model=pic -code-model=small ~/llvm-project/llvm/test/ExecutionEngine/MCJIT/remote/test-ptr-reloc-sm-pic.ll
~/llvm-project/build/bin/lli-child-target error: this tool requires threads, but LLVM was built with LLVM_ENABLE_THREADS=Off
 #0 0x000000000248f7d7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (~/llvm-project/build/bin/lli+0x248f7d7)
 #1 0x000000000249021f SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f3e85ab68c0 __restore_rt (/lib64/libpthread.so.0+0x168c0)
 #3 0x00007f3e856f5cbb raise (/lib64/libc.so.6+0x4acbb)
 #4 0x00007f3e856f7355 abort (/lib64/libc.so.6+0x4c355)
 #5 0x00007f3e856edcba __assert_fail_base (/lib64/libc.so.6+0x42cba)
 #6 0x00007f3e856edd42 (/lib64/libc.so.6+0x42d42)
 #7 0x0000000001f21902 llvm::orc::SimpleRemoteEPC::~SimpleRemoteEPC() (~/llvm-project/build/bin/lli+0x1f21902)
 #8 0x0000000001f21929 llvm::orc::SimpleRemoteEPC::~SimpleRemoteEPC() (~/llvm-project/build/bin/lli+0x1f21929)
 #9 0x00000000011d31c5 llvm::Expected<std::unique_ptr<llvm::orc::SimpleRemoteEPC, std::default_delete<llvm::orc::SimpleRemoteEPC>>> llvm::orc::SimpleRemoteEPC::Create<llvm::orc::FDSimpleRemoteEPCTransport, int&, int&>(std::unique_ptr<llvm::orc::TaskDispatcher, std::default_delete<llvm::orc::TaskDispatcher>>, llvm::orc::SimpleRemoteEPC::Setup, int&, int&) lli.cpp:0:0
#10 0x00000000011d1ad3 launchRemote() (~/llvm-project/build/bin/lli+0x11d1ad3)
#11 0x00000000011c9bbe main (~/llvm-project/build/bin/lli+0x11c9bbe)
#12 0x00007f3e856e029d __libc_start_main (/lib64/libc.so.6+0x3529d)
#13 0x00000000011c49aa _start
lhames accepted this revision.Apr 9 2023, 10:38 AM

LGTM. Thanks @JOE1994!

Do you have commit access? If not then let me know what name and email you'd like my to use for attribution and I can commit on your behalf.

This revision is now accepted and ready to land.Apr 9 2023, 10:38 AM

Do you have commit access? If not then let me know what name and email you'd like my to use for attribution and I can commit on your behalf.

I dont have commit access yet.
Below are my name & email info.

Name : Youngsuk Kim
Email : youngsuk.kim@hpe.com

Thank you for reviewing!

...
Thank you for reviewing!

You're very welcome, thank you for the patch!

It turns out there was already a thread_support predicate in llvm/test/lit.cfg.py, so I've committed with a minor modification to use the existing predicate in 5950a0623753.