The previous patches added the necessary support for global constructors
used to register tests. This patch enables the AMDGPU target to build
and run the unit tests on the GPU. Currently this only tests the ctype
tests, but adding more should be straightforward from here on.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake | ||
---|---|---|
47 | Why was this moved? | |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
74 ↗ | (On Diff #518164) | 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. |
libc/test/src/CMakeLists.txt | ||
13 | Why do you need this? If you don't include math tests in entrypoints.txt, this will not become active anyway, correct? |
libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake | ||
---|---|---|
47 | Previously it prevented the above functions from being defined which are queried in the test setup. | |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
74 ↗ | (On Diff #518164) | 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. |
libc/test/src/CMakeLists.txt | ||
13 | It was active when I tested it, I don't have any math entrypoints in the GPU entrypoint file. It built fine, but it spammed like 30 of these warnings about MPFR into the terminal so I just wanted to silence that. |
libc/cmake/modules/LLVMLibCCheckCpuFeatures.cmake | ||
---|---|---|
47 | Ah! This is not ideal but I think doing it correctly is beyond the scope of this patch. | |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
74 ↗ | (On Diff #518164) | 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. |
libc/test/src/CMakeLists.txt | ||
12 | If it is just this annoying warning, you can modify this to: message(VERBOSE "Math test ...") Then, that warning will only be displayed if --log-level is set to VERBOSE or lower. |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
---|---|---|
74 ↗ | (On Diff #518164) | Alright, this would require reordering the add_subdirectory() calls in the test CMake and exiting early for GPU builds. |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
---|---|---|
74 ↗ | (On Diff #518164) | 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? |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
---|---|---|
74 ↗ | (On Diff #518164) | 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. |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
---|---|---|
74 ↗ | (On Diff #518164) | Can you give repro instructions that I can use to see what you are seeing? |
libc/cmake/modules/LLVMLibCTestRules.cmake | ||
---|---|---|
74 ↗ | (On Diff #518164) | 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. |
Changing to specifically disable tests for the targets we have in the
entrypoints but don't support hermetic tests. These can be removed as more of
the test suite is brought over to the new format.
Update to support more entrypoints. This gets rid of the string conversion
entrypoints until we can figure out how to make the errno asserts work. Also I
had to somewhat hack around weird compiler behaviour. It's not ideal but since
it still tests the functionality I think it should be sufficient for now as I
prepare a bug report.
libc/config/gpu/entrypoints.txt | ||
---|---|---|
71 ↗ | (On Diff #519232) | You can keep the entrypoints but skip the tests with a detailed comment. Up to you. |
libc/test/src/__support/File/CMakeLists.txt | ||
4 ↗ | (On Diff #519232) | May the actual reason is that we don't yet support files on the GPU? If yes, then may be just say that? |
libc/test/src/__support/blockstore_test.cpp | ||
95 ↗ | (On Diff #519232) | Without the context of this patch, the word "these" becomes vague. Can you may be say: Combing this test with the above test makes the AMDGPU backend generate code which hangs. TODO: Investigate why the AMDGPU backend is generating such code. |
libc/test/src/stdio/CMakeLists.txt | ||
10 | Those tests which depend on entrypoints will not be included. I think you want to return() on line 326? |
Why was this moved?