[PATCH] D140433: [Clang] Add `nvptx-arch` tool to query installed NVIDIA GPUs

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 20 14:22:38 PST 2022


jhuber6 created this revision.
jhuber6 added reviewers: JonChesterfield, tra, yaxunl, jdoerfert, tianshilei1992, MaskRay.
Herald added subscribers: kosarev, mattd, gchakrabarti, asavonic, StephenFan, tpr.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1, jholewinski.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140433

Files:
  clang/tools/CMakeLists.txt
  clang/tools/nvptx-arch/CMakeLists.txt
  clang/tools/nvptx-arch/NVPTXArch.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140433.484381.patch
Type: text/x-patch
Size: 3660 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221220/3b62f19b/attachment.bin>


More information about the cfe-commits mailing list