From faed5405c85a20f2acc0d2043d8c39d6c9ea0cac Mon Sep 17 00:00:00 2001 From: Christoph Lassner Date: Wed, 11 Nov 2020 14:05:07 -0800 Subject: [PATCH] Fix #442. Summary: This fixed #442 by declaring two math functions to be device-only. Reviewed By: bottler Differential Revision: D24896992 fbshipit-source-id: a15918d06d2a3e6ee5cf250fec7af5f2f50a6164 --- pytorch3d/csrc/pulsar/include/math.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch3d/csrc/pulsar/include/math.h b/pytorch3d/csrc/pulsar/include/math.h index 48995bcc..cb904556 100644 --- a/pytorch3d/csrc/pulsar/include/math.h +++ b/pytorch3d/csrc/pulsar/include/math.h @@ -87,7 +87,7 @@ IHD float3 operator*(const float& a, const float3& b) { return b * a; } -IHD float length(const float3& v) { +INLINE DEVICE float length(const float3& v) { // TODO: benchmark what's faster. return NORM3DF(v.x, v.y, v.z); // return __fsqrt_rn(v.x * v.x + v.y * v.y + v.z * v.z); @@ -107,7 +107,7 @@ IHD float3 rotate( dir_z.x * v.x + dir_z.y * v.y + dir_z.z * v.z); } -IHD float3 normalize(const float3& v) { +INLINE DEVICE float3 normalize(const float3& v) { return v * RNORM3DF(v.x, v.y, v.z); }