Skip to content

Commit

Permalink
Fix redefinition of half when using with hip-runtime-amd (AcademySoft…
Browse files Browse the repository at this point in the history
…wareFoundation#426)

Check for __HIP__ in addition to cuda (see AcademySoftwareFoundation#424)

Signed-off-by: Cary Phillips <[email protected]>
  • Loading branch information
cary-ilm authored Sep 4, 2024
1 parent e32be5c commit a2ef565
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Imath/half.h
Original file line number Diff line number Diff line change
Expand Up @@ -985,11 +985,13 @@ IMATH_EXPORT void printBits (std::ostream& os, float f);
IMATH_EXPORT void printBits (char c[19], IMATH_INTERNAL_NAMESPACE::half h);
IMATH_EXPORT void printBits (char c[35], float f);

# if !defined(__CUDACC__) && !defined(__CUDA_FP16_HPP__)
#if !defined(__CUDACC__) && !defined(__CUDA_FP16_HPP__) && !defined(__HIP__)
using half = IMATH_INTERNAL_NAMESPACE::half;
# else
# include <cuda_fp16.h>
# endif
#elif defined(__CUDACC__) || defined(__CUDA_FP16_HPP__)
#include <cuda_fp16.h>
#elif defined(__HIP__)
#include <hip/amd_detail/amd_hip_fp16.h>
#endif

#endif // __cplusplus

Expand Down

0 comments on commit a2ef565

Please sign in to comment.