[PATCH] D156014: [Clang][NVPTX] Permit use of the alias attribute for NVPTX targets

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 7 10:43:57 PDT 2023


tra added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1995
   }
-  if (S.Context.getTargetInfo().getTriple().isNVPTX()) {
-    S.Diag(AL.getLoc(), diag::err_alias_not_supported_on_nvptx);
----------------
jhuber6 wrote:
> jhuber6 wrote:
> > tra wrote:
> > > tra wrote:
> > > > 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.
> > > > 
> > > Make it `.alias` and `CUDA older than 10.0`.
> > 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.
> 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?
We do pass it via `-target-sdk-version=...` https://github.com/llvm/llvm-project/blob/1b74459df8a6d960f7387f0c8379047e42811f58/clang/lib/Driver/ToolChains/Clang.cpp#L4707

And then check with `getSDKVersion`. E.g. https://github.com/llvm/llvm-project/blob/1b74459df8a6d960f7387f0c8379047e42811f58/clang/lib/CodeGen/CGCUDANV.cpp#L317



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156014/new/

https://reviews.llvm.org/D156014



More information about the cfe-commits mailing list