Skip to content

Commit

Permalink
rebased finished
Browse files Browse the repository at this point in the history
  • Loading branch information
0xThemis committed Jan 3, 2024
1 parent b64015d commit 97fa2da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion libs/blueprint
Submodule blueprint updated 28 files
+2 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/argmax.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/argmin.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/boolean.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/cmp.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/cos.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/div_by_positive.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/dot_rescale_1_gate.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/dot_rescale_2_gates.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/exp.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/floor.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/gather_acc.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/log.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/max.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/min.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/mul_rescale.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/mul_rescale_const.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/neg.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/range.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/rem.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/rescale.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/select.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/sign_abs.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/sin.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/sqrt.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/sqrt_floor.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/tanh.hpp
+1 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/tester.hpp
+2 −1 include/nil/blueprint/components/algebra/fixedpoint/plonk/to_fixedpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef CRYPTO3_ASSIGNER_HANDLE_COMPONENT_HPP
#define CRYPTO3_ASSIGNER_HANDLE_COMPONENT_HPP

#include <functional>
#include <mlir-assigner/memory/stack_frame.hpp>
#include <nil/blueprint/components/algebra/fixedpoint/plonk/to_fixedpoint.hpp>
#include <nil/blueprint/components/algebra/fixedpoint/plonk/sin.hpp>
Expand Down Expand Up @@ -88,8 +89,7 @@ namespace nil {

using var = crypto3::zk::snark::plonk_variable<typename BlueprintFieldType::value_type>;

std::vector<var> all_vars = instance_input.all_vars();
std::vector<std::reference_wrapper<var>> input(all_vars.begin(), all_vars.end());
std::vector<std::reference_wrapper<var>> input = instance_input.all_vars();
const auto &used_rows = assignment.get_used_rows();

for (auto &v : input) {
Expand Down
22 changes: 5 additions & 17 deletions mlir-assigner/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,6 @@ using namespace nil;
using namespace nil::crypto3;
using namespace nil::blueprint;

template<typename TIter>
void print_hex_byteblob(std::ostream &os, TIter iter_begin, TIter iter_end, bool endl) {
os << "0x" << std::hex;
for (TIter it = iter_begin; it != iter_end; it++) {
os << std::setfill('0') << std::setw(2) << std::right << int(*it);
}
os << std::dec;
if (endl) {
os << std::endl;
}
}

template<typename Endianness, typename ArithmetizationType, typename ConstraintSystemType>
void print_circuit(const circuit_proxy<ArithmetizationType> &circuit_proxy,
const assignment_proxy<ArithmetizationType> &table_proxy, bool rename_required,
Expand Down Expand Up @@ -162,7 +150,7 @@ void print_circuit(const circuit_proxy<ArithmetizationType> &circuit_proxy,
cv.resize(filled_val.length(), 0x00);
auto write_iter = cv.begin();
nil::marshalling::status_type status = filled_val.write(write_iter, cv.size());
print_hex_byteblob(out, cv.cbegin(), cv.cend(), false);
out.write(reinterpret_cast<char*>(cv.data()), cv.size());
}

enum class print_table_kind { PRIVATE, SHARED, FULL };
Expand Down Expand Up @@ -346,7 +334,7 @@ void print_assignment_table(const assignment_proxy<ArithmetizationType> &table_p
cv.resize(filled_val.length(), 0x00);
auto write_iter = cv.begin();
nil::marshalling::status_type status = filled_val.write(write_iter, cv.size());
print_hex_byteblob(out, cv.cbegin(), cv.cend(), false);
out.write(reinterpret_cast<char*>(cv.data()), cv.size());
}

template<typename CurveType, bool PrintCircuitOutput>
Expand Down Expand Up @@ -443,7 +431,7 @@ int curve_dependent_main(std::string bytecode_file_name, std::string public_inpu
// print full table
if (parser_instance.assignments.size() == 1) {
std::ofstream otable;
otable.open(assignment_table_file_name);
otable.open(assignment_table_file_name, std::ios_base::binary | std::ios_base::out);
if (!otable) {
std::cout << "Something wrong with output " << assignment_table_file_name << std::endl;
return 1;
Expand All @@ -457,7 +445,7 @@ int curve_dependent_main(std::string bytecode_file_name, std::string public_inpu
} else if (parser_instance.assignments.size() > 1) {
for (const auto &it : parser_instance.assignments) {
std::ofstream otable;
otable.open(assignment_table_file_name + std::to_string(it.get_id()));
otable.open(assignment_table_file_name + std::to_string(it.get_id()), std::ios_base::binary | std::ios_base::out);
if (!otable) {
std::cout << "Something wrong with output " << assignment_table_file_name + std::to_string(it.get_id())
<< std::endl;
Expand All @@ -476,7 +464,7 @@ int curve_dependent_main(std::string bytecode_file_name, std::string public_inpu
std::ofstream ocircuit;
std::string file_name =
parser_instance.circuits.size() > 1 ? circuit_file_name + std::to_string(it.get_id()) : circuit_file_name;
ocircuit.open(file_name);
ocircuit.open(file_name, std::ios_base::binary | std::ios_base::out);
if (!ocircuit) {
std::cout << "Something wrong with output " << file_name << std::endl;
return 1;
Expand Down

0 comments on commit 97fa2da

Please sign in to comment.