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

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 7 10:55:43 PST 2020


tra added a comment.

`-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.

Perhaps we need a flag telling the driver to bundle the outputs. Somthing like `-fhip-bundle-outputs`. I think it may be useful in other cases. E.g. what if we want so compile to assembly and then assemble to the object file. It's not that different from preprocess and compile you're trying to achieve here. This may be a more general solution.



================
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.
----------------
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.




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

https://reviews.llvm.org/D92720



More information about the cfe-commits mailing list