Blender  V3.3
kernel/device/cpu/kernel.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 /* CPU kernel entry points */
5 
6 /* On x86-64, we can assume SSE2, so avoid the extra kernel and compile this
7  * one with SSE2 intrinsics.
8  */
9 #if defined(__x86_64__) || defined(_M_X64)
10 # define __KERNEL_SSE2__
11 #endif
12 
13 /* When building kernel for native machine detect kernel features from the flags
14  * set by compiler.
15  */
16 #ifdef WITH_KERNEL_NATIVE
17 # ifdef __SSE2__
18 # ifndef __KERNEL_SSE2__
19 # define __KERNEL_SSE2__
20 # endif
21 # endif
22 # ifdef __SSE3__
23 # define __KERNEL_SSE3__
24 # endif
25 # ifdef __SSSE3__
26 # define __KERNEL_SSSE3__
27 # endif
28 # ifdef __SSE4_1__
29 # define __KERNEL_SSE41__
30 # endif
31 # ifdef __AVX__
32 # define __KERNEL_SSE__
33 # define __KERNEL_AVX__
34 # endif
35 # ifdef __AVX2__
36 # define __KERNEL_SSE__
37 # define __KERNEL_AVX2__
38 # endif
39 #endif
40 
41 /* quiet unused define warnings */
42 #if defined(__KERNEL_SSE2__)
43 /* do nothing */
44 #endif
45 
47 #define KERNEL_ARCH cpu
49 
51 
52 /* Memory Copy */
53 
54 void kernel_const_copy(KernelGlobalsCPU *kg, const char *name, void *host, size_t)
55 {
56  if (strcmp(name, "data") == 0) {
57  kg->data = *(KernelData *)host;
58  }
59  else {
60  assert(0);
61  }
62 }
63 
64 void kernel_global_memory_copy(KernelGlobalsCPU *kg, const char *name, void *mem, size_t size)
65 {
66  if (0) {
67  }
68 
69 #define KERNEL_DATA_ARRAY(type, tname) \
70  else if (strcmp(name, #tname) == 0) \
71  { \
72  kg->tname.data = (type *)mem; \
73  kg->tname.width = size; \
74  }
75 #include "kernel/data_arrays.h"
76  else {
77  assert(0);
78  }
79 }
80 
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
void kernel_global_memory_copy(KernelGlobalsCPU *kg, const char *name, void *mem, size_t size)
CCL_NAMESPACE_BEGIN void kernel_const_copy(KernelGlobalsCPU *kg, const char *name, void *host, size_t)