This is an archive of the discontinued LLVM Phabricator instance.

[Clang][NVPTX] Permit use of the alias attribute for NVPTX targets
ClosedPublic

Authored by jhuber6 on Jul 21 2023, 7:43 PM.

Details

Summary

The patch in D155211 added basic support for the .alias keyword in
PTX. This means we should be able to permit use of this in clang.

Diff Detail

Event Timeline

jhuber6 created this revision.Jul 21 2023, 7:43 PM
jhuber6 requested review of this revision.Jul 21 2023, 7:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2023, 7:43 PM
tra added inline comments.Jul 21 2023, 8:00 PM
clang/lib/Sema/SemaDeclAttr.cpp
1995

Allowing or not noreturn depends on the CUDA version we're building with (or rather on the PTX version we need for .noreturn instruction).

We would still need to issue the diagnostics if we're using CUDA older than 10.1.

tra added inline comments.Jul 21 2023, 8:03 PM
clang/lib/Sema/SemaDeclAttr.cpp
1995

Make it .alias and CUDA older than 10.0.

jhuber6 added inline comments.Jul 21 2023, 8:04 PM
clang/lib/Sema/SemaDeclAttr.cpp
1995

Do we do any similar diagnostics checks on the CUDA version? I thought that was more of a clang driver thing and we'd just let the backend handle the failure, since we can emit LLVM-IR that can be compiled irrespective of the CUDA version used to make it.

jhuber6 added inline comments.Jul 24 2023, 9:51 AM
clang/lib/Sema/SemaDeclAttr.cpp
1995

I checked and I don't think we pass in any CUDA version information to the -cc1 compiler. In this case if the user didn't have sufficient utilities it would simply fail in the backend or in PTX. We have semi-helpful messages there and it would be a good indicator to update CUDA. Is this fine given that?

jhuber6 updated this revision to Diff 547871.Aug 7 2023, 11:26 AM

Update to check the SDK version. Permit this if there is not passed in SDK version so that freestanding targets can still target CUDA and assume it's supported.

tra accepted this revision.Aug 7 2023, 11:47 AM
This revision is now accepted and ready to land.Aug 7 2023, 11:47 AM
This revision was landed with ongoing or failed builds.Aug 7 2023, 12:08 PM
This revision was automatically updated to reflect the committed changes.

9e99a4f0db0e21b68e9aab9ad6f32f34d42eb460 ? That is not yet built but looks promising. Thanks.

clang/lib/Sema/SemaDeclAttr.cpp