Skip to content

[SYCL] Match explicit offload arch for AMD and NVIDIA #7028

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

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5806,7 +5806,15 @@ class OffloadingActionBuilder final {
}
SYCLTargetInfoList.emplace_back(*TCIt, nullptr);
} else {
SYCLTargetInfoList.emplace_back(*TCIt, GpuArchList[I].second);
const char *OffloadArch = nullptr;
for (auto &A : GpuArchList) {
if (TT == A.first) {
OffloadArch = A.second;
break;
}
}
assert(OffloadArch && "Failed to find matching arch.");
SYCLTargetInfoList.emplace_back(*TCIt, OffloadArch);
++I;
}
}
Expand Down
5 changes: 5 additions & 0 deletions clang/test/Driver/sycl.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,8 @@
// RUN: %clang_cl -### -fsycl -- %s 2>&1 | FileCheck %s --check-prefix=DEFAULT_STD

// DEFAULT_STD: "-sycl-std=2020"

/// Verify correct match of offload arch with multiple sycl targets
// RUN: %clang -fsycl -fsycl-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx908 -Xsycl-target-backend=nvptx64-nvidia-cuda --offload-arch=sm_86 -c -ccc-print-phases %s 2>&1 | FileCheck %s --check-prefix=MULTIPLE_TARGETS
// MULTIPLE_TARGETS: offload, "device-sycl (nvptx64-nvidia-cuda:sm_86)"
// MULTIPLE_TARGETS: offload, "device-sycl (amdgcn-amd-amdhsa:gfx908)"