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

1 //===--- Cuda.cpp - Cuda Tool and ToolChain Implementations -----*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
97 const SmallVector<StringRef, 3> words) -> std::optional<StringRef> { in parseCudaHFile()
111 Line->consumeInteger(10, RawVersion); in parseCudaHFile()
114 // Find next non-empty line. in parseCudaHFile()
122 if (Version > CudaVersion::PARTIALLY_SUPPORTED) { in WarnIfUnsupportedVersion()
123 std::string VersionString = CudaVersionToString(Version); in WarnIfUnsupportedVersion()
126 D.Diag(diag::warn_drv_new_cuda_version) in WarnIfUnsupportedVersion()
130 } else if (Version > CudaVersion::FULLY_SUPPORTED) in WarnIfUnsupportedVersion()
131 D.Diag(diag::warn_drv_partially_supported_cuda_version) in WarnIfUnsupportedVersion()
132 << CudaVersionToString(Version); in WarnIfUnsupportedVersion()
169 // even if the user passes -nocudalib. in CudaInstallationDetector()
185 Candidates.emplace_back(D.SysRoot + "/usr/local/cuda-" + Ver); in CudaInstallationDetector()
189 // Special case for Debian to have nvidia-cuda-toolkit work in CudaInstallationDetector()
211 Version = CudaVersion::UNKNOWN; in CudaInstallationDetector()
213 Version = parseCudaHFile((*CudaHFile)->getBuffer()); in CudaInstallationDetector()
214 // As the last resort, make an educated guess between CUDA-7.0, which had in CudaInstallationDetector()
215 // old-style libdevice bitcode, and an unknown recent CUDA version. in CudaInstallationDetector()
216 if (Version == CudaVersion::UNKNOWN) { in CudaInstallationDetector()
217 Version = FS.exists(LibDevicePath + "/libdevice.10.bc") in CudaInstallationDetector()
222 if (Version >= CudaVersion::CUDA_90) { in CudaInstallationDetector()
223 // CUDA-9+ uses single libdevice file for all GPU variants. in CudaInstallationDetector()
240 StringRef FilePath = LI->path(); in CudaInstallationDetector()
251 // capability. NVCC's choice of the libdevice library version is in CudaInstallationDetector()
252 // rather peculiar and depends on the CUDA version. in CudaInstallationDetector()
259 if (Version < CudaVersion::CUDA_80) { in CudaInstallationDetector()
271 if (Version >= CudaVersion::CUDA_80) { in CudaInstallationDetector()
281 // -nocudalib hasn't been specified. in CudaInstallationDetector()
298 CC1Args.push_back("-internal-isystem"); in AddCudaIncludeArgs()
306 D.Diag(diag::err_drv_no_cuda_installation); in AddCudaIncludeArgs()
310 CC1Args.push_back("-include"); in AddCudaIncludeArgs()
316 if (Arch == OffloadArch::UNKNOWN || Version == CudaVersion::UNKNOWN || in CheckCudaVersionSupportsArch()
322 if (Version < MinVersion || Version > MaxVersion) { in CheckCudaVersionSupportsArch()
324 D.Diag(diag::err_drv_cuda_version_unsupported) in CheckCudaVersionSupportsArch()
327 << CudaVersionToString(Version); in CheckCudaVersionSupportsArch()
333 OS << "Found CUDA installation: " << InstallPath << ", version " in print()
334 << CudaVersionToString(Version) << "\n"; in print()
352 /// the host and device are disabled (-g0/-ggdb0 or no debug options at all). If
354 /// (-gline-directvies-only), or the debug info only for the device is disabled
355 /// (optimization is on and --cuda-noopt-device-debug was not specified), the
361 bool IsDebugEnabled = !A || A->getOption().matches(options::OPT_O0) || in mustEmitDebugInfo()
366 const Option &Opt = A->getOption(); in mustEmitDebugInfo()
389 // from the Job's associated architecture, otherwise use the -march=arch in ConstructJob()
390 // option. This option may come from -Xopenmp-target flag or the default in ConstructJob()
397 C.getDriver().Diag(diag::err_drv_offload_missing_gpu_arch) in ConstructJob()
414 CmdArgs.push_back(TC.getTriple().isArch64Bit() ? "-m64" : "-m32"); in ConstructJob()
417 // ptxas does not accept -g option if optimization is enabled, so in ConstructJob()
418 // we ignore the compiler's -O* options if we want debug info. in ConstructJob()
419 CmdArgs.push_back("-g"); in ConstructJob()
420 CmdArgs.push_back("--dont-merge-basicblocks"); in ConstructJob()
421 CmdArgs.push_back("--return-at-end"); in ConstructJob()
423 // Map the -O we received to -O{0,1,2,3}. in ConstructJob()
425 // TODO: Perhaps we should map host -O2 to ptxas -O3. -O3 is ptxas's in ConstructJob()
426 // default, so it may correspond more closely to the spirit of clang -O2. in ConstructJob()
428 // -O3 seems like the least-bad option when -Osomething is specified to in ConstructJob()
431 if (A->getOption().matches(options::OPT_O4) || in ConstructJob()
432 A->getOption().matches(options::OPT_Ofast)) in ConstructJob()
434 else if (A->getOption().matches(options::OPT_O0)) in ConstructJob()
436 else if (A->getOption().matches(options::OPT_O)) { in ConstructJob()
437 // -Os, -Oz, and -O(anything else) map to -O2, for lack of better options. in ConstructJob()
438 OOpt = llvm::StringSwitch<const char *>(A->getValue()) in ConstructJob()
446 CmdArgs.push_back(Args.MakeArgString(llvm::Twine("-O") + OOpt)); in ConstructJob()
448 // If no -O was passed, pass -O0 to ptxas -- no opt flag should correspond in ConstructJob()
449 // to no optimizations, but ptxas's default is -O3. in ConstructJob()
450 CmdArgs.push_back("-O0"); in ConstructJob()
453 CmdArgs.push_back("-lineinfo"); in ConstructJob()
455 // Pass -v to ptxas if it was passed to the driver. in ConstructJob()
457 CmdArgs.push_back("-v"); in ConstructJob()
459 CmdArgs.push_back("--gpu-name"); in ConstructJob()
461 CmdArgs.push_back("--output-file"); in ConstructJob()
489 CmdArgs.push_back("-c"); in ConstructJob()
493 Exec = A->getValue(); in ConstructJob()
499 "--options-file"}, in ConstructJob()
509 A->claim(); in shouldIncludePTX()
510 const StringRef ArchStr = A->getValue(); in shouldIncludePTX()
511 if (A->getOption().matches(options::OPT_cuda_include_ptx_EQ) && in shouldIncludePTX()
514 else if (A->getOption().matches(options::OPT_no_cuda_include_ptx_EQ) && in shouldIncludePTX()
534 if (TC.CudaInstallation.version() <= CudaVersion::CUDA_100) in ConstructJob()
535 CmdArgs.push_back("--cuda"); in ConstructJob()
536 CmdArgs.push_back(TC.getTriple().isArch64Bit() ? "-64" : "-32"); in ConstructJob()
537 CmdArgs.push_back(Args.MakeArgString("--create")); in ConstructJob()
540 CmdArgs.push_back("-g"); in ConstructJob()
544 assert(A->getInputs().size() == 1 && in ConstructJob()
546 const char *gpu_arch_str = A->getOffloadingArch(); in ConstructJob()
560 Args.MakeArgString(llvm::Twine("--image=profile=") + Arch + in ConstructJob()
571 "--options-file"}, in ConstructJob()
588 CmdArgs.push_back("-o"); in ConstructJob()
593 CmdArgs.push_back("-g"); in ConstructJob()
596 CmdArgs.push_back("-v"); in ConstructJob()
600 C.getDriver().Diag(diag::err_drv_offload_missing_gpu_arch) in ConstructJob()
605 CmdArgs.push_back("-arch"); in ConstructJob()
610 "--pxtas-path=" + Args.getLastArgValue(options::OPT_ptxas_path_EQ))); in ConstructJob()
614 "--cuda-path=" + Args.getLastArgValue(options::OPT_cuda_path_EQ))); in ConstructJob()
616 // Add paths specified in LIBRARY_PATH environment variable as -L options. in ConstructJob()
617 addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); in ConstructJob()
632 CmdArgs.push_back(Args.MakeArgString(Twine("-L") + DefaultLibPath)); in ConstructJob()
637 "--options-file"}, in ConstructJob()
638 Args.MakeArgString(getToolChain().GetProgramPath("clang-nvlink-wrapper")), in ConstructJob()
654 // by new PTX version, so we need to raise PTX level to enable them in NVPTX in getNVPTXTargetFeatures()
655 // back-end. in getNVPTXTargetFeatures()
657 switch (CudaInstallation.version()) { in getNVPTXTargetFeatures()
691 /// operates as a stand-alone version of the NVPTX tools without the host
701 // discover the 'nvptx-arch' executable. in NVPTXToolChain()
724 DAL->append(A); in TranslateArgs()
726 if (!DAL->hasArg(options::OPT_march_EQ) && OffloadKind != Action::OFK_None) { in TranslateArgs()
727 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ), in TranslateArgs()
729 } else if (DAL->getLastArgValue(options::OPT_march_EQ) == "generic" && in TranslateArgs()
731 DAL->eraseArg(options::OPT_march_EQ); in TranslateArgs()
732 } else if (DAL->getLastArgValue(options::OPT_march_EQ) == "native") { in TranslateArgs()
735 getDriver().Diag(diag::err_drv_undetermined_gpu_arch) in TranslateArgs()
736 << getArchName() << llvm::toString(GPUsOrErr.takeError()) << "-march"; in TranslateArgs()
738 if (GPUsOrErr->size() > 1) in TranslateArgs()
739 getDriver().Diag(diag::warn_drv_multi_gpu_arch) in TranslateArgs()
740 << getArchName() << llvm::join(*GPUsOrErr, ", ") << "-march"; in TranslateArgs()
741 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ), in TranslateArgs()
742 Args.MakeArgString(GPUsOrErr->front())); in TranslateArgs()
756 CC1Args.append({"-mllvm", "--nvptx-lower-global-ctor-dtor"}); in addClangTargetOptions()
760 const Option &O = A->getOption(); in supportsDebugInfoOption()
792 Program = A->getValue(); in getSystemGPUArchs()
794 Program = GetProgramPath("nvptx-arch"); in getSystemGPUArchs()
801 for (StringRef Arch : llvm::split((*StdoutOrErr)->getBuffer(), "\n")) in getSystemGPUArchs()
833 {"-fcuda-is-device", "-mllvm", "-enable-memcpyopt-without-libcalls"}); in addClangTargetOptions()
835 // Unsized function arguments used for variadics were introduced in CUDA-9.0 in addClangTargetOptions()
838 // headers rely on that. https://github.com/llvm/llvm-project/issues/58410 in addClangTargetOptions()
839 if (CudaInstallation.version() >= CudaVersion::CUDA_90) in addClangTargetOptions()
840 CC1Args.push_back("-fcuda-allow-variadic-functions"); in addClangTargetOptions()
852 getDriver().Diag(diag::err_drv_no_cuda_libdevice) << GpuArch; in addClangTargetOptions()
856 CC1Args.push_back("-mlink-builtin-bitcode"); in addClangTargetOptions()
859 clang::CudaVersion CudaInstallationVersion = CudaInstallation.version(); in addClangTargetOptions()
863 CC1Args.append({"-mllvm", "--nvptx-short-ptr"}); in addClangTargetOptions()
867 DriverArgs.MakeArgString(Twine("-target-sdk-version=") + in addClangTargetOptions()
872 getDriver().Diag( in addClangTargetOptions()
873 diag::err_drv_omp_offload_target_cuda_version_not_support) in addClangTargetOptions()
903 // Check our CUDA version if we're going to include the CUDA headers. in AddCudaIncludeArgs()
915 // extensions. If the user requested device-only compilation don't change it. in getInputFilename()
939 DAL->append(A); in TranslateArgs()
941 if (!DAL->hasArg(options::OPT_march_EQ)) { in TranslateArgs()
948 getDriver().Diag(diag::err_drv_undetermined_gpu_arch) in TranslateArgs()
949 << llvm::Triple::getArchTypeName(getArch()) << ErrMsg << "-march"; in TranslateArgs()
952 Arch = Args.MakeArgString(ArchsOrErr->front()); in TranslateArgs()
955 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ), Arch); in TranslateArgs()
964 DAL->append(A); in TranslateArgs()
969 DAL->eraseArg(options::OPT_march_EQ); in TranslateArgs()
970 DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ), in TranslateArgs()
1007 {"-internal-isystem", in AddClangSystemIncludeArgs()