Blender
V4.3
intern
cycles
util
types_float8_impl.h
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2017 Intel Corporation
2
* SPDX-FileCopyrightText: 2018-2022 Blender Foundation
3
*
4
* SPDX-License-Identifier: BSD-3-Clause
5
*
6
* Originally by Intel Corporation, modified by the Blender Foundation. */
7
8
#pragma once
9
10
#ifndef __UTIL_TYPES_H__
11
# error "Do not include this file directly, include util/types.h instead."
12
#endif
13
14
CCL_NAMESPACE_BEGIN
15
16
#ifdef __KERNEL_AVX__
17
__forceinline
vfloat8::vfloat8() {}
18
19
__forceinline
vfloat8::vfloat8(
const
vfloat8 &f) : m256(f.m256) {}
20
21
__forceinline
vfloat8::vfloat8(
const
__m256 &f) : m256(f) {}
22
23
__forceinline
vfloat8::operator
const
__m256 &()
const
24
{
25
return
m256;
26
}
27
28
__forceinline
vfloat8::operator __m256 &()
29
{
30
return
m256;
31
}
32
33
__forceinline
vfloat8 &vfloat8::operator=(
const
vfloat8 &f)
34
{
35
m256 = f.m256;
36
return
*
this
;
37
}
38
#endif
/* __KERNEL_AVX__ */
39
40
#ifndef __KERNEL_GPU__
41
__forceinline
float
vfloat8::operator[](
int
i)
const
42
{
43
util_assert
(i >= 0);
44
util_assert
(i < 8);
45
return
*(&a + i);
46
}
47
48
__forceinline
float
&vfloat8::operator[](
int
i)
49
{
50
util_assert
(i >= 0);
51
util_assert
(i < 8);
52
return
*(&a + i);
53
}
54
#endif
55
56
ccl_device_inline
vfloat8
make_vfloat8
(
float
f)
57
{
58
#ifdef __KERNEL_AVX__
59
vfloat8 r(_mm256_set1_ps(f));
60
#else
61
vfloat8 r = {f, f, f, f, f, f, f, f};
62
#endif
63
return
r;
64
}
65
66
ccl_device_inline
vfloat8
67
make_vfloat8
(
float
a,
float
b
,
float
c,
float
d,
float
e
,
float
f,
float
g,
float
h)
68
{
69
#ifdef __KERNEL_AVX__
70
vfloat8 r(_mm256_setr_ps(a,
b
, c, d,
e
, f, g, h));
71
#else
72
vfloat8 r = {a,
b
, c, d,
e
, f, g, h};
73
#endif
74
return
r;
75
}
76
77
ccl_device_inline
vfloat8
make_vfloat8
(
const
float4 a,
const
float4
b
)
78
{
79
#ifdef __KERNEL_AVX__
80
return
vfloat8(_mm256_insertf128_ps(_mm256_castps128_ps256(a),
b
, 1));
81
#else
82
return
make_vfloat8
(a.x, a.y, a.z, a.w,
b
.x,
b
.y,
b
.z,
b
.w);
83
#endif
84
}
85
86
ccl_device_inline
void
print_vfloat8
(
ccl_private
const
char
*
label
,
const
vfloat8 a)
87
{
88
#ifdef __KERNEL_PRINTF__
89
printf
(
"%s: %.8f %.8f %.8f %.8f %.8f %.8f %.8f %.8f\n"
,
90
label
,
91
(
double
)a.a,
92
(
double
)a.b,
93
(
double
)a.c,
94
(
double
)a.d,
95
(
double
)a.e,
96
(
double
)a.f,
97
(
double
)a.g,
98
(
double
)a.h);
99
#endif
100
}
101
102
CCL_NAMESPACE_END
e
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
Definition
bmesh_query_inline.hh:36
b
local_group_size(16, 16) .push_constant(Type b
Definition
compositor_morphological_distance_info.hh:16
printf
#define printf
util_assert
#define util_assert(statement)
Definition
defines.h:98
label
const char * label
Definition
deg_debug_stats_gnuplot.cc:32
ccl_private
#define ccl_private
Definition
device/cuda/compat.h:51
ccl_device_inline
#define ccl_device_inline
Definition
device/cuda/compat.h:36
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition
device/cuda/compat.h:10
__forceinline
#define __forceinline
Definition
device/oneapi/compat.h:234
CCL_NAMESPACE_BEGIN
Definition
python.cpp:44
make_vfloat8
ccl_device_inline vfloat8 make_vfloat8(float f)
Definition
types_float8_impl.h:56
print_vfloat8
ccl_device_inline void print_vfloat8(ccl_private const char *label, const vfloat8 a)
Definition
types_float8_impl.h:86
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0