Improve precision of emitted code for prim::Constant (#18817)
authorJames Reed <jamesreed@fb.com>
Sun, 7 Apr 2019 07:15:42 +0000 (00:15 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sun, 7 Apr 2019 07:18:24 +0000 (00:18 -0700)
commit9b69f21a95fa626522ef371f8557e7286f9db318
treebd732427cda7af6360cda556dcfedd5f7844e5c4
parent79533ef097bf3ff2f1d85782ae1f279fe15e8686
Improve precision of emitted code for prim::Constant (#18817)

Summary:
Stacked on https://github.com/pytorch/pytorch/pull/18815 and https://github.com/pytorch/pytorch/pull/18811.

This makes it so that we emit a higher-precision literal for float values in the fusion kernel, as well as assign that to a `double` variable. This prevents us from losing precision for values such as `pi`, but with the previous fixes this will also get downcasted to `float` if downstream operations require it. Therefore, we should not lose performance because of implicit promotions
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18817

Differential Revision: D14820842

Pulled By: jamesr66a

fbshipit-source-id: 519671c6ca5e7adac746a4c4c72760a6d91e332f
test/test_jit.py
torch/csrc/jit/fuser/codegen.cpp
torch/csrc/jit/fuser/executor.cpp