ieee_mode specificaly governs behaviour of SNaNs.
OpenCL does not want this, OpenGL does not care.
Let's just disable it for everything but HSA compute.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I think if we're going to do this we should just never use IEEE mode even for HSA. I don't think it buys us anything we want. This probably needs more discussion though
That'd need someone form the HSA team to chime in. Do you know of anyone specific to add as reviewer/subscriber?
HSA does define support for IEEE exception tracking. I do not believe we have surfaced that in the LLVM compiler, nor have any languages using the ability. So we may be able to disable. Adding @b-sumner as a reviewer to advise.
IEEE mode disables output modifiers, which is good since output modifiers are not IEEE compatible and do not support output subnormal values.
I suppose if we have some other mechanism to ensure output modifiers are never used, then we could consider running with IEEE=0, but I think we need to continue running with IEEE=1 for compute. There may be users counting on current behavior.
that should be enforceable in codegen.
The current behavior is broken for OpenCL so no one should depend on it.
This patch preserves behaviour for HSA.
"fmin and fmax behave as defined by C99 and may not match the IEEE 754-2008 definition for minNum and
maxNum with regard to signaling NaNs. Specifically, signaling NaNs may behave as quiet NaNs." -- OpenCL 1.2 specs
the CL CTS checks this behaviour, so we either need to flush SNaNs before calling v_min/v_max or disable the ieee_mode for CL. this patch does the latter.
as for GL compute I'd expect the behaviour to follow that of graphics GLSL, which is currently not the case
AFAIK this just enables sNaN handling (which won't work correctly anyway). The cost is is extra canonicalize instructions for min/max, and then prevents us from using omod when denormals are disabled.
rebased.
If HSA wants to keep the broken behaviour let them keep it. Don't force the breakage on other environments.