HIP: Heterogenous-computing Interface for Portability
hip_ldg.h
1 /*
2 Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 
23 #ifndef HIP_INCLUDE_HIP_AMD_DETAIL_HIP_LDG_H
24 #define HIP_INCLUDE_HIP_AMD_DETAIL_HIP_LDG_H
25 
26 #if __HIP_CLANG_ONLY__
27 #include "hip_vector_types.h"
28 #include "host_defines.h"
29 
30 __device__ inline static char __ldg(const char* ptr) { return *ptr; }
31 
32 __device__ inline static char2 __ldg(const char2* ptr) { return *ptr; }
33 
34 __device__ inline static char4 __ldg(const char4* ptr) { return *ptr; }
35 
36 __device__ inline static signed char __ldg(const signed char* ptr) { return ptr[0]; }
37 
38 __device__ inline static unsigned char __ldg(const unsigned char* ptr) { return ptr[0]; }
39 
40 
41 __device__ inline static short __ldg(const short* ptr) { return ptr[0]; }
42 
43 __device__ inline static short2 __ldg(const short2* ptr) { return ptr[0]; }
44 
45 __device__ inline static short4 __ldg(const short4* ptr) { return ptr[0]; }
46 
47 __device__ inline static unsigned short __ldg(const unsigned short* ptr) { return ptr[0]; }
48 
49 
50 __device__ inline static int __ldg(const int* ptr) { return ptr[0]; }
51 
52 __device__ inline static int2 __ldg(const int2* ptr) { return ptr[0]; }
53 
54 __device__ inline static int4 __ldg(const int4* ptr) { return ptr[0]; }
55 
56 __device__ inline static unsigned int __ldg(const unsigned int* ptr) { return ptr[0]; }
57 
58 
59 __device__ inline static long __ldg(const long* ptr) { return ptr[0]; }
60 
61 __device__ inline static unsigned long __ldg(const unsigned long* ptr) { return ptr[0]; }
62 
63 
64 __device__ inline static long long __ldg(const long long* ptr) { return ptr[0]; }
65 
66 __device__ inline static longlong2 __ldg(const longlong2* ptr) { return ptr[0]; }
67 
68 __device__ inline static unsigned long long __ldg(const unsigned long long* ptr) { return ptr[0]; }
69 
70 
71 __device__ inline static uchar2 __ldg(const uchar2* ptr) { return ptr[0]; }
72 
73 __device__ inline static uchar4 __ldg(const uchar4* ptr) { return ptr[0]; }
74 
75 
76 __device__ inline static ushort2 __ldg(const ushort2* ptr) { return ptr[0]; }
77 
78 
79 __device__ inline static uint2 __ldg(const uint2* ptr) { return ptr[0]; }
80 
81 __device__ inline static uint4 __ldg(const uint4* ptr) { return ptr[0]; }
82 
83 
84 __device__ inline static ulonglong2 __ldg(const ulonglong2* ptr) { return ptr[0]; }
85 
86 
87 __device__ inline static float __ldg(const float* ptr) { return ptr[0]; }
88 
89 __device__ inline static float2 __ldg(const float2* ptr) { return ptr[0]; }
90 
91 __device__ inline static float4 __ldg(const float4* ptr) { return ptr[0]; }
92 
93 
94 __device__ inline static double __ldg(const double* ptr) { return ptr[0]; }
95 
96 __device__ inline static double2 __ldg(const double2* ptr) { return ptr[0]; }
97 
98 #endif // __HIP_CLANG_ONLY__
99 
100 #endif // HIP_LDG_H
uint2
Definition: hip_vector_types.h:1539
longlong2
Definition: hip_vector_types.h:1560
int4
Definition: hip_vector_types.h:1533
uchar2
Definition: hip_vector_types.h:1511
char4
Definition: hip_vector_types.h:1505
char2
Definition: hip_vector_types.h:1504
double2
Definition: hip_vector_types.h:1581
float4
Definition: hip_vector_types.h:1575
int2
Definition: hip_vector_types.h:1532
host_defines.h
TODO-doc.
float2
Definition: hip_vector_types.h:1574
short4
Definition: hip_vector_types.h:1519
ulonglong2
Definition: hip_vector_types.h:1567
uchar4
Definition: hip_vector_types.h:1512
short2
Definition: hip_vector_types.h:1518
ushort2
Definition: hip_vector_types.h:1525
uint4
Definition: hip_vector_types.h:1540