add scoped flush-to-zero and denormals-are-zero flags - #1111
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request introduces ScopedFlushToZeroAndDenormalsAreZeros, an RAII guard class in lib/util_cpu.h to manage and automatically restore MXCSR control flags (flush-to-zero and denormals-are-zeros). This guard is adopted across various simulation paths in pybind_interface/pybind_main.cpp and stubbed in GPU-specific pybind files. A new test is also added to verify the restoration of these flags. Feedback on the changes includes adding the missing Apache 2.0 license header and fixing line-length violations in the new Python test file, as well as shortening a variable name in pybind_main.cpp to adhere to the 80-character limit for C++ files.
Fixes #666 (
denormals_are_zerossetting has unexpected side effects) by making making MXCSR flag changes scoped to class intialization, follows closely by changes done by @mhucka in a previous draft PR