Skip to content

Commit

Permalink
[HIPIFY][ROCm#1617][fp8] Support for fp8 math - Part 2 - Functions
Browse files Browse the repository at this point in the history
+ Updated the regenerated `hipify-perl` and `Device` `CUDA2HIP` docs accordingly
+ [ToDo] Tests for all Device API
  • Loading branch information
emankov committed Nov 21, 2024
1 parent fa8213f commit 83f64c9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 30 deletions.
20 changes: 10 additions & 10 deletions bin/hipify-perl
Original file line number Diff line number Diff line change
Expand Up @@ -8682,6 +8682,16 @@ sub countSupportedDeviceFunctions {
"__powf",
"__popcll",
"__popc",
"__nv_cvt_halfraw_to_fp8",
"__nv_cvt_halfraw2_to_fp8x2",
"__nv_cvt_fp8x2_to_halfraw2",
"__nv_cvt_fp8_to_halfraw",
"__nv_cvt_float_to_fp8",
"__nv_cvt_float2_to_fp8x2",
"__nv_cvt_double_to_fp8",
"__nv_cvt_double2_to_fp8x2",
"__nv_cvt_bfloat16raw_to_fp8",
"__nv_cvt_bfloat16raw2_to_fp8x2",
"__mulhi",
"__mul64hi",
"__mul24",
Expand Down Expand Up @@ -9061,16 +9071,6 @@ sub warnUnsupportedDeviceFunctions {
"__pm2",
"__pm1",
"__pm0",
"__nv_cvt_halfraw_to_fp8",
"__nv_cvt_halfraw2_to_fp8x2",
"__nv_cvt_fp8x2_to_halfraw2",
"__nv_cvt_fp8_to_halfraw",
"__nv_cvt_float_to_fp8",
"__nv_cvt_float2_to_fp8x2",
"__nv_cvt_double_to_fp8",
"__nv_cvt_double2_to_fp8x2",
"__nv_cvt_bfloat16raw_to_fp8",
"__nv_cvt_bfloat16raw2_to_fp8x2",
"__lows2bfloat162",
"__low2bfloat162",
"__low2bfloat16",
Expand Down
20 changes: 10 additions & 10 deletions docs/tables/CUDA_Device_API_supported_by_HIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,16 @@
|`__mul24`| | | | |`__mul24`|1.6.0| | | | |
|`__mul64hi`| | | | |`__mul64hi`|1.6.0| | | | |
|`__mulhi`| | | | |`__mulhi`|1.6.0| | | | |
|`__nv_cvt_bfloat16raw2_to_fp8x2`|11.8| | | | | | | | | |
|`__nv_cvt_bfloat16raw_to_fp8`|11.8| | | | | | | | | |
|`__nv_cvt_double2_to_fp8x2`|11.8| | | | | | | | | |
|`__nv_cvt_double_to_fp8`|11.8| | | | | | | | | |
|`__nv_cvt_float2_to_fp8x2`|11.8| | | | | | | | | |
|`__nv_cvt_float_to_fp8`|11.8| | | | | | | | | |
|`__nv_cvt_fp8_to_halfraw`|11.8| | | | | | | | | |
|`__nv_cvt_fp8x2_to_halfraw2`|11.8| | | | | | | | | |
|`__nv_cvt_halfraw2_to_fp8x2`|11.8| | | | | | | | | |
|`__nv_cvt_halfraw_to_fp8`|11.8| | | | | | | | | |
|`__nv_cvt_bfloat16raw2_to_fp8x2`|11.8| | | |`__hip_cvt_bfloat16raw2_to_fp8x2`|6.2.0| | | | |
|`__nv_cvt_bfloat16raw_to_fp8`|11.8| | | |`__hip_cvt_bfloat16raw_to_fp8`|6.2.0| | | | |
|`__nv_cvt_double2_to_fp8x2`|11.8| | | |`__hip_cvt_double2_to_fp8x2`|6.2.0| | | | |
|`__nv_cvt_double_to_fp8`|11.8| | | |`__hip_cvt_double_to_fp8`|6.2.0| | | | |
|`__nv_cvt_float2_to_fp8x2`|11.8| | | |`__hip_cvt_float2_to_fp8x2`|6.2.0| | | | |
|`__nv_cvt_float_to_fp8`|11.8| | | |`__hip_cvt_float_to_fp8`|6.2.0| | | | |
|`__nv_cvt_fp8_to_halfraw`|11.8| | | |`__hip_cvt_fp8_to_halfraw`|6.2.0| | | | |
|`__nv_cvt_fp8x2_to_halfraw2`|11.8| | | |`__hip_cvt_fp8x2_to_halfraw2`|6.2.0| | | | |
|`__nv_cvt_halfraw2_to_fp8x2`|11.8| | | |`__hip_cvt_halfraw2_to_fp8x2`|6.2.0| | | | |
|`__nv_cvt_halfraw_to_fp8`|11.8| | | |`__hip_cvt_halfraw_to_fp8`|6.2.0| | | | |
|`__pm0`| | | | | | | | | | |
|`__pm1`| | | | | | | | | | |
|`__pm2`| | | | | | | | | | |
Expand Down
30 changes: 20 additions & 10 deletions src/CUDA2HIP_Device_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,16 +819,16 @@ const std::map<llvm::StringRef, hipCounter> CUDA_DEVICE_FUNCTION_MAP {
{"__assert_fail", {"__assert_fail", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__assertfail", {"__assertfail", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
// fp8 functions
{"__nv_cvt_double_to_fp8", {"__hip_cvt_double_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_double2_to_fp8x2", {"__hip_cvt_double2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_float_to_fp8", {"__hip_cvt_float_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_float2_to_fp8x2", {"__hip_cvt_float2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_halfraw_to_fp8", {"__hip_cvt_halfraw_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_halfraw2_to_fp8x2", {"__hip_cvt_halfraw2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_bfloat16raw_to_fp8", {"__hip_cvt_bfloat16raw_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_bfloat16raw2_to_fp8x2", {"__hip_cvt_bfloat16raw2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_fp8_to_halfraw", {"__hip_cvt_fp8_to_halfraw", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_fp8x2_to_halfraw2", {"__hip_cvt_fp8x2_to_halfraw2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1, UNSUPPORTED}},
{"__nv_cvt_double_to_fp8", {"__hip_cvt_double_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_double2_to_fp8x2", {"__hip_cvt_double2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_float_to_fp8", {"__hip_cvt_float_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_float2_to_fp8x2", {"__hip_cvt_float2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_halfraw_to_fp8", {"__hip_cvt_halfraw_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_halfraw2_to_fp8x2", {"__hip_cvt_halfraw2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_bfloat16raw_to_fp8", {"__hip_cvt_bfloat16raw_to_fp8", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_bfloat16raw2_to_fp8x2", {"__hip_cvt_bfloat16raw2_to_fp8x2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_fp8_to_halfraw", {"__hip_cvt_fp8_to_halfraw", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__nv_cvt_fp8x2_to_halfraw2", {"__hip_cvt_fp8x2_to_halfraw2", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
// intrinsics
{"__all_sync", {"__all_sync", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
{"__any_sync", {"__any_sync", "", CONV_DEVICE_FUNC, API_RUNTIME, 1}},
Expand Down Expand Up @@ -1498,6 +1498,16 @@ const std::map<llvm::StringRef, hipAPIversions> HIP_DEVICE_FUNCTION_VER_MAP {
{"__shfl_up_sync", {HIP_6020, HIP_0, HIP_0 }},
{"__shfl_down_sync", {HIP_6020, HIP_0, HIP_0 }},
{"__shfl_xor_sync", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_double_to_fp8", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_double2_to_fp8x2", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_float_to_fp8", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_float2_to_fp8x2", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_halfraw_to_fp8", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_halfraw2_to_fp8x2", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_bfloat16raw_to_fp8", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_bfloat16raw2_to_fp8x2", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_fp8_to_halfraw", {HIP_6020, HIP_0, HIP_0 }},
{"__hip_cvt_fp8x2_to_halfraw2", {HIP_6020, HIP_0, HIP_0 }},
};

const std::map<unsigned int, llvm::StringRef> CUDA_DEVICE_FUNCTION_API_SECTION_MAP {
Expand Down

0 comments on commit 83f64c9

Please sign in to comment.