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

[P4_Symbolic] Eliminate the use of a global Z3 context. #928

Merged
merged 12 commits into from
Jan 7, 2025

Conversation

VSuryaprasad-HCL
Copy link
Contributor

Keyword Check:
~/sonic-buildimage/src/sonic-p4rt/sonic-pins$ ~/tools/keyword_checks.sh .
Keyword check Passed.

Build Result:
/sonic/src/sonic-p4rt/sonic-pins$ bazel build $BAZEL_BUILD_OPTS ...
INFO: Analyzed 671 targets (2 packages loaded, 162 targets configured).
INFO: Found 671 targets...
INFO: From Compiling p4_symbolic/symbolic/values.cc:
In file included from ./p4_symbolic/z3_util.h:18,
from p4_symbolic/symbolic/values.cc:46:
./p4_pdpi/string_encodings/bit_string.h: In member function 'void pdpi::BitString::AppendBytes(absl::lts_20230802::string_view)':
./p4_pdpi/string_encodings/bit_string.h:55:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::basic_string_view::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | for (int i = 0; i < bytes.size(); i++) {
| ~~^~~~~~~~~~~~~~
./p4_pdpi/string_encodings/bit_string.h: In instantiation of 'void pdpi::BitString::AppendBits(const std::bitset<_Nb>&) [with long unsigned int num_bits = 8]':
./p4_pdpi/string_encodings/bit_string.h:41:50: required from here
./p4_pdpi/string_encodings/bit_string.h:49:23: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
49 | for (int i = 0; i < num_bits; i++) {
| ~~^~~~~~~~~~
INFO: From Compiling p4_symbolic/symbolic/action.cc:
In file included from ./p4_symbolic/z3_util.h:18,
from p4_symbolic/symbolic/action.cc:28:
./p4_pdpi/string_encodings/bit_string.h: In member function 'void pdpi::BitString::AppendBytes(absl::lts_20230802::string_view)':
./p4_pdpi/string_encodings/bit_string.h:55:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::basic_string_view::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | for (int i = 0; i < bytes.size(); i++) {
| ~~^~~~~~~~~~~~~~
./p4_pdpi/string_encodings/bit_string.h: In instantiation of 'void pdpi::BitString::AppendBits(const std::bitset<_Nb>&) [with long unsigned int num_bits = 8]':
./p4_pdpi/string_encodings/bit_string.h:41:50: required from here
./p4_pdpi/string_encodings/bit_string.h:49:23: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
49 | for (int i = 0; i < num_bits; i++) {
| ~~^~~~~~~~~~
INFO: From Compiling p4_symbolic/symbolic/table.cc:
p4_symbolic/symbolic/table.cc: In function 'std::vector<std::pair<int, p4_symbolic::ir::TableEntry> > p4_symbolic::symbolic::table::{anonymous}::SortEntries(const p4_symbolic::ir::Table&, const std::vector<p4_symbolic::ir::TableEntry>&)':
p4_symbolic/symbolic/table.cc:135:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<p4_symbolic::ir::TableEntry>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
135 | for (int i = 0; i < entries.size(); i++) {
| ~~^~~~~~~~~~~~~~~~
INFO: From Compiling p4_symbolic/z3_util.cc:
In file included from ./p4_symbolic/z3_util.h:18,
from p4_symbolic/z3_util.cc:15:
In file included from p4_symbolic/tests/sai_p4_component_test.cc:26:
./p4_pdpi/pd.h:142:36: note: declared here
142 | absl::StatusOrp4::v1::TableEntry PartialPdTableEntryToPiTableEntry(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from p4_symbolic/tests/sai_p4_component_test.cc:21:
p4_symbolic/tests/sai_p4_component_test.cc: In member function 'virtual void p4_symbolic::{anonymous}::P4SymbolicComponentTest_CanGenerateTestPacketsForSimpleSaiP4Entries_Test::TestBody()':
p4_symbolic/tests/sai_p4_component_test.cc:158:32: warning: 'absl::lts_20230802::StatusOrp4::v1::TableEntry pdpi::PartialPdTableEntryToPiTableEntry(const pdpi::IrP4Info&, const google::protobuf::Message&, const pdpi::TranslationOptions&)' is deprecated: Use PdTableEntryToPiEntity instead [-Wdeprecated-declarations]
158 | pdpi::PartialPdTableEntryToPiTableEntry(ir_p4info, pd_entry));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gutil/status_matchers.h:63:43: note: in definition of macro 'ASSERT_OK_AND_ASSIGN'
63 | auto __ASSIGN_OR_RETURN_VAL(LINE) = expression;
| ^~~~~~~~~~
In file included from p4_symbolic/tests/sai_p4_component_test.cc:26:
./p4_pdpi/pd.h:142:36: note: declared here
142 | absl::StatusOrp4::v1::TableEntry PartialPdTableEntryToPiTableEntry(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from p4_symbolic/tests/sai_p4_component_test.cc:21:
p4_symbolic/tests/sai_p4_component_test.cc:158:85: warning: 'absl::lts_20230802::StatusOrp4::v1::TableEntry pdpi::PartialPdTableEntryToPiTableEntry(const pdpi::IrP4Info&, const google::protobuf::Message&, const pdpi::TranslationOptions&)' is deprecated: Use PdTableEntryToPiEntity instead [-Wdeprecated-declarations]
158 | pdpi::PartialPdTableEntryToPiTableEntry(ir_p4info, pd_entry));
| ^
./gutil/status_matchers.h:63:43: note: in definition of macro 'ASSERT_OK_AND_ASSIGN'
63 | auto __ASSIGN_OR_RETURN_VAL(LINE) = expression;
| ^~~~~~~~~~
In file included from p4_symbolic/tests/sai_p4_component_test.cc:26:
./p4_pdpi/pd.h:142:36: note: declared here
142 | absl::StatusOrp4::v1::TableEntry PartialPdTableEntryToPiTableEntry(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./p4_symbolic/z3_util.h:18,
from p4_symbolic/tests/sai_p4_component_test.cc:28:
./p4_pdpi/string_encodings/bit_string.h: In instantiation of 'void pdpi::BitString::AppendBits(const std::bitset<_Nb>&) [with long unsigned int num_bits = 8]':
./p4_pdpi/string_encodings/bit_string.h:41:50: required from here
./p4_pdpi/string_encodings/bit_string.h:49:23: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
49 | for (int i = 0; i < num_bits; i++) {
| ~~^~~~~~~~~~
INFO: Elapsed time: 41.210s, Critical Path: 8.32s
INFO: 73 processes: 8 internal, 65 linux-sandbox.
INFO: Build completed successfully, 73 total actions

Test Result:
/sonic/src/sonic-p4rt/sonic-pins$ bazel test $BAZEL_BUILD_OPTS --cache_test_results=no ...
INFO: Analyzed 671 targets (0 packages loaded, 31 targets configured).
INFO: Found 454 targets and 217 test targets...
INFO: Elapsed time: 201.734s, Critical Path: 112.44s
INFO: 271 processes: 327 linux-sandbox, 18 local.
INFO: Build completed successfully, 271 total actions
//dvaas:port_id_map_test PASSED in 0.8s
//dvaas:test_run_validation_golden_test PASSED in 0.0s
//dvaas:test_run_validation_test PASSED in 0.6s
//dvaas:test_run_validation_test_runner PASSED in 0.0s
//dvaas:test_vector_stats_diff_test PASSED in 0.1s
//dvaas:test_vector_stats_test PASSED in 0.0s
//dvaas:test_vector_test PASSED in 0.6s
//dvaas:user_provided_packet_test_vector_diff_test PASSED in 0.1s
//dvaas:user_provided_packet_test_vector_test PASSED in 0.1s
//gutil:collections_test PASSED in 0.6s
//gutil:io_test PASSED in 0.5s
//gutil:proto_matchers_test PASSED in 0.7s
//gutil:proto_ordering_test PASSED in 0.6s
//gutil:proto_test PASSED in 0.5s
//gutil:status_matchers_test PASSED in 0.5s
//gutil:test_artifact_writer_test PASSED in 0.6s
//gutil:testing_test PASSED in 0.5s
//gutil:timer_test PASSED in 5.1s
//gutil:version_test PASSED in 1.2s
//lib:basic_switch_test PASSED in 0.9s
//lib:ixia_helper_test PASSED in 1.2s
//lib/basic_traffic:basic_p4rt_util_test PASSED in 1.0s
//p4rt_app/tests:response_path_test PASSED in 6.6s
//p4rt_app/tests:role_test PASSED in 1.6s
//p4rt_app/tests:state_verification_test PASSED in 3.2s
//p4rt_app/tests:vrf_table_test PASSED in 2.7s
//p4rt_app/tests/lib:app_db_entry_builder_test PASSED in 0.0s
//p4rt_app/utils:event_data_tracker_test PASSED in 0.0s
//p4rt_app/utils:table_utility_test PASSED in 0.7s
//sai_p4/instantiations/google:clos_stage_test PASSED in 0.5s
//sai_p4/instantiations/google:fabric_border_router_p4info_up_to_date_test PASSED in 0.1s
//sai_p4/instantiations/google:middleblock_p4info_up_to_date_test PASSED in 0.0s
//sai_p4/instantiations/google:sai_nonstandard_platforms_build_test PASSED in 0.1s
//sai_p4/instantiations/google:sai_nonstandard_platforms_cc_test PASSED in 0.6s
//sai_p4/instantiations/google:sai_p4info_fetcher_test PASSED in 0.7s
//sai_p4/instantiations/google:sai_p4info_test PASSED in 1.3s
//sai_p4/instantiations/google:sai_pd_proto_test PASSED in 0.0s
//sai_p4/instantiations/google:sai_pd_util_test PASSED in 0.6s
//sai_p4/instantiations/google:tor_p4info_up_to_date_test PASSED in 0.0s
//sai_p4/instantiations/google:union_p4info_up_to_date_test PASSED in 0.1s
//sai_p4/instantiations/google:wbb_p4info_up_to_date_test PASSED in 0.0s
//sai_p4/instantiations/google/test_tools:table_entry_generator_helper_test PASSED in 1.9s
//sai_p4/instantiations/google/test_tools:test_entries_test PASSED in 1.0s
//sai_p4/instantiations/google/tests:p4_fuzzer_integration_test PASSED in 3.8s
//sai_p4/tools:p4info_tools_test PASSED in 0.6s
//sai_p4/tools:packetio_tools_test PASSED in 0.8s
//tests:thinkit_gnmi_interface_util_tests PASSED in 1.2s
//tests/lib:p4info_helper_test PASSED in 0.9s
//tests/lib:p4rt_fixed_table_programming_helper_test PASSED in 0.8s
//tests/lib:packet_generator_test PASSED in 27.3s
//tests/lib:switch_test_setup_helpers_golden_test PASSED in 0.1s
//tests/lib:switch_test_setup_helpers_golden_test_runner PASSED in 0.1s
//tests/qos:gnmi_parsers_test PASSED in 0.1s
//tests/qos:gnmi_parsers_test_runner PASSED in 0.0s
//tests/sflow:sflow_util_test PASSED in 6.9s
//thinkit:bazel_test_environment_test PASSED in 0.6s
//thinkit:generic_testbed_test PASSED in 0.9s
//thinkit:mock_control_device_test PASSED in 0.6s
//thinkit:mock_generic_testbed_test PASSED in 0.7s
//thinkit:mock_mirror_testbed_test PASSED in 0.7s
//thinkit:mock_ssh_client_test PASSED in 0.0s
//thinkit:mock_switch_test PASSED in 0.7s
//thinkit:mock_test_environment_test PASSED in 0.1s
//thinkit:switch_test PASSED in 0.7s
//sai_p4/instantiations/google/tests:p4_constraints_integration_test PASSED in 0.9s
Stats over 5 runs: max = 0.9s, min = 0.7s, avg = 0.8s, dev = 0.1s
//sai_p4/instantiations/google/test_tools:table_entry_generator_test PASSED in 45.2s
Stats over 50 runs: max = 45.2s, min = 0.8s, avg = 9.1s, dev = 16.4s

Executed 217 out of 217 tests: 217 tests pass.
INFO: Build completed successfully, 271 total actions

@mssonicbld
Copy link

/azp run

Copy link

No pipelines are associated with this pull request.

@VSuryaprasad-HCL
Copy link
Contributor Author

Co-authored-by: Srikishen Pondicherry Shanmugam kishanps@google.com

Copy link

@jaanah-hcl jaanah-hcl left a comment

Choose a reason for hiding this comment

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

@kishanps Kindly review the PR
Thanks

…ted from symbolic.{cc,h}, and make the context-related objects constructed along with the solver state and then passed along the symbolic evaluation.
@VSuryaprasad-HCL VSuryaprasad-HCL force-pushed the symbolic_import_branch_169 branch from 5f29e67 to 0f87817 Compare January 6, 2025 13:59
@mssonicbld
Copy link

/azp run

Copy link

No pipelines are associated with this pull request.

@kishanps
Copy link
Collaborator

kishanps commented Jan 7, 2025

@VSuryaprasad-HCL Pls fix conflicts

@mssonicbld
Copy link

/azp run

Copy link

No pipelines are associated with this pull request.

@jaanah-hcl
Copy link

@kishanps Merge conflicts are resolved. Kindly review the PR
Thanks

@mssonicbld
Copy link

/azp run

Copy link

No pipelines are associated with this pull request.

@kishanps kishanps merged commit 7cb0b4d into sonic-net:main Jan 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants