Skip to content

Commit

Permalink
[SYCL] Add support for _Float16 type mangling to OclCxxRewrite
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Fznamznon authored and romanovvlad committed Apr 16, 2019
1 parent 83403c9 commit 22173c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions clang/lib/CodeGen/OclCxxRewrite/OclCxxDemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ static bool matchFixedBiTypeAndAdvance(const std::string &ParsedText,
break;
case 'n': MatchedType = DBT_NullPtr;
break;
case 'F': MatchedType = DBT_Half; Pos += 3; // _Float16 -> DF16_
break;
default:
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/OclCxxRewrite/OclCxxMangleEncodings.inc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ OCLCXX_MENC_BITYPE_FIXED(Float128R, "De", "__fp128r")
///< IEEE 754r decimal floating point (128 bits)
OCLCXX_MENC_BITYPE_FIXED(Float32R, "Df", "__fp32r")
///< IEEE 754r decimal floating point (32 bits)
OCLCXX_MENC_BITYPE_FIXED(Float16R, "Dh", "half")
OCLCXX_MENC_BITYPE_FIXED(Float16R, "DF16_", "_Float16")
///< IEEE 754r half-prec floating point (16 bits)
OCLCXX_MENC_BITYPE_ALIAS(Half, Float16R)
OCLCXX_MENC_BITYPE_FIXED(Char32, "Di", "char32_t") ///< char32_t
Expand Down

0 comments on commit 22173c9

Please sign in to comment.