HIP: Heterogenous-computing Interface for Portability
hip_ldg.h
1 /*
2 Copyright (c) 2015 - 2021 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 "amd_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
Definition: amd_hip_vector_types.h:1665
Definition: amd_hip_vector_types.h:1672
Definition: amd_hip_vector_types.h:1702
Definition: amd_hip_vector_types.h:1709
Definition: amd_hip_vector_types.h:1739
Definition: amd_hip_vector_types.h:1746
Definition: amd_hip_vector_types.h:1776
Definition: amd_hip_vector_types.h:1813
Definition: amd_hip_vector_types.h:1820
Definition: amd_hip_vector_types.h:1850
Definition: amd_hip_vector_types.h:1857
Definition: amd_hip_vector_types.h:1961
Definition: amd_hip_vector_types.h:1998
Definition: amd_hip_vector_types.h:2035
Definition: amd_hip_vector_types.h:2042
Definition: amd_hip_vector_types.h:2072