This is an archive of the discontinued LLVM Phabricator instance.

[AIX] Add threadId and use nanosecond timestamp in sinit/sterm symbols
ClosedPublic

Authored by w2yehia on Aug 31 2023, 5:18 PM.

Details

Summary

With ThinLTO, when compiling SPEC 2017 omnetpp_r with -threads=4, two small modules can end up with the same timestamp in their sinit symbols when calculating time in seconds, creating duplicate definitions.

This patch uses a timestamp in nanoseconds.
Because the race can be between threads, embed the thread ID as well.

Diff Detail

Event Timeline

w2yehia created this revision.Aug 31 2023, 5:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 5:18 PM
w2yehia requested review of this revision.Aug 31 2023, 5:18 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2023, 5:18 PM
xingxue accepted this revision.EditedSep 2 2023, 8:38 AM

LGTM, provided the CI is clean.

This revision is now accepted and ready to land.Sep 2 2023, 8:38 AM

Repeating some offline discussion: fundamentally the issue is a race between backend threads in thinLTO, so we might want to consider adding a thread ID

w2yehia updated this revision to Diff 556105.Sep 6 2023, 8:41 PM
w2yehia retitled this revision from [AIX] Use microseconds for timestamp in sinit/sterm symbols to [AIX] Add threadId and use nanosecond timestamp in sinit/sterm symbols.
w2yehia edited the summary of this revision. (Show Details)

address code review comments,

daltenty accepted this revision.Sep 7 2023, 7:33 AM

LGTM, thanks!

xingxue accepted this revision.Sep 7 2023, 9:01 AM

Confirm LGTM.

This revision was landed with ongoing or failed builds.Sep 7 2023, 10:47 AM
This revision was automatically updated to reflect the committed changes.
lhames added a subscriber: lhames.Sep 7 2023, 1:50 PM

@w2yehia Looks like this broke https://green.lab.llvm.org/green/job/clang-stage1-RA/35559/. Could you please take a look?

@w2yehia Looks like this broke https://green.lab.llvm.org/green/job/clang-stage1-RA/35559/. Could you please take a look?

@lhames, checking

thakis added a subscriber: thakis.Sep 7 2023, 4:18 PM

This breaks building on Mac: http://45.33.8.238/macm1/68693/step_4.txt

Please take a look and revert for now if it takes a while to fix.