kernel_containers.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #if defined(__CUDACC__)
4  #define __kf_hdevice__ __host__ __device__ __forceinline__
5  #define __kf_device__ __device__ __forceinline__
6 #else
7  #define __kf_hdevice__
8  #define __kf_device__
9 #endif
10 
11 #include <cstddef>
12 
13 namespace kfusion
14 {
15  namespace cuda
16  {
17  template<typename T> struct DevPtr
18  {
19  typedef T elem_type;
20  const static size_t elem_size = sizeof(elem_type);
21 
22  T* data;
23 
24  __kf_hdevice__ DevPtr() : data(0) {}
25  __kf_hdevice__ DevPtr(T* data_arg) : data(data_arg) {}
26 
27  __kf_hdevice__ size_t elemSize() const { return elem_size; }
28  __kf_hdevice__ operator T*() { return data; }
29  __kf_hdevice__ operator const T*() const { return data; }
30  };
31 
32  template<typename T> struct PtrSz : public DevPtr<T>
33  {
34  __kf_hdevice__ PtrSz() : size(0) {}
35  __kf_hdevice__ PtrSz(T* data_arg, size_t size_arg) : DevPtr<T>(data_arg), size(size_arg) {}
36 
37  size_t size;
38  };
39 
40  template<typename T> struct PtrStep : public DevPtr<T>
41  {
43  __kf_hdevice__ PtrStep(T* data_arg, size_t step_arg) : DevPtr<T>(data_arg), step(step_arg) {}
44 
46  size_t step;
47 
48  __kf_hdevice__ T* ptr(int y = 0) { return ( T*)( ( char*)DevPtr<T>::data + y * step); }
49  __kf_hdevice__ const T* ptr(int y = 0) const { return (const T*)( (const char*)DevPtr<T>::data + y * step); }
50 
51  __kf_hdevice__ T& operator()(int y, int x) { return ptr(y)[x]; }
52  __kf_hdevice__ const T& operator()(int y, int x) const { return ptr(y)[x]; }
53  };
54 
55  template <typename T> struct PtrStepSz : public PtrStep<T>
56  {
57  __kf_hdevice__ PtrStepSz() : cols(0), rows(0) {}
58  __kf_hdevice__ PtrStepSz(int rows_arg, int cols_arg, T* data_arg, size_t step_arg)
59  : PtrStep<T>(data_arg, step_arg), cols(cols_arg), rows(rows_arg) {}
60 
61  int cols;
62  int rows;
63  };
64  }
65 
66  namespace device
67  {
71  }
72 }
73 
74 namespace kf = kfusion;
75 
__kf_hdevice__ T & operator()(int y, int x)
size_t step
stride between two consecutive rows in bytes. Step is stored always and everywhere in bytes!!! ...
__kf_hdevice__ const T & operator()(int y, int x) const
#define __kf_hdevice__
__kf_hdevice__ size_t elemSize() const
__kf_hdevice__ const T * ptr(int y=0) const
__kf_hdevice__ PtrStep(T *data_arg, size_t step_arg)
__kf_hdevice__ PtrSz()
Utility.
Definition: capture.hpp:8
__kf_hdevice__ PtrSz(T *data_arg, size_t size_arg)
__kf_hdevice__ PtrStepSz(int rows_arg, int cols_arg, T *data_arg, size_t step_arg)
static const size_t elem_size
__kf_hdevice__ T * ptr(int y=0)
__kf_hdevice__ DevPtr(T *data_arg)


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06