[GHC] #10706: Make -fcpr-off a dynamic flag

#10706: Make -fcpr-off a dynamic flag -------------------------------------+------------------------------------- Reporter: darchon | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 7.11 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- I've run into a situation where I wanted to turn off CPR analysis for a single module in my project, but could not do that because {{{-fcpr-off}}} is a static flag. I will supply a patch that makes {{{-fcpr-off}}} a dynamic flag. From what I understand, this would also bring us one step closer to the desired goal of getting rid of static flags entirely. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10706 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10706: Make -fcpr-off a dynamic flag -------------------------------------+------------------------------------- Reporter: darchon | Owner: darchon Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1110 -------------------------------------+------------------------------------- Changes (by darchon): * owner: => darchon * differential: => Phab:D1110 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10706#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10706: Make -fcpr-off a dynamic flag -------------------------------------+------------------------------------- Reporter: darchon | Owner: darchon Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1110 -------------------------------------+------------------------------------- Comment (by simonpj): OK. It was originally intended for GHC hackers only. If there is ever a case you want to turn it off for a module I'd like to know why. Still I have no quarrel with making it dynamic -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10706#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10706: Make -fcpr-off a dynamic flag -------------------------------------+------------------------------------- Reporter: darchon | Owner: darchon Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1110 -------------------------------------+------------------------------------- Comment (by darchon): I have to confess that my use-case is very unconventional, perhaps even contrived: I work on a compiler that translates Haskell to circuits (www.clash- lang.org), and I use Streams to model sequential circuits: {{{ data Stream a = a :- Stream a }}} Given this model of a sequential circuit, appending an element to a stream: {{{ memory i s = i :- s }}} has a clear circuit semantics, it translates to a memory/latch. However, decomposing a stream: {{{ case s of i :- s' -> ... }}} would basically translate to "looking into the future", which cannot be transformed into a circuit. I have taken great care that, under normal conditions, a case statement with a {{{Signal a}}} as a scrutinee never occurs. For one by not exporting the constructor of the {{{Steam}}} data type. However, due to the CPR analysis I sometimes end up with a worker/wrapper that looks something like this: {{{ case memory i s of a :- bs -> g (#a,bs#) g (#a,bs#) = a :- bs }}} which gives me the troublesome case-decomposition on the {{{Stream}}} data type. Now, as to why I want {{{-fcpr-off}}} to be a dynamic flag: All my functions that manipulate the {{{Stream}}} type exist in a single module. If these functions get no CPR annotations, I noticed that the above troublesome worker/wrapper is never created elsewhere. The CPR annotations do not bother me in any of my other modules, and I do not want to turn off strictness analysis completely in the module where I define my {{{Stream}}}-manipulating functions. Hence I would like to have a {{{-fcpr-off}}} dynamic flag, so I can turn off CPR annotations just for that single module. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10706#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10706: Make -fcpr-off a dynamic flag -------------------------------------+------------------------------------- Reporter: darchon | Owner: darchon Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1110 -------------------------------------+------------------------------------- Comment (by simonpj): But how can you tell that the troublesome `case` appears? Ah -- perhaps the missing piece is that you are using GHC as a library and consuming the optimised Core code that it produces? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10706#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10706: Make -fcpr-off a dynamic flag -------------------------------------+------------------------------------- Reporter: darchon | Owner: darchon Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1110 -------------------------------------+------------------------------------- Comment (by darchon): Ah, yes, I forgot to mention that. Indeed I use GHC as a library, I turn on/off specific optimisations: [https://github.com/clash-lang/clash- compiler/blob/master/clash-ghc/src-ghc/CLaSH/GHC/LoadModules.hs#L179] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10706#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10706: Make -fcpr-off a dynamic flag
-------------------------------------+-------------------------------------
Reporter: darchon | Owner: darchon
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions: Phab:D1110
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#10706: Make -fcpr-off a dynamic flag -------------------------------------+------------------------------------- Reporter: darchon | Owner: darchon Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D1110 -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10706#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC