4 ============================
5 Testing the GPU libc library
6 ============================
9 Running GPU tests with high parallelism is likely to cause spurious failures,
10 out of resource errors, or indefinite hangs. limiting the number of threads
11 used while testing using ``LIBC_GPU_TEST_JOBS=<N>`` is highly recommended.
13 .. contents:: Table of Contents
17 Testing Infrastructure
18 ======================
20 The testing support in LLVM's libc implementation for GPUs is designed to mimic
21 the standard unit tests as much as possible. We use the `remote procedure call
22 <libc_gpu_rpc>`_ support to provide the necessary utilities like printing from
23 the GPU. Execution is performed by emitting a ``_start`` kernel from the GPU
24 that is then called by an external loader utility. This is an example of how
25 this can be done manually:
29 $> clang++ crt1.o test.cpp --target=amdgcn-amd-amdhsa -mcpu=gfx90a -flto
30 $> ./amdhsa_loader --threads 1 --blocks 1 a.out
33 Unlike the exported ``libcgpu.a``, the testing architecture can only support a
34 single architecture at a time. This is either detected automatically, or set
35 manually by the user using ``LIBC_GPU_TEST_ARCHITECTURE``. The latter is useful
36 in cases where the user does not build LLVM's libc on machine with the GPU to