This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Add getTargetFeatures for the NVPTX toolchain
ClosedPublic

Authored by jhuber6 on Mar 19 2022, 4:49 PM.

Details

Summary

The NVPTX toolchain uses target features to determine the PTX version to
use. However this isn't exposed externally like most other toolchain
specific target features are. Add this functionaliy in preparation for
using it in for OpenMP offloading.

Diff Detail

Event Timeline

jhuber6 created this revision.Mar 19 2022, 4:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2022, 4:49 PM
Herald added a subscriber: asavonic. · View Herald Transcript
jhuber6 requested review of this revision.Mar 19 2022, 4:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 19 2022, 4:49 PM
jdoerfert added inline comments.Mar 21 2022, 7:46 AM
clang/lib/Driver/ToolChains/Cuda.cpp
635

Why std::vector. looks like this only returns 1 anyway, no?

jhuber6 added inline comments.Mar 21 2022, 7:58 AM
clang/lib/Driver/ToolChains/Cuda.cpp
635

That's how the rest of these functions are used in getTargetFeatures above. If I had a different method it wouldn't be easy to insert there.

This revision is now accepted and ready to land.Mar 21 2022, 8:18 AM
tra accepted this revision.Mar 21 2022, 12:00 PM
This revision was automatically updated to reflect the committed changes.
zixuan-wu added inline comments.
clang/lib/Driver/ToolChains/Cuda.cpp
648

It's same name as CudaVersion variable above, and it cause compile error. @jhuber6
Maybe the error depends on host compiler version so that it does not report immediately.

jhuber6 added inline comments.Mar 23 2022, 8:15 PM
clang/lib/Driver/ToolChains/Cuda.cpp
648

Fixed in rGd91223274145. Thanks for pointing that out, it worked fined locally.

zixuan-wu added inline comments.Mar 23 2022, 9:02 PM
clang/lib/Driver/ToolChains/Cuda.cpp
648

Thank you for your quick action.