1 //===- AMDGPUArch.cpp - list AMDGPU installed ----------*- C++ -*---------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements a tool for detecting name of AMDGPU installed in system.
10 // This tool is used by AMDGPU OpenMP and HIP driver.
12 //===----------------------------------------------------------------------===//
14 #include "clang/Basic/Version.h"
15 #include "llvm/Support/CommandLine.h"
19 static cl::opt
<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden
);
21 // Mark all our options with this category.
22 static cl::OptionCategory
AMDGPUArchCategory("amdgpu-arch options");
24 static void PrintVersion(raw_ostream
&OS
) {
25 OS
<< clang::getClangToolFullVersion("amdgpu-arch") << '\n';
31 int main(int argc
, char *argv
[]) {
32 cl::HideUnrelatedOptions(AMDGPUArchCategory
);
34 cl::SetVersionPrinter(PrintVersion
);
35 cl::ParseCommandLineOptions(
37 "A tool to detect the presence of AMDGPU devices on the system. \n\n"
38 "The tool will output each detected GPU architecture separated by a\n"
39 "newline character. If multiple GPUs of the same architecture are found\n"
40 "a string will be printed for each\n");
43 cl::PrintHelpMessage();
48 if (!printGPUsByHSA())
52 return printGPUsByHIP();