Repository navigation
near-zero negative values must convert to 0 not NAN - #18473
Conversation
for the Float8 types with unsigned zero, we must clear the sign bit when rounding to zero; otherwise we end up with 0x80 which is the encoding for NAN.
|
@microsoft-github-policy-service agree company="Vespa.ai" |
|
Thanks for finding this issue, I applied your fix onnx as well (see onnx/onnx#5764). |
|
note: last commit is a whitespace-only change. |
|
/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux QNN CI Pipeline, Windows CPU CI Pipeline, Windows GPU CI Pipeline, onnxruntime-binary-size-checks-ci-pipeline, |
|
Azure Pipelines successfully started running 7 pipeline(s). |
|
/azp run orttraining-ortmodule-distributed, orttraining-linux-gpu-ci-pipeline, orttraining-linux-ci-pipeline |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run Windows x64 QNN CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
/azp run Linux GPU TensorRT CI Pipeline, Linux OpenVINO CI Pipeline, Windows ARM64 QNN CI Pipeline, Windows GPU TensorRT CI Pipeline |
|
Azure Pipelines successfully started running 4 pipeline(s). |
|
/azp run MacOS CI Pipeline |
|
Azure Pipelines successfully started running 1 pipeline(s). |
### Description -0.00001 must be converted into 0 and not negative zero which does not exist for types Float8E4M3FNUZ and Float8E5M2UZ. See microsoft/onnxruntime#18473 for further details. Signed-off-by: Xavier Dupre <xadupre@microsoft.com>
|
can this be merged into main branch now? |
|
Xavier Dupré (@xadupre) this looks like it has been forgotten, can you please take another look |
|
Tianlei Wu (@tianleiwu) can you please help me with this PR? |
|
/azp run Big Models, Linux Android Emulator QNN CI Pipeline, ONNX Runtime Web CI Pipeline, Windows GPU CUDA CI Pipeline, Windows GPU DML CI Pipeline |
|
/azp run Windows GPU Doc Gen CI Pipeline |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Azure Pipelines successfully started running 5 pipeline(s). |
### Description -0.00001 must be converted into 0 and not negative zero which does not exist for types Float8E4M3FNUZ and Float8E5M2UZ. See microsoft/onnxruntime#18473 for further details. Signed-off-by: Xavier Dupre <xadupre@microsoft.com> Signed-off-by: Linsho Kaku <linsho@preferred.jp>
for the Float8 types with unsigned zero, we must clear the sign bit when rounding to zero;
otherwise we end up with 0x80 which is the encoding for NAN.
Description
Handle all zero and near-zero values the same way, rounding to positive zero.
Note that I removed one "if" level but did not re-indent the code in this PR, to make it
easier to see what the actual changes are.
Motivation and Context
For the two new 8-bit floating point types Float8E4M3FNUZ and Float8E5M2FNUZ,
converting from a near-zero negative value would end up with the sign bit set only;
this bit pattern is not negative zero but instead means NAN.