This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Adding mutex to guard lld::elf::link interface use
ClosedPublic

Authored by jerryyin on Sep 21 2020, 11:37 AM.

Details

Summary

check-mlir target run tests simultaneously with multiple threads. This caused multiple threads to invoke the lld::elf::link() interface at the same time. Since the interface does not have a thread-safe implementation, add a metex to prevent multi-threaded access.

I discovered this by looking the the failure stack trace. lld/ELF/symbolTable.cpp, SymbolTable::insert() hit into an assert with related to Epoch Trackers. The root cause is to due to there is no protection around the symMap (update) who is implemented by denseMap and is not thread safe.

Diff Detail

Event Timeline

jerryyin created this revision.Sep 21 2020, 11:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2020, 11:37 AM
jerryyin requested review of this revision.Sep 21 2020, 11:37 AM
jerryyin edited the summary of this revision. (Show Details)
whchung accepted this revision.Sep 21 2020, 11:41 AM
This revision is now accepted and ready to land.Sep 21 2020, 11:41 AM
This revision was landed with ongoing or failed builds.Sep 21 2020, 11:46 AM
This revision was automatically updated to reflect the committed changes.