[PATCH] D100609: [Offload][OpenMP][CUDA] Allow fembed-bitcode for device offload
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 16 11:23:55 PDT 2021
tra requested changes to this revision.
tra added inline comments.
This revision now requires changes to proceed.
================
Comment at: clang/test/Driver/embed-bitcode-nvptx.cu:1
+// RUN: %clang -Xclang -triple -Xclang nvptx64 -S -Xclang -target-feature -Xclang +ptx70 -fembed-bitcode=all --cuda-device-only -nocudalib -nocudainc %s -o - | FileCheck %s
+// REQUIRES: nvptx-registered-target
----------------
jdoerfert wrote:
> tra wrote:
> > This command line looks extremely odd to me.
> > If you are compiling with `--cuda-device-only`, then clang should've already set the right triple and the features.
> >
> > Could you tell me more about what is the intent of the compilation and why you use this particular set of options?
> > I.e. why not just do `clang -x cuda --offload-arch=sm_70 --cuda-device-only -nocudalib -nocudainc`.
> >
> > Could you tell me more about what is the intent of the compilation and why you use this particular set of options?
>
> because I never compiled cuda really ;)
>
> I'll go with your options.
Something still does not add up.
AFAICT, the real problem is that that we're not adding `-target-cpu`, but rather that `-fembed-bitcode=all` splits `-S` compilation into two phases -- source-to-bitcode (this part gets all the right command line options and compiles fine) and `IR -> PTX` compilation which does end up only with the subset of the options and ends up failing because the intrinsics are not enabled.
I think what we want to do in this case is to prevent splitting GPU-side compilation. Adding a '-target-gpu' to the `IR->PTX` subcompilation may make things work in this case, but it does not really fix the root cause. E.g. we should also pass through the features set by the driver and, possibly, other options to keep both source->IR and IR->PTX compilations in sync.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100609/new/
https://reviews.llvm.org/D100609
More information about the cfe-commits
mailing list