This is an archive of the discontinued LLVM Phabricator instance.

[CUDA][HIP] Do not offload for -M
Needs RevisionPublic

Authored by yaxunl on May 25 2018, 8:23 AM.

Details

Summary

CUDA and HIP action builder currently tries to do offloading for -M, which causes dependency file
not generated.

This patch changes action builder so that only host compilation is performed to generate dependency
file.

This assumes that the header files do not depend on whether it is device compilation or host
compilation. This is not ideal, but at least let projects using -M compile.

Ideally, we should create an offloading action for host dependency file and device dependency file
and merge them to be one dependency file, which will be done in a separate patch.

Diff Detail

Event Timeline

yaxunl created this revision.May 25 2018, 8:23 AM
yaxunl edited the summary of this revision. (Show Details)
tra requested changes to this revision.Jun 5 2018, 5:31 PM

I'm not sure this is the right thing to do. What if user explicitly wants device-side dependencies and runs clang --cuda-device-only -M ? This patch makes it impossible.

I'd rather tell users that they have to explicitly provide *which* compilation they want to generate dependencies for. If they want them for the host, just pass along --cuda-host-only.

This revision now requires changes to proceed.Jun 5 2018, 5:31 PM
tra added a comment.Jun 5 2018, 5:35 PM

Just to make it clear, I'm not against making a sensible default choice, but rather want to make sure that it is possible to override it if the user needs to.