[NFC][Py Reformat] Reformat python files in llvm
[llvm-project.git] / libc / docs / gpu / testing.rst
blob376a51ec8067bd3067975e09ba2288320e3a4eab
1 .. _libc_gpu_testing:
4 ============================
5 Testing the GPU libc library
6 ============================
8 .. note::
9    Running GPU tests with high parallelism is likely to cause spurious failures,
10    out of resource errors, or indefinate hangs. limiting the number of threads 
11    used while testing is highly recommended.
13 .. contents:: Table of Contents
14   :depth: 4
15   :local:
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:
27 .. code-block:: sh
29    $> clang++ crt1.o test.cpp --target=amdgcn-amd-amdhsa -mcpu=gfx90a -flto
30    $> ./amdhsa_loader --threads 1 --blocks 1 a.out
31    Test Passed!
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
37 use for testing.