Skip to content

Commit 1e6ab92

Browse files
committed
[SYCL] Add support for _Float16 type mangling to OclCxxRewrite
Half type is defined on SYCL device as _Float16. This type is mangled by clang as "DF16_". OclCxxRewrite doesn't support this mangling and skips all OpenCL built-ins with _Float16 type. So these built-ins are not translated properly to SPIRV without this change. Signed-off-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
1 parent 17bf4b6 commit 1e6ab92

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clang/lib/CodeGen/OclCxxRewrite/OclCxxDemangler.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ static bool matchFixedBiTypeAndAdvance(const std::string &ParsedText,
353353
break;
354354
case 'n': MatchedType = DBT_NullPtr;
355355
break;
356+
case 'F': MatchedType = DBT_Half; Pos += 3; // _Float16 -> DF16_
357+
break;
356358
default:
357359
return false;
358360
}

clang/lib/CodeGen/OclCxxRewrite/OclCxxMangleEncodings.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ OCLCXX_MENC_BITYPE_FIXED(Float128R, "De", "__fp128r")
115115
///< IEEE 754r decimal floating point (128 bits)
116116
OCLCXX_MENC_BITYPE_FIXED(Float32R, "Df", "__fp32r")
117117
///< IEEE 754r decimal floating point (32 bits)
118-
OCLCXX_MENC_BITYPE_FIXED(Float16R, "Dh", "half")
118+
OCLCXX_MENC_BITYPE_FIXED(Float16R, "DF16_", "_Float16")
119119
///< IEEE 754r half-prec floating point (16 bits)
120120
OCLCXX_MENC_BITYPE_ALIAS(Half, Float16R)
121121
OCLCXX_MENC_BITYPE_FIXED(Char32, "Di", "char32_t") ///< char32_t

0 commit comments

Comments
 (0)