-
Notifications
You must be signed in to change notification settings - Fork 270
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
refactor(bb): use RefArray where possible #4686
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e03dbe9
refactor(bb): use RefArray where possible
ludamad0 2cfc6cb
builds
ludamad0 3e785c6
be-gone GCC!
ludamad0 083eac0
fix gcc dockerfile with new build folder
ludamad0 e40ca04
remove std vector usage in row_to_univariates
ludamad0 db668d6
Merge branch 'master' into ad/refactor/bb/flavor-uses-ref-array
ludamad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ RUN cmake --preset gcc -DCI=ON && cmake --build --preset gcc | |
|
||
FROM alpine:3.18 | ||
RUN apk update && apk add libstdc++ | ||
COPY --from=builder /usr/src/barretenberg/cpp/build/bin/bb /usr/src/barretenberg/cpp/build/bin/bb | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. adjustment for the preset change |
||
COPY --from=builder /usr/src/barretenberg/cpp/build-gcc/bin/bb /usr/src/barretenberg/cpp/build/bin/bb |
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") | |
endif() | ||
|
||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
add_compile_options(-fconstexpr-ops-limit=100000000) | ||
add_compile_options(-fconstexpr-ops-limit=100000000 -Wno-psabi) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was confusing people looking at GCC. We don't need to be warned about the GCC ABI |
||
endif() | ||
|
||
# We enable -O1 level optimsations, even when compiling debug wasm, otherwise we get "local count too large" at runtime. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#pragma once | ||
|
||
#include <cstddef> | ||
#include <iterator> | ||
|
||
#include "ref_array.hpp" | ||
#include "ref_vector.hpp" | ||
|
||
namespace bb { | ||
|
||
template <typename T> class RefSpan { | ||
public: | ||
// Default constructor | ||
RefSpan() | ||
: storage(nullptr) | ||
, array_size(0) | ||
{} | ||
|
||
template <std::size_t Size> | ||
RefSpan(const RefArray<T, Size>& ref_array) | ||
: storage(ref_array.get_storage()) | ||
, array_size(Size) | ||
{} | ||
RefSpan(const RefVector<T>& ref_vector) | ||
: storage(&ref_vector.get_storage()[0]) | ||
, array_size(ref_vector.size()) | ||
{} | ||
|
||
// Constructor from an array of pointers and size | ||
RefSpan(T** ptr_array, std::size_t size) | ||
: storage(ptr_array) | ||
, array_size(size) | ||
{} | ||
|
||
// Copy constructor | ||
RefSpan(const RefSpan& other) = default; | ||
|
||
// Move constructor | ||
RefSpan(RefSpan&& other) noexcept = default; | ||
|
||
// Destructor | ||
~RefSpan() = default; | ||
|
||
// Copy assignment operator | ||
RefSpan& operator=(const RefSpan& other) = default; | ||
|
||
// Move assignment operator | ||
RefSpan& operator=(RefSpan&& other) noexcept = default; | ||
|
||
// Access element at index | ||
T& operator[](std::size_t idx) const | ||
{ | ||
// Assuming the caller ensures idx is within bounds. | ||
return *storage[idx]; | ||
} | ||
|
||
// Get size of the RefSpan | ||
constexpr std::size_t size() const { return array_size; } | ||
|
||
// Iterator implementation | ||
class iterator { | ||
public: | ||
iterator(T* const* array, std::size_t pos) | ||
: array(array) | ||
, pos(pos) | ||
{} | ||
|
||
T& operator*() const { return *(array[pos]); } | ||
|
||
iterator& operator++() | ||
{ | ||
++pos; | ||
return *this; | ||
} | ||
|
||
iterator operator++(int) | ||
{ | ||
iterator temp = *this; | ||
++(*this); | ||
return temp; | ||
} | ||
|
||
bool operator==(const iterator& other) const { return pos == other.pos; } | ||
bool operator!=(const iterator& other) const { return pos != other.pos; } | ||
|
||
private: | ||
T* const* array; | ||
std::size_t pos; | ||
}; | ||
|
||
// Begin and end for iterator support | ||
iterator begin() const { return iterator(storage, 0); } | ||
iterator end() const { return iterator(storage, array_size); } | ||
|
||
private: | ||
T* const* storage; | ||
std::size_t array_size; | ||
}; | ||
|
||
} // namespace bb |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just makes it easier to use
./scripts/docker_interactive.sh
thencmake --preset gcc
without moving the native build dir