[all-commits] [llvm/llvm-project] d4c418: [Clang] Add a flag to include GPU startup files (#...

Joseph Huber via All-commits all-commits at lists.llvm.org
Mon Oct 28 07:17:42 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d4c41804175e9cb37266c410cafe9caaac1819ca
      https://github.com/llvm/llvm-project/commit/d4c41804175e9cb37266c410cafe9caaac1819ca
  Author: Joseph Huber <huberjn at outlook.com>
  Date:   2024-10-28 (Mon, 28 Oct 2024)

  Changed paths:
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/AMDGPU.cpp
    M clang/lib/Driver/ToolChains/Cuda.cpp
    M clang/test/Driver/amdgpu-toolchain.c
    M clang/test/Driver/cuda-cross-compiling.c

  Log Message:
  -----------
  [Clang] Add a flag to include GPU startup files (#112025)

Summary:
The C library for GPUs provides the ability to target regular C/C++
programs by providing the C library and a file containing kernels that
call the `main` function. This is mostly used for unit tests, this patch
provides a quick way to add them without needing to know the paths. I
currently do this explicitly, but according to the libc++ contributors
we don't want to need to specify these paths manually. See the
discussion in https://github.com/llvm/llvm-project/pull/104515.

I just default to `lib/` if the target-specific one isn't found because
the linker will handle giving a reasonable error message if it's not
found. Basically the use-case looks like this.

```console
$ clang test.c --target=amdgcn-amd-amdhsa -mcpu=native -startfiles -stdlib
$ amdhsa-loader a.out
PASS!
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list