Skip to content

Commit 044a03f

Browse files
authored
Merge pull request #2333 from ROCm/upstream_merge_202601282118
[HIPIFY][merge] merge `amd-develop` into `amd-staging`
2 parents 83d907c + b8bfefe commit 044a03f

2 files changed

Lines changed: 94 additions & 70 deletions

File tree

src/CUDA2HIP_Complex_API_functions.cpp

Lines changed: 70 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,62 +23,76 @@ THE SOFTWARE.
2323
#include "CUDA2HIP.h"
2424

2525
// Maps the names of CUDA Complex API functions to the corresponding HIP functions
26-
const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_FUNCTION_MAP {
27-
{"cuCrealf", {"hipCrealf", "", CONV_COMPLEX, API_COMPLEX, 2}},
28-
{"cuCimagf", {"hipCimagf", "", CONV_COMPLEX, API_COMPLEX, 2}},
29-
{"make_cuFloatComplex", {"make_hipFloatComplex", "", CONV_COMPLEX, API_COMPLEX, 2}},
30-
{"cuConjf", {"hipConjf", "", CONV_COMPLEX, API_COMPLEX, 2}},
31-
{"cuCaddf", {"hipCaddf", "", CONV_COMPLEX, API_COMPLEX, 2}},
32-
{"cuCsubf", {"hipCsubf", "", CONV_COMPLEX, API_COMPLEX, 2}},
33-
{"cuCmulf", {"hipCmulf", "", CONV_COMPLEX, API_COMPLEX, 2}},
34-
{"cuCdivf", {"hipCdivf", "", CONV_COMPLEX, API_COMPLEX, 2}},
35-
{"cuCabsf", {"hipCabsf", "", CONV_COMPLEX, API_COMPLEX, 2}},
36-
{"cuCreal", {"hipCreal", "", CONV_COMPLEX, API_COMPLEX, 2}},
37-
{"cuCimag", {"hipCimag", "", CONV_COMPLEX, API_COMPLEX, 2}},
38-
{"make_cuDoubleComplex", {"make_hipDoubleComplex", "", CONV_COMPLEX, API_COMPLEX, 2}},
39-
{"cuConj", {"hipConj", "", CONV_COMPLEX, API_COMPLEX, 2}},
40-
{"cuCadd", {"hipCadd", "", CONV_COMPLEX, API_COMPLEX, 2}},
41-
{"cuCsub", {"hipCsub", "", CONV_COMPLEX, API_COMPLEX, 2}},
42-
{"cuCmul", {"hipCmul", "", CONV_COMPLEX, API_COMPLEX, 2}},
43-
{"cuCdiv", {"hipCdiv", "", CONV_COMPLEX, API_COMPLEX, 2}},
44-
{"cuCabs", {"hipCabs", "", CONV_COMPLEX, API_COMPLEX, 2}},
45-
{"make_cuComplex", {"make_hipComplex", "", CONV_COMPLEX, API_COMPLEX, 2}},
46-
{"cuComplexFloatToDouble", {"hipComplexFloatToDouble", "", CONV_COMPLEX, API_COMPLEX, 2}},
47-
{"cuComplexDoubleToFloat", {"hipComplexDoubleToFloat", "", CONV_COMPLEX, API_COMPLEX, 2}},
48-
{"cuCfmaf", {"hipCfmaf", "", CONV_COMPLEX, API_COMPLEX, 2}},
49-
{"cuCfma", {"hipCfma", "", CONV_COMPLEX, API_COMPLEX, 2}},
50-
};
26+
const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_FUNCTION_MAP = []() {
27+
std::map<llvm::StringRef, hipCounter> m;
5128

52-
const std::map<llvm::StringRef, cudaAPIversions> CUDA_COMPLEX_FUNCTION_VER_MAP {
53-
};
29+
m["cuCrealf"] = {"hipCrealf", "", CONV_COMPLEX, API_COMPLEX, 2};
30+
m["cuCimagf"] = {"hipCimagf", "", CONV_COMPLEX, API_COMPLEX, 2};
31+
m["make_cuFloatComplex"] = {"make_hipFloatComplex", "", CONV_COMPLEX, API_COMPLEX, 2};
32+
m["cuConjf"] = {"hipConjf", "", CONV_COMPLEX, API_COMPLEX, 2};
33+
m["cuCaddf"] = {"hipCaddf", "", CONV_COMPLEX, API_COMPLEX, 2};
34+
m["cuCsubf"] = {"hipCsubf", "", CONV_COMPLEX, API_COMPLEX, 2};
35+
m["cuCmulf"] = {"hipCmulf", "", CONV_COMPLEX, API_COMPLEX, 2};
36+
m["cuCdivf"] = {"hipCdivf", "", CONV_COMPLEX, API_COMPLEX, 2};
37+
m["cuCabsf"] = {"hipCabsf", "", CONV_COMPLEX, API_COMPLEX, 2};
38+
m["cuCreal"] = {"hipCreal", "", CONV_COMPLEX, API_COMPLEX, 2};
39+
m["cuCimag"] = {"hipCimag", "", CONV_COMPLEX, API_COMPLEX, 2};
40+
m["make_cuDoubleComplex"] = {"make_hipDoubleComplex", "", CONV_COMPLEX, API_COMPLEX, 2};
41+
m["cuConj"] = {"hipConj", "", CONV_COMPLEX, API_COMPLEX, 2};
42+
m["cuCadd"] = {"hipCadd", "", CONV_COMPLEX, API_COMPLEX, 2};
43+
m["cuCsub"] = {"hipCsub", "", CONV_COMPLEX, API_COMPLEX, 2};
44+
m["cuCmul"] = {"hipCmul", "", CONV_COMPLEX, API_COMPLEX, 2};
45+
m["cuCdiv"] = {"hipCdiv", "", CONV_COMPLEX, API_COMPLEX, 2};
46+
m["cuCabs"] = {"hipCabs", "", CONV_COMPLEX, API_COMPLEX, 2};
47+
m["make_cuComplex"] = {"make_hipComplex", "", CONV_COMPLEX, API_COMPLEX, 2};
48+
m["cuComplexFloatToDouble"] = {"hipComplexFloatToDouble", "", CONV_COMPLEX, API_COMPLEX, 2};
49+
m["cuComplexDoubleToFloat"] = {"hipComplexDoubleToFloat", "", CONV_COMPLEX, API_COMPLEX, 2};
50+
m["cuCfmaf"] = {"hipCfmaf", "", CONV_COMPLEX, API_COMPLEX, 2};
51+
m["cuCfma"] = {"hipCfma", "", CONV_COMPLEX, API_COMPLEX, 2};
5452

55-
const std::map<llvm::StringRef, hipAPIversions> HIP_COMPLEX_FUNCTION_VER_MAP {
56-
{"hipCrealf", {HIP_1060, HIP_0, HIP_0 }},
57-
{"hipCimagf", {HIP_1060, HIP_0, HIP_0 }},
58-
{"make_hipFloatComplex", {HIP_1060, HIP_0, HIP_0 }},
59-
{"hipConjf", {HIP_1060, HIP_0, HIP_0 }},
60-
{"hipCaddf", {HIP_1060, HIP_0, HIP_0 }},
61-
{"hipCsubf", {HIP_1060, HIP_0, HIP_0 }},
62-
{"hipCmulf", {HIP_1060, HIP_0, HIP_0 }},
63-
{"hipCdivf", {HIP_1060, HIP_0, HIP_0 }},
64-
{"hipCabsf", {HIP_1060, HIP_0, HIP_0 }},
65-
{"hipCreal", {HIP_1060, HIP_0, HIP_0 }},
66-
{"hipCimag", {HIP_1060, HIP_0, HIP_0 }},
67-
{"make_hipDoubleComplex", {HIP_1060, HIP_0, HIP_0 }},
68-
{"hipConj", {HIP_1060, HIP_0, HIP_0 }},
69-
{"hipCadd", {HIP_1060, HIP_0, HIP_0 }},
70-
{"hipCsub", {HIP_1060, HIP_0, HIP_0 }},
71-
{"hipCmul", {HIP_1060, HIP_0, HIP_0 }},
72-
{"hipCdiv", {HIP_1060, HIP_0, HIP_0 }},
73-
{"hipCabs", {HIP_1060, HIP_0, HIP_0 }},
74-
{"make_hipComplex", {HIP_1060, HIP_0, HIP_0 }},
75-
{"hipComplexFloatToDouble", {HIP_1060, HIP_0, HIP_0 }},
76-
{"hipComplexDoubleToFloat", {HIP_1060, HIP_0, HIP_0 }},
77-
{"hipCfmaf", {HIP_1060, HIP_0, HIP_0 }},
78-
{"hipCfma", {HIP_1060, HIP_0, HIP_0 }},
79-
};
53+
return m;
54+
}();
8055

