From e1b3d9112730bc3b569ffff732a1558752ded146 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 1 Nov 2022 15:16:55 +0100 Subject: Refactor: replace Cycles sse/avx types by vectorized float4/int4/float8/int8 The distinction existed for legacy reasons, to easily port of Embree intersection code without affecting the main vector types. However we are now using SIMD for these types as well, so no good reason to keep the distinction. Also more consistently pass these vector types by value in inline functions. Previously it was partially changed for functions used by Metal to avoid having to add address space qualifiers, simple to do it everywhere. Also removes function declarations for vector math headers, serves no real purpose. Differential Revision: https://developer.blender.org/D16146 --- intern/cycles/util/types_float8.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'intern/cycles/util/types_float8.h') diff --git a/intern/cycles/util/types_float8.h b/intern/cycles/util/types_float8.h index 29fd632f08e..121141ddfd9 100644 --- a/intern/cycles/util/types_float8.h +++ b/intern/cycles/util/types_float8.h @@ -11,15 +11,15 @@ CCL_NAMESPACE_BEGIN /* float8 is a reserved type in Metal that has not been implemented. For - * that reason this is named float8_t and not using native vector types. */ + * that reason this is named vfloat8 and not using native vector types. */ #ifdef __KERNEL_GPU__ -struct float8_t +struct vfloat8 #else -struct ccl_try_align(32) float8_t +struct ccl_try_align(32) vfloat8 #endif { -#ifdef __KERNEL_AVX2__ +#ifdef __KERNEL_AVX__ union { __m256 m256; struct { @@ -27,18 +27,18 @@ struct ccl_try_align(32) float8_t }; }; - __forceinline float8_t(); - __forceinline float8_t(const float8_t &a); - __forceinline explicit float8_t(const __m256 &a); + __forceinline vfloat8(); + __forceinline vfloat8(const vfloat8 &a); + __forceinline explicit vfloat8(const __m256 &a); __forceinline operator const __m256 &() const; __forceinline operator __m256 &(); - __forceinline float8_t &operator=(const float8_t &a); + __forceinline vfloat8 &operator=(const vfloat8 &a); -#else /* __KERNEL_AVX2__ */ +#else /* __KERNEL_AVX__ */ float a, b, c, d, e, f, g, h; -#endif /* __KERNEL_AVX2__ */ +#endif /* __KERNEL_AVX__ */ #ifndef __KERNEL_GPU__ __forceinline float operator[](int i) const; @@ -46,8 +46,11 @@ struct ccl_try_align(32) float8_t #endif }; -ccl_device_inline float8_t make_float8_t(float f); -ccl_device_inline float8_t -make_float8_t(float a, float b, float c, float d, float e, float f, float g, float h); +ccl_device_inline vfloat8 make_vfloat8(float f); +ccl_device_inline vfloat8 +make_vfloat8(float a, float b, float c, float d, float e, float f, float g, float h); +ccl_device_inline vfloat8 make_vfloat8(const float4 a, const float4 b); + +ccl_device_inline void print_vfloat8(ccl_private const char *label, const vfloat8 a); CCL_NAMESPACE_END -- cgit v1.2.3