-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[Driver][HIP] Do not pass -dependency-file flag for HIP Device offloading #125646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Driver][HIP] Do not pass -dependency-file flag for HIP Device offloading #125646
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Aniket Lal (lalaniket8) ChangesWhen we launch hipcc with multiple offload architectures along with -MF dep_file flag, the clang compilation invocations for host and device offloads write to the same dep_file, and can lead to collision during file IO operations. This can typically happen during large workloads. This commit provides a fix to generate dep_file only in host compilation. Full diff: https://github.com/llvm/llvm-project/pull/125646.diff 1 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 9b5132c5625faa0..895fd0d7a180ee7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1013,21 +1013,23 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
ArgM = ArgMD;
if (ArgM) {
- // Determine the output location.
- const char *DepFile;
- if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
- DepFile = MF->getValue();
- C.addFailureResultFile(DepFile, &JA);
- } else if (Output.getType() == types::TY_Dependencies) {
- DepFile = Output.getFilename();
- } else if (!ArgMD) {
- DepFile = "-";
- } else {
- DepFile = getDependencyFileName(Args, Inputs);
- C.addFailureResultFile(DepFile, &JA);
+ if (!JA.isDeviceOffloading(Action::OFK_HIP)) {
+ // Determine the output location.
+ const char *DepFile;
+ if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
+ DepFile = MF->getValue();
+ C.addFailureResultFile(DepFile, &JA);
+ } else if (Output.getType() == types::TY_Dependencies) {
+ DepFile = Output.getFilename();
+ } else if (!ArgMD) {
+ DepFile = "-";
+ } else {
+ DepFile = getDependencyFileName(Args, Inputs);
+ C.addFailureResultFile(DepFile, &JA);
+ }
+ CmdArgs.push_back("-dependency-file");
+ CmdArgs.push_back(DepFile);
}
- CmdArgs.push_back("-dependency-file");
- CmdArgs.push_back(DepFile);
bool HasTarget = false;
for (const Arg *A : Args.filtered(options::OPT_MT, options::OPT_MQ)) {
|
need a lit test |
eec1f03
to
62d313a
Compare
|
1ee84f6
to
adb72d7
Compare
…ding When we launch hipcc with multiple offload architectures along with -MF dep_file flag, the clang compilation invocations for host and device offloads write to the same dep_file, and can lead to collision during file IO operations. This can typically happen during large workloads. This commit provides a fix to generate dep_file only in host compilation.
adb72d7
to
5c52e3a
Compare
@lalaniket8 Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/17735 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/14368 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/12013 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/11838 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/11613 Here is the relevant piece of the build log for the reference
|
…lation run line (#126488) This PR fixes the post merge check fails from PR #125646 Co-authored-by: anikelal <[email protected]>
… host compilation run line (#126488) This PR fixes the post merge check fails from PR llvm/llvm-project#125646 Co-authored-by: anikelal <[email protected]>
This patch still breaks the Solaris/sparcv9 buildbot. |
When comparing the
Looking closer, So expecting |
This patch breaks our toolchain builders as well with Failing bot link: https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-host-linux-x64/b8723335175993555921/overview |
@@ -0,0 +1,13 @@ | |||
// RUN: %clang -### -nogpuinc -nogpulib --offload-arch=gfx1030 --offload-arch=gfx1100 --offload-arch=gfx1101 -MD -MF tmp.d %s 2>&1 | FileCheck %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding -target x86_64-pc-linux-gnu
probably fix the buildbot failure
@@ -0,0 +1,13 @@ | |||
// RUN: %clang -### -nogpuinc -nogpulib --offload-arch=gfx1030 --offload-arch=gfx1100 --offload-arch=gfx1101 -MD -MF tmp.d %s 2>&1 | FileCheck %s | |||
|
|||
// CHECK: Build config: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is causing the test to fail on configurations that don't enable assertions or something else that would cause this line to be emitted.
@sharadhr I am planning to revert this change to unblock our builders. Hopefully @lalaniket8 will be able to chime in on your fix later in the week. |
@Prabhuk I'm not quite sure why I was mentioned here—which change are you referring to? |
This PR #125646 added this test and it was failing in Android's compiler and on my machine locally. I removed the "Build config" check and it passes now.
…ding (llvm#125646) When we launch hipcc with multiple offload architectures along with -MF dep_file flag, the clang compilation invocations for host and device offloads write to the same dep_file, and can lead to collision during file IO operations. This can typically happen during large workloads. This commit provides a fix to generate dep_file only in host compilation. --------- Co-authored-by: anikelal <[email protected]>
…lation run line (llvm#126488) This PR fixes the post merge check fails from PR llvm#125646 Co-authored-by: anikelal <[email protected]>
This PR llvm#125646 added this test and it was failing in Android's compiler and on my machine locally. I removed the "Build config" check and it passes now.
This PR llvm#125646 added this test and it was failing in Android's compiler and on my machine locally. I removed the "Build config" check and it passes now.
This PR llvm#125646 added this test and it was failing in Android's compiler and on my machine locally. I removed the "Build config" check and it passes now.
This PR llvm#125646 added this test and it was failing in Android's compiler and on my machine locally. I removed the "Build config" check and it passes now.
…ding (llvm#125646) When we launch hipcc with multiple offload architectures along with -MF dep_file flag, the clang compilation invocations for host and device offloads write to the same dep_file, and can lead to collision during file IO operations. This can typically happen during large workloads. This commit provides a fix to generate dep_file only in host compilation. --------- Co-authored-by: anikelal <[email protected]>
…lation run line (llvm#126488) This PR fixes the post merge check fails from PR llvm#125646 Co-authored-by: anikelal <[email protected]>
This PR llvm#125646 added this test and it was failing in Android's compiler and on my machine locally. I removed the "Build config" check and it passes now.
…ding (llvm#125646) When we launch hipcc with multiple offload architectures along with -MF dep_file flag, the clang compilation invocations for host and device offloads write to the same dep_file, and can lead to collision during file IO operations. This can typically happen during large workloads. This commit provides a fix to generate dep_file only in host compilation. --------- Co-authored-by: anikelal <[email protected]>
…lation run line (llvm#126488) This PR fixes the post merge check fails from PR llvm#125646 Co-authored-by: anikelal <[email protected]>
This PR llvm#125646 added this test and it was failing in Android's compiler and on my machine locally. I removed the "Build config" check and it passes now.
When we launch hipcc with multiple offload architectures along with -MF dep_file flag, the clang compilation invocations for host and device offloads write to the same dep_file, and can lead to collision during file IO operations. This can typically happen during large workloads. This commit provides a fix to generate dep_file only in host compilation.