Lines Matching +full:diag +full:- +full:version

1 //===--- AMDGPU.cpp - AMDGPU ToolChain Implementations ----------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
35 // Look for sub-directory starts with PackageName under ROCm candidate path.
36 // If there is one and only one matching sub-directory found, append the
37 // sub-directory to Path. If there is no matching sub-directory or there are
38 // more than one matching sub-directories, diagnose them. Returns the full
39 // path of the package if there is only one matching sub-directory, otherwise
47 std::string Prefix = Twine(PackageName + "-" + Cand.SPACKReleaseStr).str(); in findSPACKPackage()
52 llvm::StringRef FileName = llvm::sys::path::filename(File->path()); in findSPACKPackage()
72 << " due to multiple installations for the same version\n"; in findSPACKPackage()
86 StringRef FilePath = LI->path(); in scanLibDevicePath()
152 // Parse and extract version numbers from `.hipVersion`. Return `true` if
197 // For candidate specified by --rocm-path we do not do strict check, i.e., in getInstallationPathCandidates()
198 // checking existence of HIP version file and device library files. in getInstallationPathCandidates()
205 if (!RocmPathEnv->empty()) { in getInstallationPathCandidates()
216 // the Windows-esque layout the ROCm packages use with the host architecture in getInstallationPathCandidates()
231 // <rocm_root>/llvm-amdgpu-<rocm_release_string>-<hash>/bin directory. in getInstallationPathCandidates()
232 // We only consider the parent directory of llvm-amdgpu package as ROCm in getInstallationPathCandidates()
234 if (ParentName.starts_with("llvm-amdgpu-")) { in getInstallationPathCandidates()
236 ParentName.drop_front(strlen("llvm-amdgpu-")).split('-'); in getInstallationPathCandidates()
277 // Find the latest /opt/rocm-{release} directory. in getInstallationPathCandidates()
281 // Get ROCm version from ROCm directory name. in getInstallationPathCandidates()
284 std::string VerStr = DirName.drop_front(strlen("rocm-")).str(); in getInstallationPathCandidates()
286 // rocm-{major}.{minor}.{subMinor}[-{build}] in getInstallationPathCandidates()
287 std::replace(VerStr.begin(), VerStr.end(), '-', '.'); in getInstallationPathCandidates()
295 llvm::StringRef FileName = llvm::sys::path::filename(File->path()); in getInstallationPathCandidates()
296 if (!FileName.starts_with("rocm-")) in getInstallationPathCandidates()
348 HIPVersionArg = A->getValue(); in RocmInstallationDetector()
364 D.Diag(diag::err_drv_invalid_value) in RocmInstallationDetector()
365 << A->getAsString(Args) << HIPVersionArg; in RocmInstallationDetector()
389 LibDevicePath = RocmDeviceLibPathArg[RocmDeviceLibPathArg.size() - 1]; in detectDeviceLibrary()
416 // Check that the required non-target libraries are all available. in detectDeviceLibrary()
421 // if -nobuiltinlib hasn't been specified. in detectDeviceLibrary()
454 if (!HIPPathEnv->empty()) in detectHIPRuntime()
466 // <rocm_root>/hip-<rocm_release_string>-<hash> directory. in detectHIPRuntime()
489 // If HIP version file can be found and parsed, use HIP version from there. in detectHIPRuntime()
491 Append(SharePath, "hip", "version"), in detectHIPRuntime()
493 ? Append(ParentSharePath, "hip", "version") in detectHIPRuntime()
505 if (parseHIPVersionFile((*VersionFile)->getBuffer())) in detectHIPRuntime()
511 // Otherwise, if -rocm-path is specified (no strict checking), use the in detectHIPRuntime()
512 // default HIP version or specified by --hip-version. in detectHIPRuntime()
523 OS << "Found HIP installation: " << InstallPath << ", version " in print()
538 // - wrapper include path in AddHIPIncludeArgs()
539 // - standard C++ include path in AddHIPIncludeArgs()
540 // - other clang include path in AddHIPIncludeArgs()
550 CC1Args.push_back("-internal-isystem"); in AddHIPIncludeArgs()
561 D.Diag(diag::err_drv_no_hipstdpar_lib); in AddHIPIncludeArgs()
565 D.Diag(diag::err_drv_no_hipstdpar_thrust_lib); in AddHIPIncludeArgs()
569 D.Diag(diag::err_drv_no_hipstdpar_prim_lib); in AddHIPIncludeArgs()
591 CC1Args.append({"-idirafter", ThrustPath, "-idirafter", PrimPath, in AddHIPIncludeArgs()
592 "-idirafter", HIPStdParPath, "-include", in AddHIPIncludeArgs()
604 D.Diag(diag::err_drv_no_hip_runtime); in AddHIPIncludeArgs()
608 CC1Args.push_back("-idirafter"); in AddHIPIncludeArgs()
611 CC1Args.append({"-include", "__clang_hip_runtime_wrapper.h"}); in AddHIPIncludeArgs()
623 CmdArgs.push_back("--no-undefined"); in ConstructJob()
624 CmdArgs.push_back("-shared"); in ConstructJob()
635 "-plugin-opt=mcpu=" + Args.getLastArgValue(options::OPT_mcpu_EQ))); in ConstructJob()
636 CmdArgs.push_back("-o"); in ConstructJob()
647 // Add target ID features to -target-feature options. No diagnostics should in getAMDGPUTargetFeatures()
661 // If it is mapped to false, add -feature. in getAMDGPUTargetFeatures()
668 (Twine(Pos->second ? "+" : "-") + Feature).str())); in getAMDGPUTargetFeatures()
679 Features.push_back("+precise-memory"); in getAMDGPUTargetFeatures()
691 // Check code object version options. Emit warnings for legacy options
692 // and errors for the last invalid code object version options.
715 DAL->append(A); in TranslateArgs()
717 // Replace -mcpu=native with detected GPU. in TranslateArgs()
718 Arg *LastMCPUArg = DAL->getLastArg(options::OPT_mcpu_EQ); in TranslateArgs()
719 if (LastMCPUArg && StringRef(LastMCPUArg->getValue()) == "native") { in TranslateArgs()
720 DAL->eraseArg(options::OPT_mcpu_EQ); in TranslateArgs()
723 getDriver().Diag(diag::err_drv_undetermined_gpu_arch) in TranslateArgs()
725 << llvm::toString(GPUsOrErr.takeError()) << "-mcpu"; in TranslateArgs()
729 getDriver().Diag(diag::warn_drv_multi_gpu_arch) in TranslateArgs()
731 << llvm::join(GPUs, ", ") << "-mcpu"; in TranslateArgs()
733 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_mcpu_EQ), in TranslateArgs()
743 // Phase 1 (.cl -> .bc) in TranslateArgs()
745 DAL->AddFlagArg(nullptr, Opts.getOption(getTriple().isArch64Bit() in TranslateArgs()
753 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_O), in TranslateArgs()
825 RocmInstallation->detectDeviceLibrary(); in ROCMToolChain()
836 CC1Args.push_back("-fvisibility=hidden"); in addClangTargetOptions()
837 CC1Args.push_back("-fapply-global-visibility-to-externs"); in addClangTargetOptions()
844 CC1Args.push_back("-Werror=atomic-alignment"); in addClangWarningOptions()
864 return {TargetID.str(), OptionalGpuArch->str(), FeatureMap}; in getParsedTargetID()
871 getDriver().Diag(clang::diag::err_drv_bad_target_id) in checkTargetID()
881 Program = A->getValue(); in getSystemGPUArchs()
883 Program = GetProgramPath("amdgpu-arch"); in getSystemGPUArchs()
890 for (StringRef Arch : llvm::split((*StdoutOrErr)->getBuffer(), "\n")) in getSystemGPUArchs()
907 // For the OpenCL case where there is no offload target, accept -nostdlib to in addClangTargetOptions()
920 StringRef LibDeviceFile = RocmInstallation->getLibDeviceFile(CanonArch); in addClangTargetOptions()
923 if (!RocmInstallation->checkCommonBitcodeLibs(CanonArch, LibDeviceFile, in addClangTargetOptions()
943 BCLibs.push_back(RocmInstallation->getOpenCLPath().str()); in addClangTargetOptions()
946 BCLibs.append(RocmInstallation->getCommonBitcodeLibs( in addClangTargetOptions()
951 CC1Args.push_back("-mlink-bitcode-file"); in addClangTargetOptions()
953 DriverArgs.MakeArgString(RocmInstallation->getAsanRTLPath())); in addClangTargetOptions()
956 CC1Args.push_back("-mlink-builtin-bitcode"); in addClangTargetOptions()
965 D.Diag(diag::err_drv_no_rocm_device_lib) << 0; in checkCommonBitcodeLibs()
969 D.Diag(diag::err_drv_no_rocm_device_lib) << 1 << GPUArch; in checkCommonBitcodeLibs()
973 D.Diag(diag::err_drv_no_rocm_device_lib) << 2 << ABIVer.toString(); in checkCommonBitcodeLibs()
1011 StringRef LibDeviceFile = RocmInstallation->getLibDeviceFile(CanonArch); in getCommonDeviceLibNames()
1014 if (!RocmInstallation->checkCommonBitcodeLibs(CanonArch, LibDeviceFile, in getCommonDeviceLibNames()
1018 // If --hip-device-lib is not set, add the default bitcode libraries. in getCommonDeviceLibNames()
1036 return RocmInstallation->getCommonBitcodeLibs( in getCommonDeviceLibNames()