This is an archive of the discontinued LLVM Phabricator instance.

[CUDA, MemCpyOpt] Add a flag to force-enable memcpyopt and use it for CUDA.
ClosedPublic

Authored by tra on Jul 20 2021, 2:48 PM.

Details

Summary

Attempt to enable MemCpyOpt unconditionally in D104801 uncovered the fact that
there are users that do not expect LLVM to materialize memset intrinsic.

While other passes can do that, too, MemCpyOpt triggers it more frequently and breaks sanitizers and
some downstream users.

For now introduce a flag to force-enable the flag and opt-in only CUDA
compilation with NVPTX back-end.

Diff Detail

Event Timeline

tra created this revision.Jul 20 2021, 2:48 PM
tra requested review of this revision.Jul 20 2021, 2:48 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 20 2021, 2:48 PM
tra updated this revision to Diff 360293.Jul 20 2021, 3:15 PM
tra edited the summary of this revision. (Show Details)

Fixed the option name.

nikic added a comment.Jul 25 2021, 9:07 AM

Would the variant of the original patch at D106769 be sufficient for your purposes? Or are you also interested in the optimizations that introduce new memset/memcpy?

tra added a comment.Jul 26 2021, 10:30 AM

Would the variant of the original patch at D106769 be sufficient for your purposes? Or are you also interested in the optimizations that introduce new memset/memcpy?

The specific issue I was looking to fix does need memcpy->memset transformation, so I would still need a way to bypass libcall availability checks.

tra updated this revision to Diff 364653.Aug 5 2021, 4:46 PM

Updated post D106769

tra added a comment.Aug 5 2021, 4:48 PM

I've updated the patch and added a test to verify that the knob does work as expected. Please take a look.

asbirlea accepted this revision.Aug 6 2021, 12:37 AM
asbirlea added a subscriber: asbirlea.

lgtm.

This revision is now accepted and ready to land.Aug 6 2021, 12:37 AM
tra updated this revision to Diff 364847.Aug 6 2021, 11:10 AM

rebase to HEAD.

This revision was landed with ongoing or failed builds.Aug 6 2021, 11:22 AM
This revision was automatically updated to reflect the committed changes.