Skip to content
Closed
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
22 changes: 5 additions & 17 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4158,18 +4158,14 @@ class OffloadingActionBuilder final {
// supported GPUs. sm_20 code should work correctly, if
// suboptimally, on all newer GPUs.
if (GpuArchList.empty()) {
<<<<<<< HEAD
if (ToolChains.front()->getTriple().isSPIROrSPIRV())
GpuArchList.push_back(CudaArch::Generic);
else
=======
if (ToolChains.front()->getTriple().isSPIRV()) {
if (ToolChains.front()->getTriple().getVendor() == llvm::Triple::AMD)
GpuArchList.push_back(CudaArch::AMDGCNSPIRV);
else
GpuArchList.push_back(CudaArch::Generic);
} else {
>>>>>>> 9acb533c38be833ec1d8daa06e127a9de8f0a5ef
} else if (ToolChains.front()->getTriple().isSPIR()) {
Copy link
Contributor Author

@iagarwa iagarwa Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it was isSPIROrSPIRV for Genric.
But for spriv its already covered in else of above if case. So i just added for SPIR here.

GpuArchList.push_back(CudaArch::Generic);
} else {
GpuArchList.push_back(DefaultCudaArch);
}
}
Expand Down Expand Up @@ -10182,21 +10178,13 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
*this, Target, HostTC, Args, TargetDeviceOffloadKind);
break;
case Action::OFK_HIP: {
<<<<<<< HEAD
if (Target.getArch() == llvm::Triple::amdgcn &&
Target.getVendor() == llvm::Triple::AMD &&
Target.getOS() == llvm::Triple::AMDHSA)
TC = std::make_unique<toolchains::HIPAMDToolChain>(
*this, Target, HostTC, Args, TargetDeviceOffloadKind);
=======
if (((Target.getArch() == llvm::Triple::amdgcn ||
Target.getArch() == llvm::Triple::spirv64) &&
Target.getVendor() == llvm::Triple::AMD &&
Target.getOS() == llvm::Triple::AMDHSA) ||
!Args.hasArgNoClaim(options::OPT_offload_EQ))
TC = std::make_unique<toolchains::HIPAMDToolChain>(*this, Target,
HostTC, Args);
>>>>>>> 9acb533c38be833ec1d8daa06e127a9de8f0a5ef
TC = std::make_unique<toolchains::HIPAMDToolChain>(
*this, Target, HostTC, Args, TargetDeviceOffloadKind);
else if (Target.getArch() == llvm::Triple::spirv64 &&
Target.getVendor() == llvm::Triple::UnknownVendor &&
Target.getOS() == llvm::Triple::UnknownOS)
Expand Down
26 changes: 9 additions & 17 deletions clang/lib/Driver/ToolChains/HIPAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,13 @@ void HIPAMDToolChain::addClangTargetOptions(
CC1Args.push_back("-fapply-global-visibility-to-externs");
}

<<<<<<< HEAD
// For SPIR-V we embed the command-line into the generated binary, in order to
// retrieve it at JIT time and be able to do target specific compilation with
// options that match the user-supplied ones.
if (getTriple().isSPIRV() &&
!DriverArgs.hasArg(options::OPT_fembed_bitcode_marker))
CC1Args.push_back("-fembed-bitcode=marker");

if (DeviceOffloadingKind == Action::OFK_SYCL) {
toolchains::SYCLToolChain::AddSYCLIncludeArgs(getDriver(), DriverArgs,
CC1Args);
Expand Down Expand Up @@ -364,16 +370,6 @@ void HIPAMDToolChain::addClangTargetOptions(
}

for (auto BCFile : getDeviceLibs(DriverArgs, DeviceOffloadingKind)) {
=======
// For SPIR-V we embed the command-line into the generated binary, in order to
// retrieve it at JIT time and be able to do target specific compilation with
// options that match the user-supplied ones.
if (getTriple().isSPIRV() &&
!DriverArgs.hasArg(options::OPT_fembed_bitcode_marker))
CC1Args.push_back("-fembed-bitcode=marker");

for (auto BCFile : getDeviceLibs(DriverArgs)) {
>>>>>>> 9acb533c38be833ec1d8daa06e127a9de8f0a5ef
CC1Args.push_back(BCFile.ShouldInternalize ? "-mlink-builtin-bitcode"
: "-mlink-bitcode-file");
CC1Args.push_back(DriverArgs.MakeArgString(BCFile.Path));
Expand Down Expand Up @@ -407,14 +403,10 @@ HIPAMDToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args,
}

Tool *HIPAMDToolChain::buildLinker() const {
<<<<<<< HEAD
assert(getTriple().getArch() == llvm::Triple::amdgcn);
if (OK == Action::OFK_SYCL)
return new tools::AMDGCN::SYCLLinker(*this);
=======
assert(getTriple().getArch() == llvm::Triple::amdgcn ||
getTriple().getArch() == llvm::Triple::spirv64);
>>>>>>> 9acb533c38be833ec1d8daa06e127a9de8f0a5ef
if (OK == Action::OFK_SYCL)
return new tools::AMDGCN::SYCLLinker(*this);
return new tools::AMDGCN::Linker(*this);
}

Expand Down