-
Notifications
You must be signed in to change notification settings - Fork 444
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
Compiler Bug: write set already set #4548
Comments
May be a duplicate of #4500. |
If this was also introduced by e60cb8a, then it may make sense to disable the problematic second |
Transform is a very expensive visitor. It can copy the entire IR AST if small leaf elements like Path Expressions or members are cloned. |
Another thing that could lead to the memory blowup is the use of I haven't investigated deeper. Might be worthwhile to track this in a separate issue. |
It's not the |
I have confirmed that this was also introduced by e60cb8a. |
Should we create an umbrella issue for all these regressions? It looks like reverting the PR is the way to go. I can also confirm that I have not enabled P4Smith tests because they all produce similar problems: https://github.com/p4lang/p4c/blob/main/backends/p4tools/modules/smith/scripts/compilation-test.sh#L51 DefUse should not be this sensitive to its location in the compiler though, something else is amiss here. |
We can do that, but the PR should add all the issue programs as samples, too. It should also keep the program bug that was fixed (maybe add it to errs as long as the issue remains open?). |
Yes of course, sorry, by "revert" I just mean we should remove the second |
I can do that as well. |
Which bug did it actually fix? #3508? |
Understood, I just want to preserve the example programs that have been added because of these issues in one way or the other.
Unclear to me actually, #3508 was "fixed" but the underlying problem was not iirc. Need to check why this change was added. |
This is the same problem as described in #4500.
|
The fundamental problem is that there is no pass which can reliably convert an IR DAG into an IR tree. |
@mihaibudiu Note also #4385 (comment). Possible solutions I can think of right now:
|
The IR is always a dag and the is no way to enforce the result being a tree |
@mihaibudiu (1) would certainly produce a tree. Am I missing something? |
You cannot write a pass that enforces that the IR is a tree using the existing visitor infrastructure, because the visitor will refuse to replace a node with another one that it considers "equal". The SimplifyDefUse::Clone pass is an attempt to do (1), which has failed. |
Ah, I see. So (2) seems like the most robust solution to me at the moment, but I'm not sure if it is possible or how difficult it would be to implement |
Some passes maintain properties for IR nodes using maps from IR nodes to properties. This is what def-use does. The problem is that the DAG representation uses a single IR node for two subdags, but the properties attached to these subdags should be different, because they depend not only on the dag, but also on its context. So you would need to put in the map not just the node, but its context as well. So (2) is not trivial. |
The midend def_use pass uses the context as well as the node, so can deal with DAGs just fine. |
@ChrisDodd Are you referring to the |
Will this solution work in all cases? What if a parent has multiple children, with 2 or more children being the same |
I assume @ChrisDodd will answer this question |
I have lost track on this. It seems fixed but what about the other related regressions?
regression
|
The command "p4test test.p4 -v" is used to compile the following code:
result in :
I would like to know if there is an issue with my usage.
my p4c version:
p4c 1.2.4.9
I would appreciate your assistance with GitHub. Thank you.
The text was updated successfully, but these errors were encountered: