[PATCH] D101630: [HIP] Fix device-only compilation

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 10 11:50:08 PDT 2021


tra added a comment.

In D101630#2744861 <https://reviews.llvm.org/D101630#2744861>, @yaxunl wrote:

> [snip] it is the convention for compiler to have one output. 
> The compilation is like a pipeline. If we break it into stages, users would expect to use the output from one stage as input for the next stage. This is possible only if there is one output. 
> Also, when users do not want the output to be bundled, it is usually for debugging or special purposes. Users need to know the naming convention of the multiple outputs. I think it is justifiable to enable this by an option.

So in the end it's a trade-off between tools like ccache working out of the box vs additional option that would need to be used by users we do need specific intermediate output. 
Considering that intermediate output already need special handling, I'll agree that bundling by default is likely more useful.

Now the question is how to make it work without breaking existing users.

There are some tools that rely on clang `--cuda-host-only` and `--cuda-device-only` to work as if it was a regular C++ compilation. E.g. godbolt.org. 
It may be useful to do bundling **only** if we're dealing with multiple outputs. 
On the other hand, it may puzzle users why they get a bundle with `clang -S --offload_arch=X --offload_arch=Y` but plain text assembly with `clang -S --offload_arch=X`.

How about this:
If the user explicitly specified `--cuda-host-only` or `--cuda-device-only`, then by default only allow producing the natural output format, unless a bundled output is requested by an option. This should keep existing users working.
If the compilation is done without explicitly requested sub-compilation(s), then bundle the output by default. This should keep the GPU-unaware tools like ccache happy as they would always get the single output they expect.

WDYT?


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

https://reviews.llvm.org/D101630



More information about the cfe-commits mailing list