-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reenable compilation tests for P4Smith. (#4791)
* Add compilation support for P4Smith for DPDK, eBPF, V1model, and p4test. Change $TEST_DIR/out.p4 to $TEST_DIR/out_$i.p4 to generate different programs with different seeds (to inspect the behavior of the generation and compilation process in a finer/smaller granularity) Switch the order of --arch and --target Revert the version of backends/p4tools/modules/smith/scripts/compilation-test.sh back to the commit d34f60e, and switch the order of core and generic in backends/p4tools/modules/smith/targets/generic/test/P4Tests.cmake Modify the argument settings for multiple targets and architectures Attempt to make sure that only primitive-type parameters are used when generating the parameter list for the BMv2 portion of the fuzzer Fix the previous erroneous treatment of "bmv2" from archName to deviceName Add TODOs to remind myself to revert `out_$i.p4` back to `out.p4` to avoid dumping too many generated files after the debugging process 1. Instead of adding target-specific check in the target-independent core, preliminarily override the virtual method in the BMv2 backend (still hasn't worked yet) 2. Get rid of and expand the function signature of Refactor the implemented inheritance pattern Clang-format some source file Fix a linter issue Implement a mechanism to maintain a list of "known" bugs and not fail the test if those bugs occur Modify the output-printing mechanism Add another element to `KNOWN_BUGS` Add an echo statement to display the encounted bug using the `is_known_bug` function Modify echo statements Preliminarily add code to generate an approriate return statement for `pna_pre_output_metadata_t` Fix a linter issue Add a TODO to fix the casting bug Make use of `new IR::Type_Name` Hard-code to attempt to resolve the casting issue The current type casting is still erroneous Add commented-out code that doesn't work and add TODOs Fix linter issues Resolve the infinite recursing issue Improve the implementation to be modular (but still doesn't work) Fix some auxillary issues Refine type resolving Refine recursive type resolving Fix the "Arch '<null>' not supported by P4Runtime serializer" error Specify the compiler binary with extentions in the corresponding P4Tests.cmake file instead of the bash script Simplify the constructor Bmv2V1ModelDeclarationGenerator Remove 128 from the accepted bitwidths in the Expression Generator for the dpdk taget Activate `byte_align_headers` to `true` to support bit alignments Add a known bug: `terminate called after throwing an instance of 'Util::CompilerBug'` Modify the previously documented known bug to a fine-grained version Make further attempts to resolve type resolving Resolve a typo made previously Further refine type resolving and remove redundant code Implement explicit casting for `SecurityAssocId_t` for both assignment and return statements Revert the type signature of `genStructListExpr` from `IR::Expression` back to `IR::ListExpression` Revert the type signature of `getTypeByName` from `IR::Type` back to `IR::Type_Declaration` Revert the type signature of `genStructListExpr` from `IR::Expression` back to `IR::ListExpression` Preliminarily modify the previous type resolving/casting mechanism Remove the previous added, redundant `genBitType` with different arguments than the default `genBitType` Add print-outs to address the tuple-wrapping issue Resolve the typing issue of `SecurityAssocId_t` in a more generic way Make the bug documented in `KNOWN_BUGS` more generic Experimentally migrate the `Bmv2V1ModelDeclarationGenerator` class and its constructor and (overridden) member function to declarations.cpp and declarations.h in the `bmv2` target Experimentally migrate the `Bmv2V1ModelDeclarationGenerator` class and its constructor and (overridden) member function to declarations.cpp and declarations.h in the `bmv2` target Fix linter issues from the previous commit(s) Fix the issue caused by erroneously formatting backends/p4tools/modules/smith/targets/bmv2/CMakeLists.txt Set `byte_align_headers` true for the `nic` target Prohibit `128` from being a valid bit size for the `nic` target Document a known bug in the script Fix the previous linter issue(s) Support to generate well-typed parameter lists for the `nic` target Remove the hard-coded rhs-casting(s) of assignment generations Add a TODO (to make the bitwidth a generic parameter) 1. Preliminarily make the bitwidth a generic parameter (by implementing a template function) 2. Document a known bug Revert backends/p4tools/modules/smith/scripts/compilation-test.sh back to its original form since it is cluelessly `clang-format`ed Reactivate the executable permission of backends/p4tools/modules/smith/scripts/compilation-test.sh Preliminarily implement `pna_main_parser_input_metadata_t`'s field generations (although `enum` is not supported right now) Rename the previous `Bmv2V1ModelDeclarationGenerator` class to `Bmv2ModelDeclarationGenerator` and apply it (and its members) to the `psa` arch 1. Add a struct member in the `Constraints` struct to limit the maximum bit width (default value: 128) 2. Set it to 64 for the pna arch, dpdk target Fixups. Signed-off-by: zzmic <100326374+zzmic@users.noreply.github.com> Signed-off-by: fruffy <fruffy@nyu.edu> * Clean up initialization of probabilities. Signed-off-by: fruffy <fruffy@nyu.edu> * Add support for parallel test runs, simplify bit literal generation. Signed-off-by: fruffy <fruffy@nyu.edu> --------- Signed-off-by: zzmic <100326374+zzmic@users.noreply.github.com> Signed-off-by: fruffy <fruffy@nyu.edu> Co-authored-by: fruffy <fruffy@nyu.edu>
- Loading branch information
Showing
27 changed files
with
713 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
240 changes: 151 additions & 89 deletions
240
backends/p4tools/modules/smith/common/declarations.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef BACKENDS_P4TOOLS_MODULES_SMITH_COMMON_PROBABILITIES_H_ | ||
#define BACKENDS_P4TOOLS_MODULES_SMITH_COMMON_PROBABILITIES_H_ | ||
|
||
#include "backends/p4tools/modules/smith/common/probabilities.h" | ||
|
||
namespace P4::P4Tools::P4Smith {} // namespace P4::P4Tools::P4Smith | ||
|
||
#endif /* BACKENDS_P4TOOLS_MODULES_SMITH_COMMON_PROBABILITIES_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.