81-
const std::map<unsigned int, llvm::StringRef> CUDA_COMPLEX_API_SECTION_MAP {
82-
{1, "cuComplex Data types"},
83-
{2, "cuComplex API functions"},
84-
};
56+
const std::map<llvm::StringRef, cudaAPIversions> CUDA_COMPLEX_FUNCTION_VER_MAP = []() {
57+
std::map<llvm::StringRef, cudaAPIversions> m;
58+
return m;
59+
}();
60+
61+
const std::map<llvm::StringRef, hipAPIversions> HIP_COMPLEX_FUNCTION_VER_MAP = []() {
62+
std::map<llvm::StringRef, hipAPIversions> m;
63+
64+
m["hipCrealf"] = {HIP_1060, HIP_0, HIP_0 };
65+
m["hipCimagf"] = {HIP_1060, HIP_0, HIP_0 };
66+
m["make_hipFloatComplex"] = {HIP_1060, HIP_0, HIP_0 };
67+
m["hipConjf"] = {HIP_1060, HIP_0, HIP_0 };
68+
m["hipCaddf"] = {HIP_1060, HIP_0, HIP_0 };
69+
m["hipCsubf"] = {HIP_1060, HIP_0, HIP_0 };
70+
m["hipCmulf"] = {HIP_1060, HIP_0, HIP_0 };
71+
m["hipCdivf"] = {HIP_1060, HIP_0, HIP_0 };
72+
m["hipCabsf"] = {HIP_1060, HIP_0, HIP_0 };
73+
m["hipCreal"] = {HIP_1060, HIP_0, HIP_0 };
74+
m["hipCimag"] = {HIP_1060, HIP_0, HIP_0 };
75+
m["make_hipDoubleComplex"] = {HIP_1060, HIP_0, HIP_0 };
76+
m["hipConj"] = {HIP_1060, HIP_0, HIP_0 };
77+
m["hipCadd"] = {HIP_1060, HIP_0, HIP_0 };
78+
m["hipCsub"] = {HIP_1060, HIP_0, HIP_0 };
79+
m["hipCmul"] = {HIP_1060, HIP_0, HIP_0 };
80+
m["hipCdiv"] = {HIP_1060, HIP_0, HIP_0 };
81+
m["hipCabs"] = {HIP_1060, HIP_0, HIP_0 };
82+
m["make_hipComplex"] = {HIP_1060, HIP_0, HIP_0 };
83+
m["hipComplexFloatToDouble"] = {HIP_1060, HIP_0, HIP_0 };
84+
m["hipComplexDoubleToFloat"] = {HIP_1060, HIP_0, HIP_0 };
85+
m["hipCfmaf"] = {HIP_1060, HIP_0, HIP_0 };
86+
m["hipCfma"] = {HIP_1060, HIP_0, HIP_0 };
87+
88+
return m;
89+
}();
90+
91+
const std::map<unsigned int, llvm::StringRef> CUDA_COMPLEX_API_SECTION_MAP = []() {
92+
std::map<unsigned int, llvm::StringRef> m;
93+
94+
m[1] = "cuComplex Data types";
95+
m[2] = "cuComplex API functions";
96+
97+
return m;
98+
}();

src/CUDA2HIP_Complex_API_types.cpp

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,27 @@ THE SOFTWARE.
2323
#include "CUDA2HIP.h"
2424

2525
// Maps the names of CUDA Complex API types to the corresponding HIP types
26-
const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_TYPE_NAME_MAP {
27-
{"cuFloatComplex", {"hipFloatComplex", "rocblas_float_complex", CONV_TYPE, API_COMPLEX, 1}},
28-
{"cuDoubleComplex", {"hipDoubleComplex", "rocblas_double_complex", CONV_TYPE, API_COMPLEX, 1}},
29-
{"cuComplex", {"hipComplex", "rocblas_float_complex", CONV_TYPE, API_COMPLEX, 1}},
30-
};
31-
32-
const std::map<llvm::StringRef, cudaAPIversions> CUDA_COMPLEX_TYPE_NAME_VER_MAP {
33-
};
34-
35-
const std::map<llvm::StringRef, hipAPIversions> HIP_COMPLEX_TYPE_NAME_VER_MAP {
36-
{"hipFloatComplex", {HIP_1060, HIP_0, HIP_0 }},
37-
{"hipDoubleComplex",{HIP_1060, HIP_0, HIP_0 }},
38-
{"hipComplex", {HIP_1060, HIP_0, HIP_0 }},
39-
};
26+
const std::map<llvm::StringRef, hipCounter> CUDA_COMPLEX_TYPE_NAME_MAP = []() {
27+
std::map<llvm::StringRef, hipCounter> m;
28+
29+
m["cuFloatComplex"] = {"hipFloatComplex", "rocblas_float_complex", CONV_TYPE, API_COMPLEX, 1};
30+
m["cuDoubleComplex"] = {"hipDoubleComplex", "rocblas_double_complex", CONV_TYPE, API_COMPLEX, 1};
31+
m["cuComplex"] = {"hipComplex", "rocblas_float_complex", CONV_TYPE, API_COMPLEX, 1};\
32+
33+
return m;
34+
}();
35+
36+
const std::map<llvm::StringRef, cudaAPIversions> CUDA_COMPLEX_TYPE_NAME_VER_MAP = []() {
37+
std::map<llvm::StringRef, cudaAPIversions> m;
38+
return m;
39+
}();
40+
41+
const std::map<llvm::StringRef, hipAPIversions> HIP_COMPLEX_TYPE_NAME_VER_MAP = []() {
42+
std::map<llvm::StringRef, hipAPIversions> m;
43+
44+
m["hipFloatComplex"] = {HIP_1060, HIP_0, HIP_0 };
45+
m["hipDoubleComplex"] = {HIP_1060, HIP_0, HIP_0 };
46+
m["hipComplex"] = {HIP_1060, HIP_0, HIP_0 };
47+
48+
return m;
49+
}();

0 commit comments

Comments
 (0)