Debugging specialization

Hi all, I am trying to understand why GHC is not specializing an imported INLINABLE instance method, and the information provided by -ddump-spec -Wall-missed-specialisations has not been enough to help me figure it out. Is there some easy/well-trodden way that I could build GHC with some additional instrumentation in place to help me better understand the decisions being made by the specializer, or is -ddump-spec the most granularity available? I’ve noticed that Specialise.hs has handful of pprTrace calls sprinkled about, but they are all commented out. Is the recommended method to just uncomment these calls and rebuild GHC? Thanks, Alexis

Hi Alexis
| I am trying to understand why GHC is not specializing an imported
| INLINABLE instance method, and the information provided by -ddump-spec -
| Wall-missed-specialisations has not been enough to help me figure it out.
| Is there some easy/well-trodden way that I could build GHC with some
| additional instrumentation in place to help me better understand the
| decisions being made by the specializer, or is -ddump-spec the most
| granularity available?
I'm afraid those are all the flags we currently have, yes.
| I’ve noticed that Specialise.hs has handful of pprTrace calls sprinkled
| about, but they are all commented out. Is the recommended method to just
| uncomment these calls and rebuild GHC?
That's what I do.
But it would be better to stand back a bit and ask "what information would I really like to see?" and then design some logging mechanism to show it. I'd be happy to advise.
Simon
| -----Original Message-----
| From: ghc-devs

On Oct 25, 2019, at 04:07, Simon Peyton Jones
wrote: | I’ve noticed that Specialise.hs has handful of pprTrace calls sprinkled | about, but they are all commented out. Is the recommended method to just | uncomment these calls and rebuild GHC?
That's what I do.
Thanks, I did indeed end up doing this, and it was enough to diagnose my problem.
But it would be better to stand back a bit and ask "what information would I really like to see?" and then design some logging mechanism to show it. I'd be happy to advise.
It would be nice to have a -dspecialise-check in the same vein as the existing -dinline-check/-drule-check flags, which seems probably not too hard to add. I unfortunately can’t dedicate the time to add it myself right now, as I’ve solved my immediate problem and probably already sunk more time into this than I ought to, but if it comes up again and I can spare the time I might give it a shot.

Inspection Testing by Joachim Breitner may be of interest: https://arxiv.org/abs/1803.07130
On Oct 25, 2019, at 5:34 PM, Alexis King
wrote: On Oct 25, 2019, at 04:07, Simon Peyton Jones
wrote: | I’ve noticed that Specialise.hs has handful of pprTrace calls sprinkled | about, but they are all commented out. Is the recommended method to just | uncomment these calls and rebuild GHC?
That's what I do.
Thanks, I did indeed end up doing this, and it was enough to diagnose my problem.
But it would be better to stand back a bit and ask "what information would I really like to see?" and then design some logging mechanism to show it. I'd be happy to advise.
It would be nice to have a -dspecialise-check in the same vein as the existing -dinline-check/-drule-check flags, which seems probably not too hard to add. I unfortunately can’t dedicate the time to add it myself right now, as I’ve solved my immediate problem and probably already sunk more time into this than I ought to, but if it comes up again and I can spare the time I might give it a shot.
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (3)
-
Alexis King
-
Richard Eisenberg
-
Simon Peyton Jones