[libc-commits] [PATCH] D149517: [libc] Enable running libc unit tests on AMDGPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon May 1 04:24:43 PDT 2023


jhuber6 added inline comments.


================
Comment at: libc/cmake/modules/LLVMLibCTestRules.cmake:74
 function(create_libc_unittest fq_target_name)
-  if(NOT LLVM_INCLUDE_TESTS)
+  if(NOT LLVM_INCLUDE_TESTS OR NOT LIBC_ENABLE_UNITTESTS)
     return()
----------------
sivachandra wrote:
> jhuber6 wrote:
> > sivachandra wrote:
> > > jhuber6 wrote:
> > > > sivachandra wrote:
> > > > > jhuber6 wrote:
> > > > > > sivachandra wrote:
> > > > > > > Do we ever want to run unit tests the GPU? If no, then I think the right thing to do is to convert the unit test targets to `add_libc_test` targets which will then do the right thing.
> > > > > > I mostly did this because it was much less noise than converting everything to the new format. Since I figured that would be dependent on the rest of the `libc` project contributors to transition to the new test framework. This was the easy stopgap.
> > > > > What we should be doing is, when adding an entrypoint to the GPU's `entrypoints.txt`, convert the entrypoint's unit tests to `add_libc_test`.
> > > > Alright, this would require reordering the `add_subdirectory()` calls in the test CMake and exiting early for GPU builds.
> > > The goal was that it should not require such reordering. If you are requiring it, then it is a bug somewhere. Can you share the error messages you are seeing?
> > Various ones, right now I see the build fail because I don't have `stdio` configured so we get undefined references to `_IOBUF`. Also some others fail because `stdio.h` goes to the host version which has the traditional failure mode.
> Can you give repro instructions that I can use to see what you are seeing?
Try configuring CMake with with `-DLLVM_ENABLE_RUNTIMES=libc -DLIBC_GPU_ARCHITECTURES=gfx90a -DLIBC_GPU_TEST_ARCHITECTURE=gfx90a`. That should allow you to build the tests. Then remove the guard at line libc/test/CMakeLists.txt:25 below. You will need `lld`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149517



More information about the libc-commits mailing list