Skip to content

Commit 0dfbc70

Browse files
committed
Use fabsf for a floating point number instead of ::abs which is
integer-only on ROCm. Still not ideal, but we do not have an intrinsic habs(__half)
1 parent fe465db commit 0dfbc70

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

aten/src/THC/THCNumerics.cuh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,11 @@ struct THCNumerics<half> {
309309
}
310310

311311
static inline __host__ __device__ half abs(half a) {
312+
#if defined(__HIP_PLATFORM_HCC__)
313+
return static_cast<at::Half>(fabsf(static_cast<at::Half>(a)));
314+
#else
312315
return static_cast<at::Half>(::abs(static_cast<at::Half>(a)));
316+
#endif
313317
}
314318

315319
static inline __host__ __device__ half round(half a) {

0 commit comments

Comments
 (0)