HIP: Heterogenous-computing Interface for Portability
Loading...
Searching...
No Matches
device_library_decls.h
Go to the documentation of this file.
1/*
2Copyright (c) 2015 - 2023 Advanced Micro Devices, Inc. All rights reserved.
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20THE SOFTWARE.
21*/
22
31#ifndef HIP_INCLUDE_HIP_AMD_DETAIL_DEVICE_LIBRARY_DECLS_H
32#define HIP_INCLUDE_HIP_AMD_DETAIL_DEVICE_LIBRARY_DECLS_H
33
34#if !defined(__HIPCC_RTC__)
36#endif
37
38typedef unsigned char uchar;
39typedef unsigned short ushort;
40typedef unsigned int uint;
41typedef unsigned long ulong;
42typedef unsigned long long ullong;
43
44extern "C" __device__ __attribute__((const)) bool __ockl_wfany_i32(int);
45extern "C" __device__ __attribute__((const)) bool __ockl_wfall_i32(int);
46extern "C" __device__ uint __ockl_activelane_u32(void);
47
48extern "C" __device__ __attribute__((const)) uint __ockl_mul24_u32(uint, uint);
49extern "C" __device__ __attribute__((const)) int __ockl_mul24_i32(int, int);
50extern "C" __device__ __attribute__((const)) uint __ockl_mul_hi_u32(uint, uint);
51extern "C" __device__ __attribute__((const)) int __ockl_mul_hi_i32(int, int);
52extern "C" __device__ __attribute__((const)) uint __ockl_sadd_u32(uint, uint, uint);
53
54extern "C" __device__ __attribute__((const)) uchar __ockl_clz_u8(uchar);
55extern "C" __device__ __attribute__((const)) ushort __ockl_clz_u16(ushort);
56extern "C" __device__ __attribute__((const)) uint __ockl_clz_u32(uint);
57extern "C" __device__ __attribute__((const)) uint64_t __ockl_clz_u64(uint64_t);
58
59extern "C" __device__ __attribute__((const)) float __ocml_floor_f32(float);
60extern "C" __device__ __attribute__((const)) float __ocml_rint_f32(float);
61extern "C" __device__ __attribute__((const)) float __ocml_ceil_f32(float);
62extern "C" __device__ __attribute__((const)) float __ocml_trunc_f32(float);
63
64extern "C" __device__ __attribute__((const)) float __ocml_fmin_f32(float, float);
65extern "C" __device__ __attribute__((const)) float __ocml_fmax_f32(float, float);
66
67extern "C" __device__ __attribute__((const)) float __ocml_cvtrtn_f32_f64(double);
68extern "C" __device__ __attribute__((const)) float __ocml_cvtrtp_f32_f64(double);
69extern "C" __device__ __attribute__((const)) float __ocml_cvtrtz_f32_f64(double);
70
71extern "C" __device__ __attribute__((const)) _Float16 __ocml_cvtrtn_f16_f32(float);
72extern "C" __device__ __attribute__((const)) _Float16 __ocml_cvtrtp_f16_f32(float);
73extern "C" __device__ __attribute__((const)) _Float16 __ocml_cvtrtz_f16_f32(float);
74
75extern "C" __device__ __attribute__((const)) float __ocml_cvtrtn_f32_s32(int);
76extern "C" __device__ __attribute__((const)) float __ocml_cvtrtp_f32_s32(int);
77extern "C" __device__ __attribute__((const)) float __ocml_cvtrtz_f32_s32(int);
78extern "C" __device__ __attribute__((const)) float __ocml_cvtrtn_f32_u32(uint32_t);
79extern "C" __device__ __attribute__((const)) float __ocml_cvtrtp_f32_u32(uint32_t);
80extern "C" __device__ __attribute__((const)) float __ocml_cvtrtz_f32_u32(uint32_t);
81extern "C" __device__ __attribute__((const)) float __ocml_cvtrtn_f32_s64(int64_t);
82extern "C" __device__ __attribute__((const)) float __ocml_cvtrtp_f32_s64(int64_t);
83extern "C" __device__ __attribute__((const)) float __ocml_cvtrtz_f32_s64(int64_t);
84extern "C" __device__ __attribute__((const)) float __ocml_cvtrtn_f32_u64(uint64_t);
85extern "C" __device__ __attribute__((const)) float __ocml_cvtrtp_f32_u64(uint64_t);
86extern "C" __device__ __attribute__((const)) float __ocml_cvtrtz_f32_u64(uint64_t);
87extern "C" __device__ __attribute__((const)) double __ocml_cvtrtn_f64_s64(int64_t);
88extern "C" __device__ __attribute__((const)) double __ocml_cvtrtp_f64_s64(int64_t);
89extern "C" __device__ __attribute__((const)) double __ocml_cvtrtz_f64_s64(int64_t);
90extern "C" __device__ __attribute__((const)) double __ocml_cvtrtn_f64_u64(uint64_t);
91extern "C" __device__ __attribute__((const)) double __ocml_cvtrtp_f64_u64(uint64_t);
92extern "C" __device__ __attribute__((const)) double __ocml_cvtrtz_f64_u64(uint64_t);
93
94extern "C" __device__ __attribute__((convergent)) void __ockl_gws_init(uint nwm1, uint rid);
95extern "C" __device__ __attribute__((convergent)) void __ockl_gws_barrier(uint nwm1, uint rid);
96
97extern "C" __device__ __attribute__((const)) uint32_t __ockl_lane_u32();
98extern "C" __device__ __attribute__((const)) int __ockl_grid_is_valid(void);
99extern "C" __device__ __attribute__((convergent)) void __ockl_grid_sync(void);
100extern "C" __device__ __attribute__((const)) uint __ockl_multi_grid_num_grids(void);
101extern "C" __device__ __attribute__((const)) uint __ockl_multi_grid_grid_rank(void);
102extern "C" __device__ __attribute__((const)) uint __ockl_multi_grid_size(void);
103extern "C" __device__ __attribute__((const)) uint __ockl_multi_grid_thread_rank(void);
104extern "C" __device__ __attribute__((const)) int __ockl_multi_grid_is_valid(void);
105extern "C" __device__ __attribute__((convergent)) void __ockl_multi_grid_sync(void);
106
107extern "C" __device__ void __ockl_atomic_add_noret_f32(float*, float);
108
109extern "C" __device__ __attribute__((convergent)) int __ockl_wgred_add_i32(int a);
110extern "C" __device__ __attribute__((convergent)) int __ockl_wgred_and_i32(int a);
111extern "C" __device__ __attribute__((convergent)) int __ockl_wgred_or_i32(int a);
112
113extern "C" __device__ uint64_t __ockl_fprintf_stderr_begin();
114extern "C" __device__ uint64_t __ockl_fprintf_append_args(uint64_t msg_desc, uint32_t num_args,
115 uint64_t value0, uint64_t value1,
116 uint64_t value2, uint64_t value3,
117 uint64_t value4, uint64_t value5,
118 uint64_t value6, uint32_t is_last);
119extern "C" __device__ uint64_t __ockl_fprintf_append_string_n(uint64_t msg_desc, const char* data,
120 uint64_t length, uint32_t is_last);
121
122// Introduce local address space
123#define __local __attribute__((address_space(3)))
124
125#ifdef __HIP_DEVICE_COMPILE__
126__device__ inline static __local void* __to_local(unsigned x) { return (__local void*)x; }
127#endif //__HIP_DEVICE_COMPILE__
128
129// Using hip.amdgcn.bc - sync threads
130#define __CLK_LOCAL_MEM_FENCE 0x01
131typedef unsigned __cl_mem_fence_flags;
132
133#endif
_Float16 __2f16 __attribute__((ext_vector_type(2)))
Definition hip_fp16_math_fwd.h:57