This is an archive of the discontinued LLVM Phabricator instance.

[OMPIRBuilder] Pass dependencies to createTask by value
ClosedPublic

Authored by psoni2628 on Jan 12 2023, 8:16 PM.

Details

Summary

This patch modifies OpenMPIRBuilder::createTask to accept its
Dependencies vector by value instead of by reference. This is
necessary because the PostOutlineCB lambda that uses this Dependencies
vector may outlive the original Dependencies vector.

Diff Detail

Event Timeline

psoni2628 created this revision.Jan 12 2023, 8:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2023, 8:16 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
psoni2628 requested review of this revision.Jan 12 2023, 8:16 PM
psoni2628 edited the summary of this revision. (Show Details)Jan 12 2023, 8:17 PM

Assuming this was not triggered because we never used Dependencies vector before and no other PostOutlineCB took an option (with a reference) like this.

Please add a test case which would fail with the old implementation but passes with the new one.

Assuming this was not triggered because we never used Dependencies vector before and no other PostOutlineCB took an option (with a reference) like this.

Yes that's right. There is no other PostOutlineCB that has a SmallVector being passed as an ArrayRef.

Please add a test case which would fail with the old implementation but passes with the new one.

I have adjusted the existing test case slightly to fail with the old implementation. There isn't really any point of keeping the old test case around because it is unrealistic. The original stack-allocated DependData should not be expected to still be in scope when the PostOutlineCB lambda is called.

psoni2628 edited the summary of this revision. (Show Details)Jan 17 2023, 10:54 AM
  • Modify test case slightly to fail with the old logic
This revision is now accepted and ready to land.Jan 19 2023, 8:04 AM
This revision was automatically updated to reflect the committed changes.