-
-
Notifications
You must be signed in to change notification settings - Fork 784
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Abstraction Level for Math Optimization Mode #981
Comments
Is like this? https://gcc.gnu.org/wiki/FloatingPointMath |
Yes. GCC is more tricky as it has many flags which are math related.
|
I will consider adding a new api to abstract it, and I will add it later when I have time. Some references: https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_rni1489589347476.htm |
I have added a new set_fpmodels() interface, and initially supported some abstract levels. e.g. precise(default), fast, strict, except, noexcept set_fpmodels("fast")
set_fpmodels("strict")
set_fpmodels("fast", "except")
set_fpmodels("precise") -- default |
This is great. It seems With |
Ok, you can review the gcc/clang flags corresponding to fp-model level. If there are still incorrect mapping flags, I will modify it gcc: function nf_fpmodel(self, level)
local maps =
{
precise = "" --default
, fast = "-ffast-math"
, strict = {"-frounding-math", "-ftrapping-math"}
, except = "-ftrapping-math"
, noexcept = "-fno-trapping-math"
}
return maps[level]
end Clang function nf_fpmodel(self, level)
local maps
if self:has_flags("-ffp-model=fast") then
maps =
{
precise = "-ffp-model=precise"
, fast = "-ffp-model=fast"
, strict = "-ffp-model=strict"
, except = "-ftrapping-math"
, noexcept = "-fno-trapping-math"
}
else
maps =
{
precise = "" -- default
, fast = "-ffast-math"
, strict = {"-frounding-math", "-ftrapping-math"}
, except = "-ftrapping-math"
, noexcept = "-fno-trapping-math"
}
end
return maps[level]
end |
I have added fp-models for intel compiler |
All compilers have flags to control the precision mode of Math.
Most of them have something like
default
,strict
andfast
(Intel Compiler has fewfast
modes).It will be great to have abstraction for those in the same manner the optimization level was abstracted.
It has some overlap with the optimization level, yet I think when a user set this it should override optimization level.
The text was updated successfully, but these errors were encountered: