aboutsummaryrefslogtreecommitdiff
path: root/libc/startup
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2023-07-04 09:25:25 -0500
committerJoseph Huber <jhuber6@vols.utk.edu>2023-07-05 14:27:08 -0500
commit5db39796bf08abdc5644ad99c5810321a4e8cfcf (patch)
tree8ce9a598cc04ff73fa0f748ebde76ccbd3da036e /libc/startup
parent92f4bf268998201ec05dab9917c2873afc578a94 (diff)
downloadllvm-5db39796bf08abdc5644ad99c5810321a4e8cfcf.zip
llvm-5db39796bf08abdc5644ad99c5810321a4e8cfcf.tar.gz
llvm-5db39796bf08abdc5644ad99c5810321a4e8cfcf.tar.bz2
[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
Diffstat (limited to 'libc/startup')
-rw-r--r--libc/startup/gpu/amdgpu/start.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libc/startup/gpu/amdgpu/start.cpp b/libc/startup/gpu/amdgpu/start.cpp
index 9a99955..7081ae6 100644
--- a/libc/startup/gpu/amdgpu/start.cpp
+++ b/libc/startup/gpu/amdgpu/start.cpp
@@ -15,6 +15,12 @@ extern "C" int main(int argc, char **argv, char **envp);
namespace __llvm_libc {
+// The AMDGPU architecture provides a fixed frequency clock used for obtaining
+// real time. However, the frequency of this clock varies between cards and can
+// only be obtained via the driver. The loader will set this so we can use it.
+extern "C" [[gnu::visibility("protected")]] uint64_t
+ [[clang::address_space(4)]] __llvm_libc_clock_freq = 0;
+
extern "C" uintptr_t __init_array_start[];
extern "C" uintptr_t __init_array_end[];
extern "C" uintptr_t __fini_array_start[];