xref: /llvm-project/libc/src/__support/time/gpu/time_utils.cpp (revision e6cf5d2863b77895ae7183952514bedd9e8dde16)
1*e6cf5d28SSchrodinger ZHU Yifan //===-- Generic utilities for GPU timing ----------------------------------===//
2*e6cf5d28SSchrodinger ZHU Yifan //
3*e6cf5d28SSchrodinger ZHU Yifan // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*e6cf5d28SSchrodinger ZHU Yifan // See https://llvm.org/LICENSE.txt for license information.
5*e6cf5d28SSchrodinger ZHU Yifan // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*e6cf5d28SSchrodinger ZHU Yifan //
7*e6cf5d28SSchrodinger ZHU Yifan //===----------------------------------------------------------------------===//
8*e6cf5d28SSchrodinger ZHU Yifan 
9*e6cf5d28SSchrodinger ZHU Yifan #include "time_utils.h"
10*e6cf5d28SSchrodinger ZHU Yifan #include "src/__support/macros/config.h"
11*e6cf5d28SSchrodinger ZHU Yifan 
12*e6cf5d28SSchrodinger ZHU Yifan namespace LIBC_NAMESPACE_DECL {
13*e6cf5d28SSchrodinger ZHU Yifan 
14*e6cf5d28SSchrodinger ZHU Yifan #if defined(LIBC_TARGET_ARCH_IS_AMDGPU)
15*e6cf5d28SSchrodinger ZHU Yifan // This is expected to be initialized by the runtime if the default value is
16*e6cf5d28SSchrodinger ZHU Yifan // insufficient.
17*e6cf5d28SSchrodinger ZHU Yifan // TODO: Once we have another use-case for this we should put it in a common
18*e6cf5d28SSchrodinger ZHU Yifan // device environment struct.
19*e6cf5d28SSchrodinger ZHU Yifan gpu::Constant<uint64_t> __llvm_libc_clock_freq = clock_freq;
20*e6cf5d28SSchrodinger ZHU Yifan #endif
21*e6cf5d28SSchrodinger ZHU Yifan 
22*e6cf5d28SSchrodinger ZHU Yifan } // namespace LIBC_NAMESPACE_DECL
23