[GHC] #9276: audit ghc floating point support for IEEE (non)compliance

#9276: audit ghc floating point support for IEEE (non)compliance ------------------------------------+------------------------------------- Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- As best I can determine, ghc has never been closely audited for conformance to IEEE-754 (floating point) standard and currently is a bit far from providing a compliant implementation. This impacts both a number of other tasks i wish to do for ghc **and** much of my own use of haskell is in a floating point heavy workloads, I will do a bit of leg work to: a) improve test suite support for checking for compliance b) write some patches to provide portable compliant primops for the operations which need compiler support c) try to determine how to allow ghc optimizer to be a bit more aggressive in a sound way in the presence of floating point. (this may grow into a few subtickets, we'll see) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------ Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by schyler): The constant folder doesn't actually fold floating points yet. It's a hard thing to do, without blowing up cross compilation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------ Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by augustss): You can check if the host and the target have the same kind of FP (easy if host==target) and only constant fold under that condition. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------ Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by carter): yeah, i'm not concerned with even doing optimization yet, just making sure all the suitable primitives are exposed :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------ Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: 9304 | Related Tickets: -------------------------------------+------------------------------------ Comment (by schyler): Ideally, adapters should be used to emulate floating point behaviour. I'm not sure how complex it is, but you shouldn't lose any optimisations in cross compiling -- what if cross compiling is normal, i.e. embedded? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------ Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: 9304 | Related Tickets: -------------------------------------+------------------------------------ Comment (by carter): Yeah, improving optimization requires a pretty precise soft float model of the target hardware's floating point semantics, with roughly three modes 1. IEEE / machine model -- same result as if run as a normal program 2. fast math model -- assume associativity, assume NaNs never happen 3. excess precision -- use extra precision in the intermediate computation to provide as many bits of precision as possible adding that sort of machinery to ghc is a bit out of scope for just an audit (and any induced patched to provide added missing operations), but becomes possible once such an audit is done. (Also a LOT of work) I want to get this done for 7.10, adding optimization on top can be on the table later though! :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------ Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: 9304 | Related Tickets: -------------------------------------+------------------------------------ Comment (by carter): though if someone writes that soft model tooling for at least case (1), maybe it could happen faster! :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------- Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: 8364, 9304 | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by jrp): * cc: jrp (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------- Reporter: carter | Owner: carter Type: task | Status: new Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: 3070, | 8364, 9304, 9530 | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by carter): * blocking: 8364, 9304, 9530 => 3070, 8364, 9304, 9530 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------- Reporter: carter | Owner: carter Type: task | Status: new Priority: normal | Milestone: 7.12.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: 3070, | 8364, 9304, 9530 | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by carter): * priority: high => normal * milestone: 7.10.1 => 7.12.1 Comment: remilestoning to 7.12, -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9276: audit ghc floating point support for IEEE (non)compliance -------------------------------------+------------------------------------- Reporter: carter | Owner: carter Type: task | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: 3070, 8364, | 9530 Related Tickets: #9304 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * related: => #9304 Comment: See also #9304. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9276#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC