[libc] Support timing information in libc tests
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 4 Jul 2023 14:25:25 +0000 (09:25 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Wed, 5 Jul 2023 19:27:08 +0000 (14:27 -0500)
commit5db39796bf08abdc5644ad99c5810321a4e8cfcf
tree8ce9a598cc04ff73fa0f748ebde76ccbd3da036e
parent92f4bf268998201ec05dab9917c2873afc578a94
[libc] Support timing information in libc tests

This patch adds the necessary support to provide timing information in
`libc` tests. This is useful for determining which tests look what
amount of time. We also can use this as a test basis for providing more
fine-grained timing when implementing things on the GPU.

The main difficulty with this is the fact that the AMDGPU fixed
frequency clock operates at an unknown frequency. We need to read this
on a per-card basis from the driver and then copy it in. NVPTX on the
other hand has a fixed clock at a resolution of 1ns. I have also
increased the resolution of the print-outs as the majority of these are
below a millisecond for me.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D154446
libc/src/__support/GPU/amdgpu/utils.h
libc/src/__support/GPU/generic/utils.h
libc/src/__support/GPU/nvptx/utils.h
libc/startup/gpu/amdgpu/start.cpp
libc/test/UnitTest/LibcTest.cpp
libc/utils/gpu/loader/amdgpu/Loader.cpp