#pragma once #include #if !defined(__CUDACC__) && !defined(__HIPCC__) #include #include #endif namespace at::native::ufunc { template C10_HOST_DEVICE C10_ALWAYS_INLINE T add(T self, T other, T alpha) __ubsan_ignore_undefined__ { return self + alpha * other; } #if !defined(__CUDACC__) && !defined(__HIPCC__) using vec::Vectorized; template C10_ALWAYS_INLINE Vectorized add(Vectorized self, Vectorized other, Vectorized alpha) __ubsan_ignore_undefined__ { return vec::fmadd(other, alpha, self); } #endif } // namespace at::native::ufunc