Skip to content
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

Rename some exploration strategies - Simplify DFS and random selection #3918

Merged
merged 10 commits into from
Mar 17, 2023

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented Mar 6, 2023

This PR does two major things:

Renames some components and deletes strategies which are defunct:

  • IncrementalStack -> DepthFirstSearch
  • RandomAccessStack -> [deleted]
  • IncrementalMaxCoverageStack -> [deleted]
  • LinearEnumeration -> [deleted]
  • UnboundedRandomAccessStack -> RandomBacktrack
  • GreedyPotential -> GreedyStmtSelection
  • RandomAccessMaxCoverage -> RandomMaxStmtCoverage
  • ExplorationStrategy -> SymbolicExecutor

The second part of this PR is a simplification of DFS and random search. Most of the stack code is removed and the list of unexplored branches is flattened. We also do early pruning now. Branches are only added to the list of unexplored branches if their path conditions are actually satisfiable. We only select a branch from a list that can be satisfied.

@fruffy fruffy added the p4tools Topics related to the P4Tools back end label Mar 6, 2023
@fruffy
Copy link
Collaborator Author

fruffy commented Mar 6, 2023

@VolodymyrPeschanenko
This PR simplifies DFS to be more efficient and less complex in implementation. However, the gtest for the reachability analysis is running into an infinite loop. In particular the command

p4c/build/p4testgen -I "p4c/build/p4include" --target bmv2  --std p4-16 --test-backend STF --arch v1model --seed 1000 --max-tests 10  --pattern "ingress.MyAction1;ingress.table2" --out-dir "p4c/build/tmp" "p4c/backends/p4tools/modules/testgen/targets/bmv2/test/p4-programs/bmv2_if.p4"

Do you know what the cause of this could be?

Edit: I think I found the root cause and fixed it. The analysis always returns its own state, which may cause it to execute on the same execution state forever.

@fruffy fruffy force-pushed the strategies_2 branch 3 times, most recently from 32fed45 to ac597f1 Compare March 7, 2023 02:59
@VolodymyrPeschanenkoLitSoft
Copy link
Contributor

@VolodymyrPeschanenko This PR simplifies DFS to be more efficient and less complex in implementation. However, the gtest for the reachability analysis is running into an infinite loop. In particular the command

p4c/build/p4testgen -I "p4c/build/p4include" --target bmv2  --std p4-16 --test-backend STF --arch v1model --seed 1000 --max-tests 10  --pattern "ingress.MyAction1;ingress.table2" --out-dir "p4c/build/tmp" "p4c/backends/p4tools/modules/testgen/targets/bmv2/test/p4-programs/bmv2_if.p4"

Do you know what the cause of this could be?

Edit: I think I found the root cause and fixed it. The analysis always returns its own state, which may cause it to execute on the same execution state forever.

I can't repeat this problem on MacOS. I'll try to check it on the latest ubuntu, but it'll take some time.

@fruffy
Copy link
Collaborator Author

fruffy commented Mar 9, 2023

I can't repeat this problem on MacOS. I'll try to check it on the latest ubuntu, but it'll take some time.

Thanks for checking! I implemented a fix for it here:
a7eeca8

Do these changes make sense? Otherwise I run into an infinite loop.

@VolodymyrPeschanenkoLitSoft
Copy link
Contributor

I can't repeat this problem on MacOS. I'll try to check it on the latest ubuntu, but it'll take some time.

Thanks for checking! I implemented a fix for it here: a7eeca8

Do these changes make sense? Otherwise I run into an infinite loop.

Yes, these changes are correct.

@fruffy fruffy force-pushed the strategies_2 branch 8 times, most recently from ff8268f to 3aea3e7 Compare March 16, 2023 18:55
@fruffy fruffy marked this pull request as ready for review March 17, 2023 15:51
Copy link
Contributor

@jnfoster jnfoster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love getting the names right!

@fruffy fruffy merged commit ada3b00 into main Mar 17, 2023
@fruffy fruffy deleted the strategies_2 branch March 18, 2023 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4tools Topics related to the P4Tools back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants