Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/ATen/native/xpu/sycl/CopyKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ struct CastScalarFunc {
}
};

template <>
struct CastScalarFunc<Half, Float8_e4m3fn> {
C10_HOST_DEVICE Float8_e4m3fn operator()(Half src_val) const {
// TODO(Temporarily): Avoid using sycl::half to prevent the fp16->fp32->fp8
// fusion from incorrectly converting -0.0 to NaN. This temporary fix should
// be removed once the compiler error is resolved.
return Float8_e4m3fn(c10::detail::fp16_ieee_to_fp32_value(src_val));
}
};

void float8_copy_kernel_xpu(TensorIteratorBase& iter) {
ScalarType dtype = iter.dtype(0);
ScalarType other_dtype = iter.dtype(1);
Expand Down