[PATCH] D150136: [Clang] Change default triple to LLVM_HOST_TRIPLE for the CUDA toolchain

2023-05-08 Thread Joseph Huber via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc2c917f7f668: [Clang] Change default triple to 
LLVM_HOST_TRIPLE for the CUDA toolchain (authored by jhuber6).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150136

Files:
  clang/lib/Driver/ToolChains/Cuda.cpp


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -711,8 +711,7 @@
 /// system's default triple if not provided.
 NVPTXToolChain::NVPTXToolChain(const Driver , const llvm::Triple ,
const ArgList )
-: NVPTXToolChain(D, Triple,
- llvm::Triple(llvm::sys::getDefaultTargetTriple()), Args,
+: NVPTXToolChain(D, Triple, llvm::Triple(LLVM_HOST_TRIPLE), Args,
  /*Freestanding=*/true) {}
 
 llvm::opt::DerivedArgList *


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -711,8 +711,7 @@
 /// system's default triple if not provided.
 NVPTXToolChain::NVPTXToolChain(const Driver , const llvm::Triple ,
const ArgList )
-: NVPTXToolChain(D, Triple,
- llvm::Triple(llvm::sys::getDefaultTargetTriple()), Args,
+: NVPTXToolChain(D, Triple, llvm::Triple(LLVM_HOST_TRIPLE), Args,
  /*Freestanding=*/true) {}
 
 llvm::opt::DerivedArgList *
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150136: [Clang] Change default triple to LLVM_HOST_TRIPLE for the CUDA toolchain

2023-05-08 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

> right now all it's used for is HostTriple.isOSWindows()

OK.

In that case we may want to rename the parameter to `BuildHostTriple` to make 
it clear which host we have in mind.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150136

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150136: [Clang] Change default triple to LLVM_HOST_TRIPLE for the CUDA toolchain

2023-05-08 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 added a comment.

In D150136#4327570 , @tra wrote:

> The change may be an improvement, but we may still have a potential issue 
> here.
>
> E.g. ideally we may want to be able to cross-compile a CUDA app on a powerpc 
> or ARM build host targeting NVIDIA GPU on a x86 host. So, the compilation 
> tools would need to be found for the powerpc/arm host, but the the pair of 
> triples used during compilation would have to be x86 and nvptx.

So, this triple is only used for locating the CUDA library itself. In that case 
it's generally assumed that it will match whatever file structure the host 
computer is using. Specifically, right now all it's used for is 
`HostTriple.isOSWindows()`.

> In this situation the LLVM_HOST_TRIPLE would not be the right triple at all. 
> Does OpenMP currently handle the cross-compilation scenario above?

I don't think anyone's tried OpenMP with cross compilation. Most likely because 
it's only supported on Linux currently. I actually don't know what would happen 
if you tried.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150136

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150136: [Clang] Change default triple to LLVM_HOST_TRIPLE for the CUDA toolchain

2023-05-08 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

The change may be an improvement, but we may still have a potential issue here.

E.g. ideally we may want to be able to cross-compile a CUDA app on a powerpc or 
ARM build host targeting NVIDIA GPU on a x86 host. So, the compilation tools 
would need to be found for the powerpc/arm host, but the the pair of triples 
used during compilation would have to be x86 and nvptx.

In this situation the LLVM_HOST_TRIPLE would not be the right triple at all. 
Does OpenMP currently handle the cross-compilation scenario above?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150136

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D150136: [Clang] Change default triple to LLVM_HOST_TRIPLE for the CUDA toolchain

2023-05-08 Thread Joseph Huber via Phabricator via cfe-commits
jhuber6 created this revision.
jhuber6 added reviewers: tra, yaxunl.
Herald added a subscriber: mattd.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

When cross-compiling NVPTX we use the triple to indicate which paths to
search for the CUDA toolchain. Currently this uses the default target
triple. This might not be exactly correct, as this is the default triple
used to compile binaries, not the host system. We want the host triple
because it indicates which folders should hold CUDA.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150136

Files:
  clang/lib/Driver/ToolChains/Cuda.cpp


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -711,8 +711,7 @@
 /// system's default triple if not provided.
 NVPTXToolChain::NVPTXToolChain(const Driver , const llvm::Triple ,
const ArgList )
-: NVPTXToolChain(D, Triple,
- llvm::Triple(llvm::sys::getDefaultTargetTriple()), Args,
+: NVPTXToolChain(D, Triple, llvm::Triple(LLVM_HOST_TRIPLE), Args,
  /*Freestanding=*/true) {}
 
 llvm::opt::DerivedArgList *


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -711,8 +711,7 @@
 /// system's default triple if not provided.
 NVPTXToolChain::NVPTXToolChain(const Driver , const llvm::Triple ,
const ArgList )
-: NVPTXToolChain(D, Triple,
- llvm::Triple(llvm::sys::getDefaultTargetTriple()), Args,
+: NVPTXToolChain(D, Triple, llvm::Triple(LLVM_HOST_TRIPLE), Args,
  /*Freestanding=*/true) {}
 
 llvm::opt::DerivedArgList *
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits