pytorch
e03ac0ee - Add bf16 and change header file include path (#91838)

Commit
2 years ago
Add bf16 and change header file include path (#91838) # Motivation We would like to add the bfloat16 header file to PyTorch to make PyTorch and Intel extension for PyTorch support the bfloat16 data type. # Solution - Note that bfloat16 is an Intel extension implementation in the DPC++ compiler instead of standard SYCL, we need to guarantee the bfloat16 header can be included only using the DPC++ compiler. Please refer to [sycl 2020 feature test macros](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#_feature_test_macros). Intel DPC++ compiler uses [SYCL_EXT_ONEAPI_BFLOAT16_MATH_FUNCTIONS](https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/experimental/sycl_ext_oneapi_bfloat16_math_functions.asciidoc) to check bfloat16 feature. - Refer to [intel/llvm](https://github.com/intel/llvm/blob/59dd38795c7557a779ca38cd27df21a40c7b3c45/clang/lib/Basic/Version.cpp#L129). SYCL_LANGUAGE_VERSION is defined in both SYCL 1.2.1 and SYCL 2020. But only CL_SYCL_LANGUAGE_VERSION is defined in SYCL 1.2.1. So we should check CL_SYCL_LANGUAGE_VERSION first for SYCL 1.2.1. If it is not defined then check SYCL_LANGUAGE_VERSION for SYCL 2020. This will guarantee to be compatible with SYCL 1.2.1 and SYCL 2020. # Additional No need UT. Pull Request resolved: https://github.com/pytorch/pytorch/pull/91838 Approved by: https://github.com/ezyang
Author
Committer
Parents
Loading