[PATCH] D88730: [HIP] Fix default output file for -E

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 2 13:49:14 PDT 2020


tra added a comment.

LGTM.



================
Comment at: clang/test/Driver/hip-output-file-name.hip:13-15
+// RUN: %clang -### -E -target x86_64-linux-gnu \
+// RUN:   --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: 2>&1 | FileCheck -check-prefixes=DASH %s
----------------
yaxunl wrote:
> tra wrote:
> > What does it mean for `-E` to be used when we compile for host and multiple devices. I believe for CUDA clang errors out unless there's only one sub-compilation. What does HIP do when it's run with `-E -o -` ?
> > 
> > Looks like CUDA (and, maybe HIP, too) has a bug there. `-E` will run preprocess on all subcompilations. `-E -o -` will error out claiming that you can't use `-o` for multiple output files, even though `-###` shows the same `-o -` in all subcompilations in both cases.
> > 
> > 
> > 
> > 
> HIP will emit a clang-offload-bundler file in textual format. Clang is able to consume this file by unbundling it. I think ccache uses it to generate a hash to check if a file and its dependent header files have changed. Since this bundled file is in text format, ccache is able to use it to generate a hash which covers both host dependence and device dependence.
That would explain why I sometimes get a screenfull of noise when I do something like that with HIP. :-/
My expectation of `-E [-o -]` is that I get the text of preprocessed source. In this regard, CUDA's concatenate all preprocessd outputs is a bit better than HIPs' "here's a binary blob with preprocessed output inside".

This is a bit of a mess that's beyond the scope of this CL and should be dealt with separately.


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

https://reviews.llvm.org/D88730



More information about the cfe-commits mailing list