Skip to content

Commit

Permalink
[OpenMP] Don't use bound architecture when checking cache on the host
Browse files Browse the repository at this point in the history
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.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D118858
  • Loading branch information
jhuber6 committed Feb 3, 2022
1 parent 36f32ff commit 9138d96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clang/lib/Driver/Driver.cpp
Expand Up @@ -4828,9 +4828,11 @@ InputInfoList Driver::BuildJobsForActionNoCache(

// 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);
Expand Down
2 changes: 2 additions & 0 deletions clang/test/Driver/openmp-offload-gpu.c
Expand Up @@ -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 \
Expand Down

0 comments on commit 9138d96

Please sign in to comment.