[all-commits] [llvm/llvm-project] 066039: [CUDA] Allow targeting NVPTX directly without a ho...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Jan 18 16:18:41 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0660397e68096a64279b19f913e7de2c283e524f
      https://github.com/llvm/llvm-project/commit/0660397e68096a64279b19f913e7de2c283e524f
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-01-18 (Wed, 18 Jan 2023)

  Changed paths:
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/Cuda.cpp
    M clang/lib/Driver/ToolChains/Cuda.h
    A clang/test/Driver/cuda-cross-compiling.c

  Log Message:
  -----------
  [CUDA] Allow targeting NVPTX directly without a host toolchain

Currently, the NVPTX compilation toolchain can only be invoked either
through CUDA or OpenMP via `--offload-device-only`. This is because we
cannot build a CUDA toolchain without an accompanying host toolchain for
the offloading. When using `--target=nvptx64-nvidia-cuda` this results
in generating calls to the GNU assembler and linker, leading to errors.

This patch abstracts the portions of the CUDA toolchain that are
independent of the host toolchain or offloading kind into a new base
class called `NVPTXToolChain`. We still need to read the host's triple
to build the CUDA installation, so if not present we just assume it will
match the host's system for now, or the user can provide the path
explicitly.

This should allow the compiler driver to create NVPTX device images
directly from C/C++ code.

Reviewed By: tra

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




More information about the All-commits mailing list