1 | //===-------------- Generic implementation of GPU utils ---------*- C++ -*-===// |
---|---|
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_LIBC_SRC___SUPPORT_GPU_GENERIC_UTILS_H |
10 | #define LLVM_LIBC_SRC___SUPPORT_GPU_GENERIC_UTILS_H |
11 | |
12 | #include "src/__support/common.h" |
13 | |
14 | #include <stdint.h> |
15 | |
16 | namespace LIBC_NAMESPACE { |
17 | namespace gpu { |
18 | |
19 | template <typename T> using Private = T; |
20 | template <typename T> using Constant = T; |
21 | template <typename T> using Shared = T; |
22 | template <typename T> using Global = T; |
23 | |
24 | LIBC_INLINE uint32_t get_num_blocks_x() { return 1; } |
25 | |
26 | LIBC_INLINE uint32_t get_num_blocks_y() { return 1; } |
27 | |
28 | LIBC_INLINE uint32_t get_num_blocks_z() { return 1; } |
29 | |
30 | LIBC_INLINE uint64_t get_num_blocks() { return 1; } |
31 | |
32 | LIBC_INLINE uint32_t get_block_id_x() { return 0; } |
33 | |
34 | LIBC_INLINE uint32_t get_block_id_y() { return 0; } |
35 | |
36 | LIBC_INLINE uint32_t get_block_id_z() { return 0; } |
37 | |
38 | LIBC_INLINE uint64_t get_block_id() { return 0; } |
39 | |
40 | LIBC_INLINE uint32_t get_num_threads_x() { return 1; } |
41 | |
42 | LIBC_INLINE uint32_t get_num_threads_y() { return 1; } |
43 | |
44 | LIBC_INLINE uint32_t get_num_threads_z() { return 1; } |
45 | |
46 | LIBC_INLINE uint64_t get_num_threads() { return 1; } |
47 | |
48 | LIBC_INLINE uint32_t get_thread_id_x() { return 0; } |
49 | |
50 | LIBC_INLINE uint32_t get_thread_id_y() { return 0; } |
51 | |
52 | LIBC_INLINE uint32_t get_thread_id_z() { return 0; } |
53 | |
54 | LIBC_INLINE uint64_t get_thread_id() { return 0; } |
55 | |
56 | LIBC_INLINE uint32_t get_lane_size() { return 1; } |
57 | |
58 | LIBC_INLINE uint32_t get_lane_id() { return 0; } |
59 | |
60 | LIBC_INLINE uint64_t get_lane_mask() { return 1; } |
61 | |
62 | LIBC_INLINE uint32_t broadcast_value(uint64_t, uint32_t x) { return x; } |
63 | |
64 | LIBC_INLINE uint64_t ballot(uint64_t, bool x) { return x; } |
65 | |
66 | LIBC_INLINE void sync_threads() {} |
67 | |
68 | LIBC_INLINE void sync_lane(uint64_t) {} |
69 | |
70 | LIBC_INLINE uint32_t shuffle(uint64_t, uint32_t, uint32_t x) { return x; } |
71 | |
72 | LIBC_INLINE uint64_t processor_clock() { return 0; } |
73 | |
74 | LIBC_INLINE uint64_t fixed_frequency_clock() { return 0; } |
75 | |
76 | [[noreturn]] LIBC_INLINE void end_program() { __builtin_unreachable(); } |
77 | |
78 | LIBC_INLINE uint32_t get_cluster_id() { return 0; } |
79 | |
80 | } // namespace gpu |
81 | } // namespace LIBC_NAMESPACE |
82 | |
83 | #endif // LLVM_LIBC_SRC___SUPPORT_GPU_GENERIC_UTILS_H |
84 |