[Bf-blender-cvs] [b862cf0b9fc] blender-v3.3-release: Fix Cycles build error with CUDA on arm64

Tianhao Chai noreply at git.blender.org
Fri Jul 29 15:07:39 CEST 2022


Commit: b862cf0b9fc72a9f2b154bce0163558f577e3f58
Author: Tianhao Chai
Date:   Fri Jul 29 14:48:52 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBb862cf0b9fc72a9f2b154bce0163558f577e3f58

Fix Cycles build error with CUDA on arm64

Checking arm64 assembly support before CUDA/Metal would cause NVCC to
generate inline arm64 assembly.

Differential Revision: https://developer.blender.org/D15569

===================================================================

M	intern/cycles/util/math.h

===================================================================

diff --git a/intern/cycles/util/math.h b/intern/cycles/util/math.h
index 2631304c84b..f6400cb879f 100644
--- a/intern/cycles/util/math.h
+++ b/intern/cycles/util/math.h
@@ -953,7 +953,11 @@ ccl_device_inline uint prev_power_of_two(uint x)
 ccl_device_inline uint32_t reverse_integer_bits(uint32_t x)
 {
   /* Use a native instruction if it exists. */
-#if defined(__aarch64__) || defined(_M_ARM64)
+#if defined(__KERNEL_CUDA__)
+  return __brev(x);
+#elif defined(__KERNEL_METAL__)
+  return reverse_bits(x);
+#elif defined(__aarch64__) || defined(_M_ARM64)
   /* Assume the rbit is always available on 64bit ARM architecture. */
   __asm__("rbit %w0, %w1" : "=r"(x) : "r"(x));
   return x;
@@ -962,10 +966,6 @@ ccl_device_inline uint32_t reverse_integer_bits(uint32_t x)
    * This 32-bit Thumb instruction is available in ARMv6T2 and above. */
   __asm__("rbit %0, %1" : "=r"(x) : "r"(x));
   return x;
-#elif defined(__KERNEL_CUDA__)
-  return __brev(x);
-#elif defined(__KERNEL_METAL__)
-  return reverse_bits(x);
 #elif __has_builtin(__builtin_bitreverse32)
   return __builtin_bitreverse32(x);
 #else



More information about the Bf-blender-cvs mailing list