Update device.h for hip_bfloat16 inclusion guard (#2107)

* Update device.h for hip_bfloat16 inclusion guard

Prevents other files in rocm include the old hip/hip_bfloat16.h, which is guarded by _HIP_INCLUDE_HIP_AMD_DETAIL_HIP_BFLOAT16_H_ and _HIP_BFLOAT16_H_

* Update device.h to handle old hip_bfloat16.h

Added a workaround for old hip_bfloat16.h header usage.

[ROCm/rccl commit: 8e4dbfdf37]
이 커밋은 다음에 포함됨:
Dingming Wu
2026-01-09 06:45:47 -08:00
커밋한 사람 GitHub
부모 94499918b3
커밋 4e15dc142c
+10 -3
파일 보기
@@ -12,9 +12,16 @@
#include "nccl.h"
#include "rccl_float8.h"
#if ROCM_VERSION >= 60000
// hip_bf16.h should be used from ROCm 6.0
#include <hip/hip_bf16.h>
typedef __hip_bfloat16 hip_bfloat16;
// This is a workaround for the fact that the old hip_bfloat16.h header file may still be used by some rocm files.
// The _HIP_INCLUDE_HIP_AMD_DETAIL_HIP_BFLOAT16_H_ and _HIP_BFLOAT16_H_ macros are defined in the old hip_bfloat16.h header
#if !defined(_HIP_INCLUDE_HIP_AMD_DETAIL_HIP_BFLOAT16_H_) && !defined(_HIP_BFLOAT16_H_)
#define _HIP_INCLUDE_HIP_AMD_DETAIL_HIP_BFLOAT16_H_
#define _HIP_BFLOAT16_H_
#include <hip/hip_bf16.h>
typedef __hip_bfloat16 hip_bfloat16;
#else
#error "RCCL is not using the correct hip_bf16.h file. Please make sure that the correct header is included!"
#endif
#else
#include <hip/hip_bfloat16.h>
#endif