@@ -720,46 +720,21 @@ llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12>
720
720
amdgpu::dlr::getCommonDeviceLibNames (
721
721
const llvm::opt::ArgList &DriverArgs, const SanitizerArgs &SanArgs,
722
722
const Driver &D, const std::string &GPUArch, bool isOpenMP,
723
- const RocmInstallationDetector &RocmInstallation) {
723
+ const RocmInstallationDetector &RocmInstallation,
724
+ const clang::driver::Action::OffloadKind DeviceOffloadingKind) {
724
725
auto Kind = llvm::AMDGPU::parseArchAMDGCN (GPUArch);
725
726
const StringRef CanonArch = llvm::AMDGPU::getArchNameAMDGCN (Kind);
726
727
727
728
StringRef LibDeviceFile = RocmInstallation.getLibDeviceFile (CanonArch);
728
729
auto ABIVer = DeviceLibABIVersion::fromCodeObjectVersion (
729
730
getAMDGPUCodeObjectVersion (D, DriverArgs));
730
- bool noGPULib = DriverArgs.hasArg (options::OPT_offloadlib);
731
- if (!RocmInstallation.checkCommonBitcodeLibs (CanonArch, LibDeviceFile, ABIVer,
732
- noGPULib))
731
+ if (!RocmInstallation.checkCommonBitcodeLibs (CanonArch, LibDeviceFile,
732
+ ABIVer))
733
733
return {};
734
-
735
- // If --hip-device-lib is not set, add the default bitcode libraries.
736
- // TODO: There are way too many flags that change this. Do we need to check
737
- // them all?
738
- bool DAZ = DriverArgs.hasFlag (
739
- options::OPT_fgpu_flush_denormals_to_zero,
740
- options::OPT_fno_gpu_flush_denormals_to_zero,
741
- toolchains::AMDGPUToolChain::getDefaultDenormsAreZeroForTarget (Kind));
742
- bool FiniteOnly = DriverArgs.hasFlag (
743
- options::OPT_ffinite_math_only, options::OPT_fno_finite_math_only, false );
744
- bool UnsafeMathOpt =
745
- DriverArgs.hasFlag (options::OPT_funsafe_math_optimizations,
746
- options::OPT_fno_unsafe_math_optimizations, false );
747
- bool FastRelaxedMath = DriverArgs.hasFlag (options::OPT_ffast_math,
748
- options::OPT_fno_fast_math, false );
749
- bool CorrectSqrt = DriverArgs.hasFlag (
750
- options::OPT_fhip_fp32_correctly_rounded_divide_sqrt,
751
- options::OPT_fno_hip_fp32_correctly_rounded_divide_sqrt, true );
752
- bool Wave64 = toolchains::AMDGPUToolChain::isWave64 (DriverArgs, Kind);
753
-
754
- // GPU Sanitizer currently only supports ASan and is enabled through host
755
- // ASan.
756
- bool GPUSan = DriverArgs.hasFlag (options::OPT_fgpu_sanitize,
757
- options::OPT_fno_gpu_sanitize, true ) &&
758
- SanArgs.needsAsanRt ();
759
-
734
+
760
735
return RocmInstallation.getCommonBitcodeLibs (
761
- DriverArgs, LibDeviceFile, Wave64, DAZ, FiniteOnly, UnsafeMathOpt ,
762
- FastRelaxedMath, CorrectSqrt, ABIVer, GPUSan, isOpenMP );
736
+ DriverArgs, LibDeviceFile, GPUArch, DeviceOffloadingKind ,
737
+ SanArgs. needsAsanRt () );
763
738
}
764
739
765
740
// / AMDGPU Toolchain
@@ -1001,9 +976,8 @@ void ROCMToolChain::addClangTargetOptions(
1001
976
StringRef LibDeviceFile = RocmInstallation->getLibDeviceFile (CanonArch);
1002
977
auto ABIVer = DeviceLibABIVersion::fromCodeObjectVersion (
1003
978
getAMDGPUCodeObjectVersion (getDriver (), DriverArgs));
1004
- bool noGPULib = DriverArgs.hasArg (options::OPT_offloadlib);
1005
979
if (!RocmInstallation->checkCommonBitcodeLibs (CanonArch, LibDeviceFile,
1006
- ABIVer, noGPULib ))
980
+ ABIVer))
1007
981
return ;
1008
982
1009
983
// Add the OpenCL specific bitcode library.
@@ -1026,15 +1000,13 @@ void ROCMToolChain::addClangTargetOptions(
1026
1000
1027
1001
bool RocmInstallationDetector::checkCommonBitcodeLibs (
1028
1002
StringRef GPUArch, StringRef LibDeviceFile,
1029
- DeviceLibABIVersion ABIVer, bool noGPULib ) const {
1003
+ DeviceLibABIVersion ABIVer) const {
1030
1004
if (!hasDeviceLibrary ()) {
1031
- if (!noGPULib)
1032
- D.Diag (diag::err_drv_no_rocm_device_lib) << 0 ;
1005
+ D.Diag (diag::err_drv_no_rocm_device_lib) << 0 ;
1033
1006
return false ;
1034
1007
}
1035
1008
if (LibDeviceFile.empty ()) {
1036
- if (!noGPULib)
1037
- D.Diag (diag::err_drv_no_rocm_device_lib) << 1 << GPUArch;
1009
+ D.Diag (diag::err_drv_no_rocm_device_lib) << 1 << GPUArch;
1038
1010
return false ;
1039
1011
}
1040
1012
if (ABIVer.requiresLibrary () && getABIVersionPath (ABIVer).empty ()) {
0 commit comments