This is an archive of the discontinued LLVM Phabricator instance.

Add -fconvergent-functions flag
ClosedPublic

Authored by arsenm on Oct 27 2019, 6:07 PM.

Details

Reviewers
yaxunl
tra
jlebar
Summary

The CUDA builtin library is apparently compiled in C++ mode, so the
assumption of convergent needs to be made in a typically non-SPMD
language. The functions in the library should still be assumed
convergent. Currently they are not, which is potentially incorrect and
this happens to work after the library is linked.

This is in preparation for a change to convergent handling to allow
downstream users to start using the flag where necessary to avoid
disruption.

Diff Detail

Event Timeline

arsenm created this revision.Oct 27 2019, 6:07 PM

I'm confused about "The CUDA builtin library is apparently compiled in C++ mode". By...whom, and for what purposes?

No objections from me, this seems reasonable regardless, but I'd also like tra to weigh in, since it's been a while for me.

I'm confused about "The CUDA builtin library is apparently compiled in C++ mode". By...whom, and for what purposes?

No objections from me, this seems reasonable regardless, but I'd also like tra to weigh in, since it's been a while for me.

That's what the comment says in propagate-metadata.cu:

Build the bitcode library. This is not built in CUDA mode, otherwise it
might have incompatible attributes. This mirrors how libdevice is built.

tra accepted this revision.Oct 28 2019, 10:41 AM

LGTM.

The CUDA builtin library is apparently compiled in C++ mode, so the
assumption of convergent needs to be made in a typically non-SPMD
language.

I think the key here is that we sometimes may need to compile things for device without -x cuda and that changes the default assumption about convergence. This flag allows controlling the assumption explicitly without relying on input language.

This revision is now accepted and ready to land.Oct 28 2019, 10:41 AM