Skip to content

Commit

Permalink
Move all components left to new memory model
Browse files Browse the repository at this point in the history
This commit contains a bunch of similar changes in different files,
required to move to new memory.
  • Loading branch information
aleasims committed Mar 4, 2024
1 parent a4ff8a7 commit 171b1e3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/nil/blueprint/curves/init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace nil {
ASSERT(inst->getOperand(0)->getType() == inst->getOperand(1)->getType());
ASSERT(inst->getOperand(0)->getType()->isFieldTy());

std::size_t arg_num = field_arg_num<BlueprintFieldType>(inst->getOperand(0)->getType());
std::size_t arg_num = field_chunks_num<BlueprintFieldType>(llvm::cast<llvm::GaloisFieldType>(inst->getOperand(0)->getType()));
if (arg_num == 1) {
VarType x = frame.scalars[inst->getOperand(0)];
VarType y = frame.scalars[inst->getOperand(1)];
Expand Down
5 changes: 3 additions & 2 deletions include/nil/blueprint/extract_constructor_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ namespace nil {
if (gen_mode.has_assignments()) {
ptr_type input_ptr = static_cast<ptr_type>(
typename BlueprintFieldType::integral_type(var_value(assignment, variables[input_value]).data));
size_type elem_size = (BlueprintFieldType::number_bits + 7) / 8;
for (std::size_t i = 0; i < input_length; i++) {
ASSERT(memory[input_ptr].size == (BlueprintFieldType::number_bits + 7) / 8);
const auto origin_var = memory.load(input_ptr++);
const auto origin_var = memory.load(input_ptr, elem_size);
input_ptr += elem_size;
const auto wrapper = detail::put_constant<typename BlueprintFieldType::value_type,
BlueprintFieldType, ArithmetizationParams, var>
(var_value(assignment, origin_var), assignment);
Expand Down
5 changes: 3 additions & 2 deletions include/nil/blueprint/integers/bit_de_composition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ namespace nil {
if (param.gen_mode.has_assignments()) {
ptr_type result_ptr = static_cast<ptr_type>(
typename BlueprintFieldType::integral_type(var_value(assignment, variables[result_value]).data));
size_type elem_size = (BlueprintFieldType::number_bits + 7) / 8;
for (var v : result) {
ASSERT(memory[result_ptr].size == (BlueprintFieldType::number_bits + 7) / 8);
memory.store(result_ptr++, v);
memory.store(result_ptr, (BlueprintFieldType::number_bits + 7) / 8, v);
result_ptr += elem_size;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions include/nil/blueprint/recursive_prover/fri_array_swap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ namespace nil {
ptr_type result_ptr = static_cast<ptr_type>(typename BlueprintFieldType::integral_type(
var_value(assignment, frame.scalars[result_value]).data));
for (std::size_t i = 0; i < array_size; i++) {
ASSERT(memory[result_ptr].size == (BlueprintFieldType::number_bits + 7) / 8);
memory.store(result_ptr++, res[i]);
size_type elem_size = (BlueprintFieldType::number_bits + 7) / 8;
memory.store(result_ptr, elem_size, res[i]);
result_ptr += elem_size;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions include/nil/blueprint/recursive_prover/fri_cosets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ namespace nil {
typename BlueprintFieldType::integral_type(var_value(assignment, variables[result_value]).data));
for (std::size_t i = 0; i < result.size(); i++) {
for (std::size_t j = 0; j < 3; j++) {
ASSERT(memory[result_ptr].size == (BlueprintFieldType::number_bits + 7) / 8);
memory.store(result_ptr++, result[i][j]);
size_type elem_size = (BlueprintFieldType::number_bits + 7) / 8;
memory.store(result_ptr, elem_size, result[i][j]);
result_ptr += elem_size;
}
}
}
Expand Down

0 comments on commit 171b1e3

Please sign in to comment.