[ghc-steering-committee] Please review #313: Delimited continuation primops, Shepherd: Simon Marlow
Simon Peyton Jones
simonpj at microsoft.com
Wed Dec 9 17:02:56 UTC 2020
I’m generally strongly supportive of this proposal.
Again, we might see some movement around the edges, but both Daan Leijen and Amr Sabry have given it a thumbs up, so I think it’s fundamentally sound.
There may be a few points to clarify, but fundamentally let’s accept.
Simon
From: ghc-steering-committee <ghc-steering-committee-bounces at haskell.org> On Behalf Of Simon Marlow
Sent: 23 November 2020 14:38
To: Joachim Breitner <mail at joachim-breitner.de>
Cc: ghc-steering-committee at haskell.org
Subject: Re: [ghc-steering-committee] Please review #313: Delimited continuation primops, Shepherd: Simon Marlow
Committee,
We have been asked to review
#313: Delimited continuation primops
https://github.com/ghc-proposals/ghc-proposals/pull/313<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghc-proposals%2Fghc-proposals%2Fpull%2F313&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293529012%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Le0GAZdh2JEcQssZE0BT4dI0vyfI%2FomjgqLnpTAUi3o%3D&reserved=0>
https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flexi-lambda%2Fghc-proposals%2Fblob%2Fdelimited-continuation-primops%2Fproposals%2F0000-delimited-continuation-primops.md&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293539008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=ulO4Rdn%2Fn5LHXlOpfhHDds9RxwF6t1pC9jZVOQgQPzA%3D&reserved=0>
Summary
The proposal makes no language changes, it only adds three primops<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flexi-lambda%2Fghc-proposals%2Fblob%2Fdelimited-continuation-primops%2Fproposals%2F0000-delimited-continuation-primops.md%23proposed-change-specification&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293539008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=dBgHuMm3STiaB6be9CJ5sLsuJksOUlb6kp9SB9E1R04%3D&reserved=0>.
The main motivation is to support building efficient implementations of Algebraic Effect systems, which depend on being able to efficiently capture a continuation. Currently this is done explicitly, which imposes a severe performance penalty.
These primops are the minimal support needed to be able to capture a continuation and apply it at runtime, together with some basic type safety via the PromtTag type to ensure that at least we don't replace a continuation with a computation of a different type. (there are other ways to go wrong with these primops though, they're not a safe interface by themselves: they need to be wrapped in a safe library).
The primops are implemented by copying chunks of stack into the heap. This is something that GHC's runtime already does a lot of, so it's not a new concept, although it does require a new closure type and knock-on changes across several files in the runtime (though it's mainly mechanical). There's a prototype implementation here: https://gitlab.haskell.org/lexi.lambda/ghc/-/compare/master...first-class-continuations?view=inline<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.haskell.org%2Flexi.lambda%2Fghc%2F-%2Fcompare%2Fmaster...first-class-continuations%3Fview%3Dinline&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293549000%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=OHMl2XVxh6DJdDLb68I9hqC6IOTJLRzLVujTfKRfnP8%3D&reserved=0>
Decision
I'm going to tentatively recommend acceptance.
* This is a sensible choice for the primtives, being the most general of the alternatives, as explained in the proposal.<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flexi-lambda%2Fghc-proposals%2Fblob%2Fdelimited-continuation-primops%2Fproposals%2F0000-delimited-continuation-primops.md%23operational-semantics&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293549000%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=UZ4m3i95xS%2FwQXZZ5tyC6b3M%2B%2BsNW%2BzQEAaxhHviAcc%3D&reserved=0>
* Would the new primops impose a significant ongoing maintenance burden? Having looked at the patch, although there are some missing pieces, I don't think the new concepts impose any significant new requirements on other parts of the runtime.
* I suspect there may be some difficulties around unsafePerformIO, so I raised that on the github thread<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghc-proposals%2Fghc-proposals%2Fpull%2F313%23issuecomment-732181948&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293558999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=T7Bg1Cc5JWnLu5Jei4m2U%2FdGxZLTUoWWW5d0P3rR%2Bic%3D&reserved=0>
Thoughts?
On Sat, 12 Sep 2020 at 22:59, Joachim Breitner <mail at joachim-breitner.de<mailto:mail at joachim-breitner.de>> wrote:
Dear Committee,
this is your secretary speaking:
Delimited continuation primops
has been proposed by Alexis King
https://github.com/ghc-proposals/ghc-proposals/pull/313<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghc-proposals%2Fghc-proposals%2Fpull%2F313&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293558999%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=pMZVPIAfsh9qyoL6DL86yHyFfiPWn4naTPBy0CLI25A%3D&reserved=0>
https://github.com/lexi-lambda/ghc-proposals/blob/delimited-continuation-primops/proposals/0000-delimited-continuation-primops.md<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Flexi-lambda%2Fghc-proposals%2Fblob%2Fdelimited-continuation-primops%2Fproposals%2F0000-delimited-continuation-primops.md&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293568989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Zw2T0xtD1ajgsbZmMR9HuWEWKW%2Fem5XXw1%2BGMJhtYDE%3D&reserved=0>
I’ll propose Simon Marlow as the shepherd.
Please guide us to a conclusion as outlined in
https://github.com/ghc-proposals/ghc-proposals#committee-process<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fghc-proposals%2Fghc-proposals%23committee-process&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293568989%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2FGqnupqKk9ivMF5gNqqgXyO58owCNR%2BBVZ1N6JagCUM%3D&reserved=0>
Thanks,
Joachim
--
Joachim Breitner
mail at joachim-breitner.de<mailto:mail at joachim-breitner.de>
http://www.joachim-breitner.de/<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.joachim-breitner.de%2F&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293578982%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=j5fdBTeQJbnPWb8tdnA%2FzgDEUoIUJhkwMrg9kfrGFrI%3D&reserved=0>
_______________________________________________
ghc-steering-committee mailing list
ghc-steering-committee at haskell.org<mailto:ghc-steering-committee at haskell.org>
https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-steering-committee&data=04%7C01%7Csimonpj%40microsoft.com%7C84a3108a4ea94f00a6ba08d88fbd6bd3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C1%7C637417393293578982%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=J1gQ1iUMCnmJCkx7uu1qMRtZh7JCU18bz89lklbjmC8%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20201209/c7177d2f/attachment-0001.html>
More information about the ghc-steering-committee
mailing list