[libc-commits] [PATCH] D142776: [libc] Add code for detecting NVIDIA GPUs as well

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jan 27 11:52:34 PST 2023


jhuber6 added inline comments.


================
Comment at: libc/cmake/modules/prepare_libc_gpu_build.cmake:53
+                 "architecture ${LIBC_GPU_TARGET_ARCHITECTURE} ")
+  return()
+endif()
----------------
sivachandra wrote:
> jhuber6 wrote:
> > sivachandra wrote:
> > > How can one pick between AMD or Nvidia GPUs?
> > I wasn't sure if it warranted a special case right now. Since this is a contingency for a system with both an Nvidia and AMD GPU installed, which is uncommon but not unheard of. Right now I wasn't sure how much effort it would be to support testing multiple builds at the same time, so I figured it would be easier to just stick with one for now.
> > 
> > I could maybe make an override flag. Maybe that would also be useful for ensuring the tests get built even without a GPU installed (as would be the case if someone build LLVM on a cluster's home node and then switched to a compute node).
> > Maybe that would also be useful for ensuring the tests get built even without a GPU installed (as would be the case if someone build LLVM on a cluster's home node and then switched to a compute node).
> 
> You don't need to address this in this patch but I had this exact use case in mind.
> 
> 
Yes, I think it would be best to focus on getting the tests up and running first. Right now my plans are
* Implement a new 'loader' like https://reviews.llvm.org/D139839. Right now I'll probably implement it via the OpenMP runtime to make it more common
* Add a very simple integration test that ensures we can call a `main` function on the GPU.
* Start working on an RPC mechanism to enable `printf` and `exit` like features and then use those to implement the unit test suite.

Once we have that we can probably start thinking about wrapping the existing unit tests into integration tests as well. Do you have any suggestions for how that support should look? I see there have been a few changes in `libc` since I last looked so I want to make sure I'm up-to-date.

Basically the next patches would be like
```
libc/startup/gpu/amdgpu/start.cpp
libc/startup/gpu/nvptx/start.cpp
```
Then
```
libc/utils/gpu/Loader/openmp/Loader.cpp
```
and finally
```
libc/utils/gpu/RPC/Server.h
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142776/new/

https://reviews.llvm.org/D142776



More information about the libc-commits mailing list