Blender  V3.3
hip/compat.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
6 #define __KERNEL_GPU__
7 #define __KERNEL_HIP__
8 #define CCL_NAMESPACE_BEGIN
9 #define CCL_NAMESPACE_END
10 
11 #ifndef ATTR_FALLTHROUGH
12 # define ATTR_FALLTHROUGH
13 #endif
14 
15 #ifdef __HIPCC_RTC__
16 typedef unsigned int uint32_t;
17 typedef unsigned long long uint64_t;
18 #else
19 # include <stdint.h>
20 #endif
21 
22 #ifdef CYCLES_HIPBIN_CC
23 # define FLT_MIN 1.175494350822287507969e-38f
24 # define FLT_MAX 340282346638528859811704183484516925440.0f
25 # define FLT_EPSILON 1.192092896e-07F
26 #endif
27 
28 /* Qualifiers */
29 
30 #define ccl_device __device__ __inline__
31 #define ccl_device_inline __device__ __inline__
32 #define ccl_device_forceinline __device__ __forceinline__
33 #define ccl_device_noinline __device__ __noinline__
34 #define ccl_device_noinline_cpu ccl_device
35 #define ccl_device_inline_method ccl_device
36 #define ccl_global
37 #define ccl_inline_constant __constant__
38 #define ccl_device_constant __constant__ __device__
39 #define ccl_constant const
40 #define ccl_gpu_shared __shared__
41 #define ccl_private
42 #define ccl_may_alias
43 #define ccl_restrict __restrict__
44 #define ccl_loop_no_unroll
45 #define ccl_align(n) __align__(n)
46 #define ccl_optional_struct_init
47 
48 #define kernel_assert(cond)
49 
50 /* Types */
51 #ifdef __HIP__
52 # include "hip/hip_fp16.h"
53 # include "hip/hip_runtime.h"
54 #endif
55 
56 #ifdef _MSC_VER
57 # include <immintrin.h>
58 #endif
59 
60 #define ccl_gpu_thread_idx_x (threadIdx.x)
61 #define ccl_gpu_block_dim_x (blockDim.x)
62 #define ccl_gpu_block_idx_x (blockIdx.x)
63 #define ccl_gpu_grid_dim_x (gridDim.x)
64 #define ccl_gpu_warp_size (warpSize)
65 #define ccl_gpu_thread_mask(thread_warp) uint64_t((1ull << thread_warp) - 1)
66 
67 #define ccl_gpu_global_id_x() (ccl_gpu_block_idx_x * ccl_gpu_block_dim_x + ccl_gpu_thread_idx_x)
68 #define ccl_gpu_global_size_x() (ccl_gpu_grid_dim_x * ccl_gpu_block_dim_x)
69 
70 /* GPU warp synchronization */
71 
72 #define ccl_gpu_syncthreads() __syncthreads()
73 #define ccl_gpu_ballot(predicate) __ballot(predicate)
74 
75 /* GPU texture objects */
76 typedef hipTextureObject_t ccl_gpu_tex_object_2D;
77 typedef hipTextureObject_t ccl_gpu_tex_object_3D;
78 
79 template<typename T>
81  const float x,
82  const float y)
83 {
84  return tex2D<T>(texobj, x, y);
85 }
86 
87 template<typename T>
89  const float x,
90  const float y,
91  const float z)
92 {
93  return tex3D<T>(texobj, x, y, z);
94 }
95 
96 /* Use fast math functions */
97 
98 #define cosf(x) __cosf(((float)(x)))
99 #define sinf(x) __sinf(((float)(x)))
100 #define powf(x, y) __powf(((float)(x)), ((float)(y)))
101 #define tanf(x) __tanf(((float)(x)))
102 #define logf(x) __logf(((float)(x)))
103 #define expf(x) __expf(((float)(x)))
104 
105 /* Types */
106 
107 #include "util/half.h"
108 #include "util/types.h"
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
CUtexObject ccl_gpu_tex_object_3D
Definition: cuda/compat.h:80
CUtexObject ccl_gpu_tex_object_2D
Definition: cuda/compat.h:79
ccl_device_forceinline T ccl_gpu_tex_object_read_2D(const ccl_gpu_tex_object_2D texobj, const float x, const float y)
Definition: hip/compat.h:80
#define ccl_device_forceinline
Definition: hip/compat.h:32
ccl_device_forceinline T ccl_gpu_tex_object_read_3D(const ccl_gpu_tex_object_3D texobj, const float x, const float y, const float z)
Definition: hip/compat.h:88
hipTextureObject_t ccl_gpu_tex_object_3D
Definition: hip/compat.h:77
hipTextureObject_t ccl_gpu_tex_object_2D
Definition: hip/compat.h:76
#define T
unsigned int uint32_t
Definition: stdint.h:80
unsigned __int64 uint64_t
Definition: stdint.h:90