This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Don't use bound architecture when checking cache on the host
ClosedPublic

Authored by jhuber6 on Feb 2 2022, 4:11 PM.

Details

Summary

When we are creating jobs for the new driver we first check the cache to
see if the job was already created as a part of the offloading
toolchain. This would sometimes fail if the bound architecture was set
for the host during offloading. We want to ingore this because it is not
relevant for looking up host actions. Previously it was set on some
machines and would cause the cache lookup to fail.

Diff Detail

Event Timeline

jhuber6 created this revision.Feb 2 2022, 4:11 PM
jhuber6 requested review of this revision.Feb 2 2022, 4:11 PM
Herald added a project: Restricted Project. · View Herald Transcript

@thakis could you confirm that this works on your machine?

This revision is now accepted and ready to land.Feb 3 2022, 12:51 PM
This revision was landed with ongoing or failed builds.Feb 3 2022, 2:17 PM
This revision was automatically updated to reflect the committed changes.
thakis added a comment.Feb 3 2022, 2:39 PM

Looks like this breaks tests on Mac: http://45.33.8.238/macm1/27158/step_7.txt

Please take a look and revert for now if it takes a while to fix.

Looks like this breaks tests on Mac: http://45.33.8.238/macm1/27158/step_7.txt

Please take a look and revert for now if it takes a while to fix.

This fixed it on the mac I got to test it on, I'll revert and try to figure it out.

Looks like this breaks tests on Mac: http://45.33.8.238/macm1/27158/step_7.txt

Please take a look and revert for now if it takes a while to fix.

Can you do me a favor and run the command clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-new-driver -no-canonical-prefixes -ccc-print-bindings $HOME/Documents/code/llvm-project/clang/test/Driver/openmp-offload-gpu.c -o openmp-offload-gpu -fopenmp -fopenmp-targets=nvptx64 -fopenmp-new-driver -ccc-print-bindings

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 3bfddeefc7b2..cba9cecd7d5e 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4745,6 +4745,7 @@ InputInfoList Driver::BuildJobsForAction(
     Action::OffloadKind TargetDeviceOffloadKind) const {
   std::pair<const Action *, std::string> ActionTC = {
       A, GetTriplePlusArchString(TC, BoundArch, TargetDeviceOffloadKind)};
+  llvm::errs() << "Insert: " << A << " " << TC->getTriple().getTriple() << " " << BoundArch << " " << TargetDeviceOffloadKind << "\n";
   auto CachedResult = CachedResults.find(ActionTC);
   if (CachedResult != CachedResults.end()) {
     return CachedResult->second;
@@ -4831,6 +4832,7 @@ InputInfoList Driver::BuildJobsForActionNoCache(
     std::pair<const Action *, std::string> ActionTC = {
         OA->getHostDependence(),
         GetTriplePlusArchString(TC, BoundArch, TargetDeviceOffloadKind)};
+  llvm::errs() << "Check: " << A << " " << TC->getTriple().getTriple() << " " << BoundArch << " " << TargetDeviceOffloadKind << "\n";
     if (CachedResults.find(ActionTC) != CachedResults.end()) {
       InputInfoList Inputs = CachedResults[ActionTC];
       Inputs.append(OffloadDependencesInputInfo);