Skip to content

Commit bf68fd7

Browse files
authored
[Compile] Fix AMD Compile Error (#25518)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
1 parent de94289 commit bf68fd7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

csrc/quantization/activation_kernels.cu

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@
2323
typedef __hip_bfloat162 __nv_bfloat162;
2424
typedef __hip_bfloat16 __nv_bfloat16;
2525
typedef __hip_bfloat16_raw __nv_bfloat16_raw;
26-
26+
#if defined(HIP_FP8_TYPE_OCP)
2727
typedef __hip_fp8_e4m3 __nv_fp8_e4m3;
2828
typedef __hip_fp8x4_e4m3 __nv_fp8x4_e4m3;
29+
#else
30+
// ROCm 6.2 fallback: only *_fnuz types exist
31+
typedef __hip_fp8_e4m3_fnuz __nv_fp8_e4m3;
32+
typedef __hip_fp8x4_e4m3_fnuz __nv_fp8x4_e4m3;
33+
#endif
2934
#endif
3035

3136
#include "core/registration.h"

csrc/rocm/attention.cu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
#include "../attention/dtype_fp8.cuh"
2626
#include "../quantization/fp8/amd/quant_utils.cuh"
2727

28+
// ROCm 6.2 compatibility: map OCP fp8 types to FNUZ variants if OCP is absent
29+
#if !defined(HIP_FP8_TYPE_OCP)
30+
using __hip_fp8_e4m3 = __hip_fp8_e4m3_fnuz;
31+
using __hip_fp8_e5m2 = __hip_fp8_e5m2_fnuz;
32+
#endif
33+
2834
#if defined(__HIPCC__) && \
2935
(defined(__gfx90a__) || defined(__gfx942__) || defined(__gfx950__))
3036
#define __HIP__GFX9__

0 commit comments

Comments
 (0)