This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Simplify GPU variant handling. NFC.
ClosedPublic

Authored by tra on Apr 7 2020, 11:25 AM.

Details

Summary

Instead of hardcoding individual GPU mappings in multiple functions, keep them
all in one table and use it to look up the mappings.

We also don't care about 'virtual' architecture much, so the API is trimmed down
down to a simpler GPU->Virtual arch name lookup.

Diff Detail

Event Timeline

tra created this revision.Apr 7 2020, 11:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2020, 11:25 AM
tra updated this revision to Diff 255756.Apr 7 2020, 11:44 AM
tra edited the summary of this revision. (Show Details)

Enumerate all known GPU variants during libdevice detection instead of
hardcoding them.

yaxunl added inline comments.Apr 7 2020, 11:48 AM
clang/lib/Basic/Cuda.cpp
61

Thanks for the efforts. Really appreciate this.

Can we separate this part to a def file and include it here and also in enum class CudaArch? Then we only need to maintain the def file.

Thanks.

tra marked an inline comment as done.Apr 7 2020, 12:04 PM
tra added inline comments.
clang/lib/Basic/Cuda.cpp
61

If we had similar per-GPU code in many places, then it would make a lot of sense.
At the moment I'm not sure it would be worth it -- I don't see any other code that would benefit, other than this file.

yaxunl accepted this revision.Apr 7 2020, 2:36 PM

LGTM. Thanks!

This revision is now accepted and ready to land.Apr 7 2020, 2:36 PM
This revision was automatically updated to reflect the committed changes.