<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Forgot to also send to the list<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">Begin forwarded message:</div><br class="Apple-interchange-newline"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">From: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Christiaan Baaij <<a href="mailto:christiaan.baaij@gmail.com" class="">christiaan.baaij@gmail.com</a>><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Subject: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><b class="">Re: Strictness/demand analysis without worker/wrapper, or, reviving -fmax-worker-args</b><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">Date: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">15 Oct 2015 17:27:21 CEST<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif; color:rgba(0, 0, 0, 1.0);" class=""><b class="">To: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" class="">simonpj@microsoft.com</a>><br class=""></span></div><br class=""><div class="">Thanks for the comments, I will create a patch for a -fno-worker-wrapper flag somewhere next week then.<br class=""><br class="">I’ll also see about reviving -fmax-worker-args.<br class="">Although it’s not used by any package on Hackage, and it has been dead for over 2 years now I think.<br class=""><br class="">— Christiaan<br class=""><br class=""><blockquote type="cite" class="">On 14 Oct 2015, at 14:02, Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" class="">simonpj@microsoft.com</a>> wrote:<br class=""><br class="">Some quick thoughts:<br class=""><br class="">* It would make perfect sense to run the demand analyser without the worker/wrapper transform, yes.  By all means make a patch to make that easy to do.  Do NOT do this by setting -fmax-worker-args=0; that would be a hack even if it worked; and as you say it probably doesn't.<br class=""><br class="">* The -fmax-worker-args flag is supposed to stop GHC unpacking a function with a zillion fields.  E.g. suppose we have<br class=""><span class="Apple-tab-span" style="white-space:pre">      </span>f :: (Int,Int,Int, ..., Int, Int) -> Int<br class="">which, say, adds up all the field of a 200-tuple.  It would probably gain little to worker/wrapper this, because the worker would get 200 arguments.  Maybe that's ok, but the gain over allocating the arg tuple in the heap is proportionately less.<br class=""><br class="">But clearly some refactoring lost this ability.  Maybe someone should put it back!<br class=""><br class="">I have no evidence, either way, to suggest that limiting the # of args to a worker would be beneficial.  Just a kind of intuition.<br class=""><br class=""><br class="">Simon<br class=""><br class=""><br class="">|  As a GHC API user, I would like to run GHC’s strictness and demand analysis<br class="">|  pass, but I don’t want any worker/wrappers.<br class="">|  My specific use-case is to generate digital circuits from Haskell code,<br class="">|  where I’ve yet to encounter any benefit from worker/wrappers: the generated<br class="">|  circuits do not get any smaller or faster.<br class="">|  They do however induce longer compilation times for my compiler.<br class="">|  I still want to have GHC’s strictness and demand analysis, because, if I<br class="">|  understand correctly, the demand and strictness annotations are needed by<br class="">|  GHC’s dead code analysis (and other optimisations) which is beneficial for<br class="">|  my use case.<br class="">|  <br class="">|  Looking through DynFlags, I encountered the ‘maxWorkerArgs’ field, which is<br class="">|  controlled by ‘-fmax-worker-args’.<br class="">|  The user guide says the following:<br class="">|  "If a worker has that many arguments, none will be unpacked anymore<br class="">|  (default: 10)”<br class="">|  I don’t know exactly what this means, but I was hoping that if I would set<br class="">|  that number to 0 (zero), no worker/wrapper pairs would be created.<br class="">|  Is that correct?<br class="">|  <br class="">|  The reason that I’m asking is because -fmax-worker-args is basically dead<br class="">|  code.<br class="">|  The ‘maxWorkerArgs’ field of DynFlags is not used anywhere.<br class="">|  If setting ‘-fmax-worker-args’ to zero does indeed prevent any<br class="">|  worker/wrappers from being generated, should I reimplement the flag and<br class="">|  submit it as a patch?<br class="">|  Or, is it preferable to simply remove ‘-fmax-worker-args’ (given that it<br class="">|  doesn’t do anything right now), and create a new flag, ‘-fno-worker-<br class="">|  wrapper’, that simply disables the creation of worker/wrapper pairs<br class="">|  everywhere?<br class="">|  <br class="">|  Regards,<br class="">|  <br class="">|  Christiaan<br class="">|  _______________________________________________<br class="">|  ghc-devs mailing list<br class="">|  <a href="mailto:ghc-devs@haskell.org" class="">ghc-devs@haskell.org</a><br class="">|  <a href="https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.haskell" class="">https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fmail.haskell</a><br class="">|  .org%2fcgi-bin%2fmailman%2flistinfo%2fghc-<br class="">|  devs%0a&data=01%7c01%7csimonpj%<a href="http://40064d.mgd.microsoft.com" class="">40064d.mgd.microsoft.com</a>%7c6c87f8a67afa4d8c78<br class="">|  8108d2d3238a16%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=vk8RNAbzZpj63RRu<br class="">|  SQV%2fPDS7trt6puHaEhXBSHbIZQ0%3d<br class=""></blockquote><br class=""></div></blockquote></div><br class=""></body></html>