jhuber6 created this revision. jhuber6 added a reviewer: thakis. Herald added subscribers: guansong, yaxunl. jhuber6 requested review of this revision. Herald added a reviewer: jdoerfert. Herald added subscribers: cfe-commits, sstefan1. Herald added a project: clang.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D118858 Files: clang/lib/Driver/Driver.cpp clang/test/Driver/openmp-offload-gpu.c Index: clang/test/Driver/openmp-offload-gpu.c =================================================================== --- clang/test/Driver/openmp-offload-gpu.c +++ clang/test/Driver/openmp-offload-gpu.c @@ -358,6 +358,8 @@ // NEW_DRIVER: "[[HOST_TRIPLE:.+]]" - "clang", inputs: ["[[HOST_INPUT:.+]]"], output: "[[HOST_BC:.+]]" // NEW_DRIVER: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[DEVICE_INPUT:.+]]", "[[HOST_BC]]"], output: "[[DEVICE_ASM:.+]]" // NEW_DRIVER: "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[DEVICE_ASM]]"], output: "[[DEVICE_OBJ:.+]]" +// NEW_DRIVER: "[[HOST_TRIPLE:.+]]" - "clang", inputs: ["[[HOST_BC]]", "[[DEVICE_OBJ]]"], output: "[[HOST_OBJ:.+]]" +// NEW_DRIVER: "[[HOST_TRIPLE:.+]]" - "[[LINKER:.+]]", inputs: ["[[HOST_OBJ]]"], output: "openmp-offload-gpu" // RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvida-cuda -march=sm_70 \ // RUN: --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-new-nvptx-test.bc \ Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -4828,9 +4828,11 @@ // We may have already built this action as a part of the offloading // toolchain, return the cached input if so. + StringRef Arch = + (TargetDeviceOffloadKind == Action::OFK_Host) ? StringRef() : BoundArch; std::pair<const Action *, std::string> ActionTC = { OA->getHostDependence(), - GetTriplePlusArchString(TC, BoundArch, TargetDeviceOffloadKind)}; + GetTriplePlusArchString(TC, Arch, TargetDeviceOffloadKind)}; if (CachedResults.find(ActionTC) != CachedResults.end()) { InputInfoList Inputs = CachedResults[ActionTC]; Inputs.append(OffloadDependencesInputInfo);
Index: clang/test/Driver/openmp-offload-gpu.c =================================================================== --- clang/test/Driver/openmp-offload-gpu.c +++ clang/test/Driver/openmp-offload-gpu.c @@ -358,6 +358,8 @@ // NEW_DRIVER: "[[HOST_TRIPLE:.+]]" - "clang", inputs: ["[[HOST_INPUT:.+]]"], output: "[[HOST_BC:.+]]" // NEW_DRIVER: "nvptx64-nvidia-cuda" - "clang", inputs: ["[[DEVICE_INPUT:.+]]", "[[HOST_BC]]"], output: "[[DEVICE_ASM:.+]]" // NEW_DRIVER: "nvptx64-nvidia-cuda" - "NVPTX::Assembler", inputs: ["[[DEVICE_ASM]]"], output: "[[DEVICE_OBJ:.+]]" +// NEW_DRIVER: "[[HOST_TRIPLE:.+]]" - "clang", inputs: ["[[HOST_BC]]", "[[DEVICE_OBJ]]"], output: "[[HOST_OBJ:.+]]" +// NEW_DRIVER: "[[HOST_TRIPLE:.+]]" - "[[LINKER:.+]]", inputs: ["[[HOST_OBJ]]"], output: "openmp-offload-gpu" // RUN: %clang -### -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-target=nvptx64-nvida-cuda -march=sm_70 \ // RUN: --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-new-nvptx-test.bc \ Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -4828,9 +4828,11 @@ // We may have already built this action as a part of the offloading // toolchain, return the cached input if so. + StringRef Arch = + (TargetDeviceOffloadKind == Action::OFK_Host) ? StringRef() : BoundArch; std::pair<const Action *, std::string> ActionTC = { OA->getHostDependence(), - GetTriplePlusArchString(TC, BoundArch, TargetDeviceOffloadKind)}; + GetTriplePlusArchString(TC, Arch, TargetDeviceOffloadKind)}; if (CachedResults.find(ActionTC) != CachedResults.end()) { InputInfoList Inputs = CachedResults[ActionTC]; Inputs.append(OffloadDependencesInputInfo);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits