diff --git a/mlx/backend/cuda/device/binary_ops.cuh b/mlx/backend/cuda/device/binary_ops.cuh index 31daf34cb..1ff22cff8 100644 --- a/mlx/backend/cuda/device/binary_ops.cuh +++ b/mlx/backend/cuda/device/binary_ops.cuh @@ -205,8 +205,10 @@ struct Power { if constexpr (cuda::std::is_integral_v) { T res = 1; // Raising an integer to a negative power is undefined - if (exp < 0) { - return 0; + if constexpr (cuda::std::is_signed_v) { + if (exp < 0) { + return 0; + } } while (exp) { if (exp & 1) {