Skip to content

Commit

Permalink
chore(avm): pilcom compatibility changes (#10544)
Browse files Browse the repository at this point in the history
For compatibility with upcoming design.
* Creates a columns file
* Relations now have subrelation constexpr
* Relative includes for generated files
* Now you can specify output path for generated files with `-o path`
* Full row uses macro list of columns!*

*warning: GCC didn't like this so I added
```
"CXXFLAGS": "-Wno-missing-field-initializers"
```
the reason is that I'm now defining the AvmFullRow as `FF ALL_ENTITIES;` but GCC prefers it if I do `FF col1{}; FF col2{};...` with the explicit `{}`. If I need to do that, then I need to codegen and repeat again all names.

To be honest IDK why it complains so much, if you Google this, you'll find other people running into it. This should NOT be a problem since any field not specified in aggregate initialization WILL be value-initialized. 

Now, FF's are special in that they don't initialize themselves by default, to accommodate array/other uses cases. (this is a BAD choice if you ask me, there are other ways to avoid explicit initialization if and only when you want to, especially for arrays etc).

Let's see what tests say. In our case the AvmFullRow is only used in a vector, which does somehow force full initialization of all the fields (or at least it did).
  • Loading branch information
fcarreiro authored Dec 9, 2024
1 parent a204d1b commit fbc8c0e
Show file tree
Hide file tree
Showing 50 changed files with 478 additions and 979 deletions.
9 changes: 6 additions & 3 deletions barretenberg/cpp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@
"binaryDir": "build-gcc",
"environment": {
"CC": "gcc",
"CXX": "g++"
"CXX": "g++",
"CXXFLAGS": "-Wno-missing-field-initializers"
}
},
{
Expand All @@ -233,7 +234,8 @@
"inherits": "default",
"environment": {
"CC": "gcc-10",
"CXX": "g++-10"
"CXX": "g++-10",
"CXXFLAGS": "-Wno-missing-field-initializers"
}
},
{
Expand All @@ -243,7 +245,8 @@
"inherits": "default",
"environment": {
"CC": "gcc-13",
"CXX": "g++-13"
"CXX": "g++-13",
"CXXFLAGS": "-Wno-missing-field-initializers"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// AUTOGENERATED FILE
#include "barretenberg/vm/avm/generated/circuit_builder.hpp"
#include "circuit_builder.hpp"

#include <mutex>
#include <set>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#include <vector>

#include "barretenberg/vm/avm/generated/flavor.hpp"
#include "barretenberg/vm/avm/generated/full_row.hpp"
#include "flavor.hpp"
#include "full_row.hpp"

namespace bb {

Expand Down
38 changes: 38 additions & 0 deletions barretenberg/cpp/src/barretenberg/vm/avm/generated/columns.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// AUTOGENERATED FILE
#include "barretenberg/vm/avm/generated/composer.hpp"
#include "composer.hpp"
#include "barretenberg/vm/stats.hpp"

namespace bb {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#pragma once

#include "barretenberg/srs/global_crs.hpp"
#include "barretenberg/vm/avm/generated/circuit_builder.hpp"
#include "barretenberg/vm/avm/generated/prover.hpp"
#include "barretenberg/vm/avm/generated/verifier.hpp"
#include "circuit_builder.hpp"
#include "prover.hpp"
#include "verifier.hpp"

namespace bb {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// AUTOGENERATED FILE
#include "barretenberg/vm/avm/generated/flavor.hpp"
#include "flavor.hpp"

namespace bb {

Expand Down
183 changes: 87 additions & 96 deletions barretenberg/cpp/src/barretenberg/vm/avm/generated/flavor.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// AUTOGENERATED FILE
#include "barretenberg/vm/avm/generated/full_row.hpp"
#include "barretenberg/vm/avm/generated/flavor_settings.hpp"
#include "full_row.hpp"
#include "flavor_settings.hpp"

namespace bb {
namespace bb::avm {
namespace {

template <typename FF> std::string field_to_string(const FF& ff)
Expand Down Expand Up @@ -1568,4 +1568,4 @@ template std::ostream& operator<<(std::ostream& os, AvmFullRow<AvmFlavorSettings
template std::vector<std::string> AvmFullRow<AvmFlavorSettings::FF>::names();
template RefVector<const AvmFlavorSettings::FF> AvmFullRow<AvmFlavorSettings::FF>::as_vector() const;

} // namespace bb
} // namespace bb::avm
Loading

0 comments on commit fbc8c0e

Please sign in to comment.