Skip to content

CBMC additional profiling info: Count and report all array constraints added during postprocessing #5478

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

Merged
merged 12 commits into from
Nov 19, 2020

Conversation

natasha-jeppu
Copy link

Track constraints added for arrays in post processing as a potentially useful metric for performance evaluation.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Comment on lines 85 to 104
enum class constraint_typet
{
ARRAY_ACKERMANN,
ARRAY_EQUALITY,
ARRAY_WITH,
ARRAY_WITH_OTHER,
ARRAY_IF_TRUE,
ARRAY_IF_FALSE,
ARRAY_OF,
ARRAY_TYPECAST,
ARRAY_CONSTANT,
ARRAY_NON_CONSTANT,
ARRAY_COMPREHENSION
};

typedef std::list<exprt> array_constraintst;
typedef std::map<constraint_typet, array_constraintst> array_constraints_mapt;
array_constraints_mapt array_constraints_map;
void display_constraints();
std::string enum_to_string(constraint_typet);
Copy link
Author

Choose a reason for hiding this comment

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

Is there a better way of doing this? Wanted to include more specific information regarding the type of constraint. For example split constraints added for array_with to constraints added for the specific index and for other indices.

@danielsn danielsn added the aws Bugs or features of importance to AWS CBMC users label Aug 26, 2020
Copy link
Member

@peterschrammel peterschrammel left a comment

Choose a reason for hiding this comment

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

I thought this was about reporting metrics, but this PR stores copies of constraints and outputs them - what is the use case for this very detailed information?


typedef std::list<exprt> array_constraintst;
typedef std::map<constraint_typet, array_constraintst> array_constraints_mapt;
array_constraints_mapt array_constraints_map;
Copy link
Member

@peterschrammel peterschrammel Sep 3, 2020

Choose a reason for hiding this comment

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

❗Storing copies of these constraints is not ideal wrt memory consumption.

Copy link
Author

Choose a reason for hiding this comment

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

No longer applicable, changed to store only number of constraints, don't store the constraints themselves.

@natasha-jeppu
Copy link
Author

natasha-jeppu commented Sep 3, 2020

I thought this was about reporting metrics, but this PR stores copies of constraints and outputs them - what is the use case for this very detailed information?

The intention was to investigate how array constraints added during post processing affects CBMC performance.

In order to see if the constraints themselves give any information, I tracked them here. But this is not very helpful indeed. I will be changing this to track just the number of constraints rather than the constraints themselves.

Let me know if you have any other metric in mind pertaining to this that could be useful.

Comment on lines 85 to 98
enum class constraint_typet
{
ARRAY_ACKERMANN,
ARRAY_EQUALITY,
ARRAY_WITH,
ARRAY_WITH_OTHER,
ARRAY_IF_TRUE,
ARRAY_IF_FALSE,
ARRAY_OF,
ARRAY_TYPECAST,
ARRAY_CONSTANT,
ARRAY_NON_CONSTANT,
ARRAY_COMPREHENSION
};
Copy link
Author

Choose a reason for hiding this comment

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

Is there a clean way of extending the existing lazy_typet enum class into a new enum class to include ARRAY_EQUALITY? Do not want to change the meaning of the lazy_typet by adding ARRAY_EQUALITY to the existing enum class.

Copy link
Author

Choose a reason for hiding this comment

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

@codecov
Copy link

codecov bot commented Sep 11, 2020

Codecov Report

Merging #5478 (04341a8) into develop (46b3f01) will decrease coverage by 0.00%.
The diff coverage is 54.16%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5478      +/-   ##
===========================================
- Coverage    69.34%   69.34%   -0.01%     
===========================================
  Files         1241     1241              
  Lines       100488   100530      +42     
===========================================
+ Hits         69688    69709      +21     
- Misses       30800    30821      +21     
Flag Coverage Δ
cproversmt2 43.13% <35.41%> (-0.01%) ⬇️
regression 66.24% <54.16%> (-0.01%) ⬇️
unit 32.26% <20.83%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/cbmc/cbmc_parse_options.h 100.00% <ø> (ø)
src/solvers/flattening/bv_pointers.h 100.00% <ø> (ø)
src/solvers/flattening/arrays.cpp 83.39% <40.00%> (-6.37%) ⬇️
src/solvers/flattening/arrays.h 91.66% <50.00%> (+1.66%) ⬆️
src/cbmc/cbmc_parse_options.cpp 77.62% <100.00%> (+0.30%) ⬆️
src/goto-checker/solver_factory.cpp 67.42% <100.00%> (+0.18%) ⬆️
src/solvers/flattening/boolbv.h 78.57% <100.00%> (ø)
src/solvers/flattening/bv_pointers.cpp 82.40% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46b3f01...04341a8. Read the comment docs.

@natasha-jeppu natasha-jeppu marked this pull request as ready for review September 23, 2020 16:18
^SIGNAL=0$
--
--
To test output for --show-array-constraints option that displays the count and list of all array constraints added during post processing in json format.
Copy link
Member

Choose a reason for hiding this comment

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

⛏️ missing newline at end of file

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

^SIGNAL=0$
--
--
To test output for --show-array-constraints option that displays the count and list of all array constraints added during post processing in json format.
Copy link
Member

Choose a reason for hiding this comment

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

⛏️ missing newline at end of file

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@danielsn danielsn force-pushed the array_theory branch 2 times, most recently from 1c8aa27 to c88821c Compare November 19, 2020 15:39
Natasha Yogananda Jeppu added 12 commits November 19, 2020 12:47
…added during post processing

Array theory constraints added during post processing might be useful to reason
about proof runtimes. This commit adds a new parse option --show-array-constraints
that tracks constraints pertaining to arrays added during post processing.
… format

This commit adds utilities to track array constraints and also the type of
constraint being added, eg: ackermann constraint, array_of etc. Added a new
enum class constraint_typet which is an extension of lazy_typet. This enum class
includes a separate value for constraints added for other indices array_with,
constraints added for the 'true' and 'false branches of if etc in addition to
those available in lazy_typet. Also define a new member of type std::map that
tracks mapping between type of constraint and the constraint itself.
Currently support json output.
…boolean option used in arrayst class

Add an additional boolean argument to the class constrcutor to propagate the setting of
parse option --show-array-constraints to true to the arrayst class. The entry point for this
is in the default invocation of solver factory.
… format

This commit adds utilities to track array constraints and also the type of
constraint being added, eg: ackermann constraint, array_of etc. Added a new
enum class constraint_typet which is an extension of lazy_typet. This enum class
includes a separate value for constraints added for other indices array_with,
constraints added for the 'true' and 'false branches of if etc in addition to
those available in lazy_typet. Also define a new member of type std::map that
tracks mapping between type of constraint and the constraint itself.
Currently support json output.

clang format arrays.cpp
…boolean option used in arrayst class

Add an additional boolean argument to the class constrcutor to propagate the setting of
parse option --show-array-constraints to true to the arrayst class. The entry point for this
is in the default invocation of solver factory.

clang format solver_factory and bv_pointers
clang format regression test

Adding KNOWNBUG flag to ignore failed test

The --smt2 option does not go over arrayst class so no output is generated.
The current test thus fails on test-cprover-smt2.
…added during post processing

Array theory constraints added during post processing might be useful to reason
about proof runtimes. This commit adds a new parse option --show-array-constraints
that tracks constraints pertaining to arrays added during post processing.

fix command line argument to display error message of xml or plain format is used
@tautschnig tautschnig merged commit 6648620 into diffblue:develop Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants