Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
surface_indirect_functions.h244 linesDownload Raw Back to include
1/*
2 * Copyright 1993-2022 NVIDIA Corporation.  All rights reserved.
3 *
4 * NOTICE TO LICENSEE:
5 *
6 * This source code and/or documentation ("Licensed Deliverables") are
7 * subject to NVIDIA intellectual property rights under U.S. and
8 * international Copyright laws.
9 *
10 * These Licensed Deliverables contained herein is PROPRIETARY and
11 * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12 * conditions of a form of NVIDIA software license agreement by and
13 * between NVIDIA and Licensee ("License Agreement") or electronically
14 * accepted by Licensee.  Notwithstanding any terms or conditions to
15 * the contrary in the License Agreement, reproduction or disclosure
16 * of the Licensed Deliverables to any third party without the express
17 * written consent of NVIDIA is prohibited.
18 *
19 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20 * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21 * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE.  IT IS
22 * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23 * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24 * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25 * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27 * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28 * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 * OF THESE LICENSED DELIVERABLES.
33 *
34 * U.S. Government End Users.  These Licensed Deliverables are a
35 * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36 * 1995), consisting of "commercial computer software" and "commercial
37 * computer software documentation" as such terms are used in 48
38 * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39 * only as a commercial end item.  Consistent with 48 C.F.R.12.212 and
40 * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41 * U.S. Government End Users acquire the Licensed Deliverables with
42 * only those rights set forth herein.
43 *
44 * Any use of the Licensed Deliverables in individual and commercial
45 * software must include, in the user documentation and internal
46 * comments to the code, the above Disclaimer and U.S. Government End
47 * Users Notice.
48 */
49
50
51#ifndef __SURFACE_INDIRECT_FUNCTIONS_H__
52#define __SURFACE_INDIRECT_FUNCTIONS_H__
53
54#if defined(__cplusplus) && defined(__CUDACC__)
55
56#include "cuda_runtime_api.h"
57
58template<typename T> struct __nv_isurf_trait { };
59template<> struct __nv_isurf_trait<char> { typedef void type; };
60template<> struct __nv_isurf_trait<signed char> { typedef void type; };
61template<> struct __nv_isurf_trait<char1> { typedef void type; };
62template<> struct __nv_isurf_trait<unsigned char> { typedef void type; };
63template<> struct __nv_isurf_trait<uchar1> { typedef void type; };
64template<> struct __nv_isurf_trait<short> { typedef void type; };
65template<> struct __nv_isurf_trait<short1> { typedef void type; };
66template<> struct __nv_isurf_trait<unsigned short> { typedef void type; };
67template<> struct __nv_isurf_trait<ushort1> { typedef void type; };
68template<> struct __nv_isurf_trait<int> { typedef void type; };
69template<> struct __nv_isurf_trait<int1> { typedef void type; };
70template<> struct __nv_isurf_trait<unsigned int> { typedef void type; };
71template<> struct __nv_isurf_trait<uint1> { typedef void type; };
72template<> struct __nv_isurf_trait<long long> { typedef void type; };
73template<> struct __nv_isurf_trait<longlong1> { typedef void type; };
74template<> struct __nv_isurf_trait<unsigned long long> { typedef void type; };
75template<> struct __nv_isurf_trait<ulonglong1> { typedef void type; };
76template<> struct __nv_isurf_trait<float> { typedef void type; };
77template<> struct __nv_isurf_trait<float1> { typedef void type; };
78
79template<> struct __nv_isurf_trait<char2> { typedef void type; };
80template<> struct __nv_isurf_trait<uchar2> { typedef void type; };
81template<> struct __nv_isurf_trait<short2> { typedef void type; };
82template<> struct __nv_isurf_trait<ushort2> { typedef void type; };
83template<> struct __nv_isurf_trait<int2> { typedef void type; };
84template<> struct __nv_isurf_trait<uint2> { typedef void type; };
85template<> struct __nv_isurf_trait<longlong2> { typedef void type; };
86template<> struct __nv_isurf_trait<ulonglong2> { typedef void type; };
87template<> struct __nv_isurf_trait<float2> { typedef void type; };
88
89template<> struct __nv_isurf_trait<char4> { typedef void type; };
90template<> struct __nv_isurf_trait<uchar4> { typedef void type; };
91template<> struct __nv_isurf_trait<short4> { typedef void type; };
92template<> struct __nv_isurf_trait<ushort4> { typedef void type; };
93template<> struct __nv_isurf_trait<int4> { typedef void type; };
94template<> struct __nv_isurf_trait<uint4> { typedef void type; };
95template<> struct __nv_isurf_trait<float4> { typedef void type; };
96
97
98template <typename T>
99static __device__ typename __nv_isurf_trait<T>::type  surf1Dread(T *ptr, cudaSurfaceObject_t obj, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
100{
101  __nv_tex_surf_handler("__isurf1Dread", ptr, obj, x, mode);
102}
103
104template <class T>
105static __device__ T surf1Dread(cudaSurfaceObject_t surfObject, int x, cudaSurfaceBoundaryMode boundaryMode = cudaBoundaryModeTrap)
106{
107   T ret;
108   surf1Dread(&ret, surfObject, x, boundaryMode);
109   return ret;
110}
111
112template <typename T>
113static __device__ typename __nv_isurf_trait<T>::type  surf2Dread(T *ptr, cudaSurfaceObject_t obj, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
114{
115  __nv_tex_surf_handler("__isurf2Dread", ptr, obj, x, y, mode);
116}
117
118template <class T>
119static __device__ T surf2Dread(cudaSurfaceObject_t surfObject, int x, int y, cudaSurfaceBoundaryMode boundaryMode = cudaBoundaryModeTrap)
120{
121   T ret;
122   surf2Dread(&ret, surfObject, x, y, boundaryMode);
123   return ret;
124}
125
126
127template <typename T>
128static __device__ typename  __nv_isurf_trait<T>::type  surf3Dread(T *ptr, cudaSurfaceObject_t obj, int x, int y, int z, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
129{
130  __nv_tex_surf_handler("__isurf3Dread", ptr, obj, x, y, z, mode);
131}
132
133template <class T>
134static __device__ T surf3Dread(cudaSurfaceObject_t surfObject, int x, int y, int z, cudaSurfaceBoundaryMode boundaryMode = cudaBoundaryModeTrap)
135{
136   T ret;
137   surf3Dread(&ret, surfObject, x, y, z, boundaryMode);
138   return ret;
139}
140
141template <typename T>
142static __device__ typename  __nv_isurf_trait<T>::type  surf1DLayeredread(T *ptr, cudaSurfaceObject_t obj, int x, int layer, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
143{
144  __nv_tex_surf_handler("__isurf1DLayeredread", ptr, obj, x, layer, mode);
145}
146
147template <class T>
148static __device__ T surf1DLayeredread(cudaSurfaceObject_t surfObject, int x, int layer, cudaSurfaceBoundaryMode boundaryMode = cudaBoundaryModeTrap)
149{
150   T ret;
151   surf1DLayeredread(&ret, surfObject, x, layer, boundaryMode);
152   return ret;
153}
154
155template <typename T>
156static __device__  typename __nv_isurf_trait<T>::type  surf2DLayeredread(T *ptr, cudaSurfaceObject_t obj, int x, int y, int layer, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
157{
158  __nv_tex_surf_handler("__isurf2DLayeredread", ptr, obj, x, y, layer, mode);
159}
160
161template <class T>
162static __device__ T surf2DLayeredread(cudaSurfaceObject_t surfObject, int x, int y, int layer, cudaSurfaceBoundaryMode boundaryMode = cudaBoundaryModeTrap)
163{
164   T ret;
165   surf2DLayeredread(&ret, surfObject, x, y, layer, boundaryMode);
166   return ret;
167}
168
169template <typename T>
170static __device__ typename __nv_isurf_trait<T>::type  surfCubemapread(T *ptr, cudaSurfaceObject_t obj, int x, int y, int face, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
171{
172  __nv_tex_surf_handler("__isurfCubemapread", ptr, obj, x, y, face, mode);
173}
174
175template <class T>
176static __device__ T surfCubemapread(cudaSurfaceObject_t surfObject, int x, int y, int face, cudaSurfaceBoundaryMode boundaryMode = cudaBoundaryModeTrap)
177{
178   T ret;
179   surfCubemapread(&ret, surfObject, x, y, face, boundaryMode);
180   return ret;
181}
182
183template <typename T>
184static __device__  typename __nv_isurf_trait<T>::type  surfCubemapLayeredread(T *ptr, cudaSurfaceObject_t obj, int x, int y, int layerface, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
185{
186  __nv_tex_surf_handler("__isurfCubemapLayeredread", ptr, obj, x, y, layerface, mode);
187}
188
189template <class T>
190static __device__ T surfCubemapLayeredread(cudaSurfaceObject_t surfObject, int x, int y, int layerface, cudaSurfaceBoundaryMode boundaryMode = cudaBoundaryModeTrap)
191{
192   T ret;
193   surfCubemapLayeredread(&ret, surfObject, x, y, layerface, boundaryMode);
194   return ret;
195}
196
197template <typename T>
198static __device__ typename __nv_isurf_trait<T>::type surf1Dwrite(T val, cudaSurfaceObject_t obj, int x, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
199{ 
200  __nv_tex_surf_handler("__isurf1Dwrite_v2", &val, obj, x, mode);
201}
202
203template <typename T>
204static __device__ typename __nv_isurf_trait<T>::type surf2Dwrite(T val, cudaSurfaceObject_t obj, int x, int y, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
205{
206  __nv_tex_surf_handler("__isurf2Dwrite_v2", &val, obj, x, y, mode);
207}
208
209template <typename T>
210static __device__ typename __nv_isurf_trait<T>::type surf3Dwrite(T val, cudaSurfaceObject_t obj, int x, int y, int z, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
211{
212  __nv_tex_surf_handler("__isurf3Dwrite_v2", &val, obj, x, y, z, mode);
213}
214
215template <typename T>
216static __device__ typename __nv_isurf_trait<T>::type surf1DLayeredwrite(T val, cudaSurfaceObject_t obj, int x, int layer, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
217{
218  __nv_tex_surf_handler("__isurf1DLayeredwrite_v2", &val, obj, x, layer, mode);
219}
220
221template <typename T>
222static __device__ typename __nv_isurf_trait<T>::type surf2DLayeredwrite(T val, cudaSurfaceObject_t obj, int x, int y, int layer, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
223{
224  __nv_tex_surf_handler("__isurf2DLayeredwrite_v2", &val, obj, x, y, layer, mode);
225}
226
227template <typename T>
228static __device__ typename __nv_isurf_trait<T>::type surfCubemapwrite(T val, cudaSurfaceObject_t obj, int x, int y, int face, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
229{
230  __nv_tex_surf_handler("__isurfCubemapwrite_v2", &val, obj, x, y, face, mode);
231}
232
233template <typename T>
234static __device__ typename __nv_isurf_trait<T>::type surfCubemapLayeredwrite(T val, cudaSurfaceObject_t obj, int x, int y, int layerface, cudaSurfaceBoundaryMode mode = cudaBoundaryModeTrap)
235{
236  __nv_tex_surf_handler("__isurfCubemapLayeredwrite_v2", &val, obj, x, y, layerface, mode);
237}
238
239#endif // __cplusplus && __CUDACC__
240
241#endif // __SURFACE_INDIRECT_FUNCTIONS_H__
242
243
244 
codekingpro/portable-devtools · Team Ai