-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing JoinFun #28
Changing JoinFun #28
Conversation
Yes, that looks correct. Except for the |
Oh, I've completely missed that. Sorry. I'll fix that. |
Changes to GHC are already on Phabricator: https://phabricator.haskell.org/D1808 |
The label in JoinFun can be useful for the clients. I actually use it On 1/20/2016 4:51 AM, Alexander Pankiv wrote:
|
Hoop is designed to with the intention to support a wide range of It's a fallacy to use one dataflow analysis example to argue about the On 1/20/2016 4:51 AM, Alexander Pankiv wrote:
|
Can you give a link to your code where you are doing that? I took a quick look at your
Our argument (ie. mine and Simon PJ's) was not based on one example. It was based on all examples we have seen. @AlexanderPankiv - make sure to update the tests as well. At the moment travis build is failing. |
Our argument (ie. mine and Simon PJ's) was not based on one example. It was based on all examples we have seen. Simon From: Jan Stolarek [mailto:notifications@github.com] I actually use it for indexing the live variables of each node. Can you give a link to your code where you are doing that? I took a quick look at your hLLVM repo, but all the join functions I was able to find ignored the label argument. removing the label will make some analyses impossible. It's a fallacy to use one dataflow analysis example to argue about the redundancy of some design choices. Our argument (ie. mine and Simon PJ's) was not based on one example. It was based on all examples we have seen. @AlexanderPankivhttps://github.com/AlexanderPankiv - make sure to update the tests as well. At the moment travis build is failing. — |
Our argument - or rather, an observation - was that this is never ever used. The intention of
Luckily, we wrote it all down: https://ghc.haskell.org/trac/ghc/wiki/Hoopl/Cleanup Simon, there is one fragment on that wiki page that I don't understand. There is a suggested refactoring from: analyzeAndRewriteFwd
:: forall m n f e x entries. (CheckpointMonad m, NonLocal n, LabelsPtr entries)
=> FwdPass m n f
-> MaybeC e entries -- THIS ARGUMENT
-> Graph n e x -> Fact e f
-> m (Graph n e x, FactBase f, MaybeO x f) to analyzeAndRewriteFwd
:: forall m n f e x entries. (CheckpointMonad m, NonLocal n)
=> FwdPass m n f
-> Fact e f -- Entry points plus a fact for each
-> Graph n e x
-> m (Graph n e x, FactBase f, MaybeO x f) I am completely unable to reconstruct our path of thinking when we wrote this. I see no way of removing information about the entry point of the graph. Are you able to help here? |
I don’t remember either. But looking at it I see · The old (MaybeC e entries) argument is Nothing in the open case; and is essentially [Label] in the closed case. These are the entry points · The (Fact e f) argument is a single fact in the open case, and FactBase in the closed case So I think that in the closed case our intent was to make the domain of the FactBase of the (Fact e f) argument be (by definition) the entry points. The comment says “Entry points plus a fact for each” and that makes perfect sense. It eliminate a current unstated invariant, that the domain of the incoming (Fact e f) must include all the ‘entries’ argument. The only things is that we can’t get the domain of a FactBase as a [Label] but only as a [Unique]. I don’t know if that matters. If it does I guess we could change FactBase to make that possible. Simon From: Jan Stolarek [mailto:notifications@github.com] What argument did I make? Our argument - or rather, an observation - was that this is never ever used. The intention of Label argument was to be used for debugging purposes but it is a leftover from the times when the library was in development and debugging information was useful to implement it correctly. is there a wiki page that describes the proposed design change and argues for why it would be a good thing? Luckily, we wrote it all down: https://ghc.haskell.org/trac/ghc/wiki/Hoopl/Cleanup Simon, there is one fragment on that wiki page that I don't understand. There is a suggested refactoring from: analyzeAndRewriteFwd :: forall m n f e x entries. (CheckpointMonad m, NonLocal n, LabelsPtr entries) => FwdPass m n f -> MaybeC e entries -- THIS ARGUMENT -> Graph n e x -> Fact e f -> m (Graph n e x, FactBase f, MaybeO x f) to analyzeAndRewriteFwd :: forall m n f e x entries. (CheckpointMonad m, NonLocal n) => FwdPass m n f -> Fact e f -- Entry points plus a fact for each -> Graph n e x -> m (Graph n e x, FactBase f, MaybeO x f) I am completely unable to reconstruct our path of thinking when we wrote this. I see no way of removing information about the entry point of the graph. Are you able to help here? — |
Yes, this line of reasoning does make sense.
|
On 1/20/2016 11:59 PM, Jan Stolarek wrote:
This mapping is used to kill the dataflow facts of dead variables. This
But the proposal to remove fact_bot is questionable. I agree the Because the dataflow fact (CPFact) used in the argument is simple, the When I first get some code, the first place I start to look at is the
|
The goal of this it to increase readability of code by expressing invariants in the API. Right now you have an API that accepts some arguments that it doesn't use - how does this make the code easier to understand? As I already said, this costed us several days of debugging because we couldn't figure out why the bottom of the lattice is not used. Only after some time we realized that it is not used in any way! |
@jstolarek tests fixed. |
On 1/22/2016 7:29 AM, Jan Stolarek wrote:
Bot is never used is not equivalant to the last parameter of Do you still have the problematic code around? BTW, your definition of CPFact is isomorphic to "Map LocalReg Const",
|
This change is about removing label in JoinFun. Can we draw a conclusion on this and close it? We can open an issue to discuss the rest cleanup proposal. |
The API refers to contents of
No. It is equivalent to
No. In the end we managed to find a way to implement what we wanted without Hoopl.
The important question is: is it possible to write code that ever uses bottom for forward analysis? We believe no.
IIUC you want to reject this change? |
If you supply analyzeAndRewriteFwd with a total function as FactBase, then fact_bot will not be used, otherwise, fact_bot is the default value for any nodes that is not in the domain of FactBase. Yes, it's possible to write such an analysis. As a matter of fact, Hoopl/testing/ConstProp.hs is such an analysis that uses fact_bot.
Yes, I reject this change. |
Ning, Jan There’s a conversation going on here that I do not fully understand. · I think that Jan and his student are working on Hoopl clean-ups arising from Jan’s internship here at MSR. · These clean-ups are described here: https://ghc.haskell.org/trac/ghc/wiki/Hoopl/Cleanup · Generally, as one of the original authors of Hoopl, I’m keen on moving forward on these changes, and I’m delighted to see work happening on them. · Ning has very helpfully taken on the role of Hoopl maintainer. · I believe that Ning is not keen on at least some of the proposed changes. He may well have good reasons for this. Beyond that I have gotten lost in the detail. Can you guys outline what, if any, are the points of disagreement? What are the proposed changes at the moment? Have any of Jan’s proposals being merged? If not, is that because you aren’t happy with them, Ning, or because you haven’t had time? Thank you both for working on Hoopl – it needs love! Simon From: Ning Wang [mailto:notifications@github.com] On 1/22/2016 7:29 AM, Jan Stolarek wrote:
Bot is never used is not equivalant to the last parameter of Do you still have the problematic code around? BTW, your definition of CPFact is isomorphic to "Map LocalReg Const",
— |
The proposed changes are:
Separately from the discussion here, it is possible that we will have a cleanup of GHC's internal |
OK thanks.
So it doesn’t sound as if there is much disagreement – good! Simon From: Jan Stolarek [mailto:notifications@github.com] The proposed changes are:
Separately from the discussion here, it is possible that we will have a cleanup of GHC's internal Dataflow module. This is independent of hoopl library. — |
I'm glad to see Jan's team is working on hoopl. I'm sure it will make hoopl better in the long run.
Thanks for the trust. I might be too conservative. It's always good to have other stakeholders (Jan's team and ghc-dev) to pull it in the another direction.
Jan summarized the recent conversation well. I want to answer the question about Jan's students' pull requests.
|
Hello. I'm not trying to be rude, but I have question (especilally to @mlite ): I've been trying to check if fact_bot is really used if forward analysis, as discussed:
And changed
I know it doesn't make much sense (because we need fact_bot for backward analysis), but the thing is: after running tests - all passed. In other words, it seems to me that bottom isn't used in case of tests. Can anyone tell me if I'm doing/getting something wrong? I appreciate your help. |
So this thread is starting to grow really large and discuss too many things at the same time. Initially it was about removing the Label parameter, so maybe let's keep this focused on that change (and discuss whether we need bottom to a separate PR or issue). Hope that's ok with everybody. As for removing the Label param, I didn't have time to look into this yet, I'll try to find some time later this week. |
AlexanderPankiv, please open another issue to discuss the remaining cleanup proposal. |
should be reworked anyway |
Please put this on hold until I change it on compiler side.