[all-commits] [llvm/llvm-project] d5a5ee: [Clang] Add `nvptx-arch` tool to query installed N...

Joseph Huber via All-commits all-commits at lists.llvm.org
Sun Dec 25 19:24:49 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d5a5ee856e7ccd442ad22168c56ff77197255cbe
      https://github.com/llvm/llvm-project/commit/d5a5ee856e7ccd442ad22168c56ff77197255cbe
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-12-25 (Sun, 25 Dec 2022)

  Changed paths:
    M clang/tools/CMakeLists.txt
    A clang/tools/nvptx-arch/CMakeLists.txt
    A clang/tools/nvptx-arch/NVPTXArch.cpp

  Log Message:
  -----------
  [Clang] Add `nvptx-arch` tool to query installed NVIDIA GPUs

We already have a tool called `amdgpu-arch` which returns the GPUs on
the system. This is used to determine the default architecture when
doing offloading. This patch introduces a similar tool `nvptx-arch`.
Right now we use the detected GPU at compile time. This is unhelpful
when building on a login node and moving execution to a compute node for
example. This will allow us to better choose a default architecture when
targeting NVPTX. Also we can probably use this with CMake's `native`
setting for CUDA now.

CUDA since 11.6 provides `__nvcc_device_query` which has a similar
function but it is probably better to define this locally if we want to
depend on it in clang.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D140433




More information about the All-commits mailing list