[PATCH] D92720: [HIP] unbundle bundled preprocessor output

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 11 07:24:46 PST 2020


yaxunl marked an inline comment as done.
yaxunl added a comment.

In D92720#2437621 <https://reviews.llvm.org/D92720#2437621>, @tra wrote:

> `-E` by default prints preprocessed output to stdout. CUDA will print preprocessed output from all subcompilations. What does HIP do in this case? Printing out the bundle is probably not what the user will expect.
> IMO preprocessed output is frequently used as a debugging tool, so it's important for users to be able to read it. Bundled output is rather cumbersome to deal with. It's possible to manually unbundle it, but the tool is not documented well and it's not particularly suitable for human use.
>
> I think we should preserve the long-established meaning of `-E` and keep its output as plain text.

Output of `-E` for HIP combined host/device compilation is a plain text. It has C++ comments inserted between preprocessor outputs for host and different GPU arch's. The C++ comments follow the format of clang-offload-bundler bundled text files therefore clang-offload-bundler is able to unbundle it.



================
Comment at: clang/lib/Driver/Driver.cpp:2523-2524
         // this input.
-        if (IA->getType() != types::TY_CUDA &&
-            IA->getType() != types::TY_HIP) {
+        if (IA->getType() != types::TY_CUDA && IA->getType() != types::TY_HIP &&
+            IA->getType() != types::TY_PP_HIP) {
           // The builder will ignore this input.
----------------
tra wrote:
> Nit: too many negations in the condition. `if (! (IA->getType() == types::TY_CUDA || IA->getType() == types::TY_HIP  || IA->getType() == types::TY_PP_HIP))` would be easier to understand, IMO.
> 
> 
done


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

https://reviews.llvm.org/D92720



More information about the cfe-commits mailing list