Skip to content

Commit

Permalink
feat(avm): indirect support for kernel output opcodes (#6962)
Browse files Browse the repository at this point in the history
Adds indirect support to kernel output opcodes, apart from sload and
sstore, being separately handled by @IlyasRidhuan
  • Loading branch information
Maddiaa0 authored Jun 7, 2024
1 parent b19daa4 commit f330bff
Show file tree
Hide file tree
Showing 4 changed files with 288 additions and 102 deletions.
21 changes: 14 additions & 7 deletions barretenberg/cpp/src/barretenberg/vm/avm_trace/avm_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,22 +471,26 @@ std::vector<Row> Execution::gen_trace(std::vector<Instruction> const& instructio
trace_builder.op_timestamp(std::get<uint8_t>(inst.operands.at(0)), std::get<uint32_t>(inst.operands.at(1)));
break;
case OpCode::NOTEHASHEXISTS:
trace_builder.op_note_hash_exists(std::get<uint32_t>(inst.operands.at(1)),
trace_builder.op_note_hash_exists(std::get<uint8_t>(inst.operands.at(0)),
std::get<uint32_t>(inst.operands.at(1)),
// TODO: leaf offset exists
// std::get<uint32_t>(inst.operands.at(2))
std::get<uint32_t>(inst.operands.at(3)));
break;
case OpCode::EMITNOTEHASH:
trace_builder.op_emit_note_hash(std::get<uint32_t>(inst.operands.at(1)));
trace_builder.op_emit_note_hash(std::get<uint8_t>(inst.operands.at(0)),
std::get<uint32_t>(inst.operands.at(1)));
break;
case OpCode::NULLIFIEREXISTS:
trace_builder.op_nullifier_exists(std::get<uint32_t>(inst.operands.at(1)),
trace_builder.op_nullifier_exists(std::get<uint8_t>(inst.operands.at(0)),
std::get<uint32_t>(inst.operands.at(1)),
// std::get<uint32_t>(inst.operands.at(2))
/**TODO: Address offset for siloing */
std::get<uint32_t>(inst.operands.at(3)));
break;
case OpCode::EMITNULLIFIER:
trace_builder.op_emit_nullifier(std::get<uint32_t>(inst.operands.at(1)));
trace_builder.op_emit_nullifier(std::get<uint8_t>(inst.operands.at(0)),
std::get<uint32_t>(inst.operands.at(1)));
break;
case OpCode::SLOAD:
trace_builder.op_sload(std::get<uint32_t>(inst.operands.at(1)), std::get<uint32_t>(inst.operands.at(2)));
Expand All @@ -495,7 +499,8 @@ std::vector<Row> Execution::gen_trace(std::vector<Instruction> const& instructio
trace_builder.op_sstore(std::get<uint32_t>(inst.operands.at(1)), std::get<uint32_t>(inst.operands.at(2)));
break;
case OpCode::L1TOL2MSGEXISTS:
trace_builder.op_l1_to_l2_msg_exists(std::get<uint32_t>(inst.operands.at(1)),
trace_builder.op_l1_to_l2_msg_exists(std::get<uint8_t>(inst.operands.at(0)),
std::get<uint32_t>(inst.operands.at(1)),
// TODO: leaf offset exists
// std::get<uint32_t>(inst.operands.at(2))
std::get<uint32_t>(inst.operands.at(3)));
Expand All @@ -506,10 +511,12 @@ std::vector<Row> Execution::gen_trace(std::vector<Instruction> const& instructio
std::get<uint32_t>(inst.operands.at(2)));
break;
case OpCode::EMITUNENCRYPTEDLOG:
trace_builder.op_emit_unencrypted_log(std::get<uint32_t>(inst.operands.at(1)));
trace_builder.op_emit_unencrypted_log(std::get<uint8_t>(inst.operands.at(0)),
std::get<uint32_t>(inst.operands.at(1)));
break;
case OpCode::SENDL2TOL1MSG:
trace_builder.op_emit_l2_to_l1_msg(std::get<uint32_t>(inst.operands.at(1)),
trace_builder.op_emit_l2_to_l1_msg(std::get<uint8_t>(inst.operands.at(0)),
std::get<uint32_t>(inst.operands.at(1)),
std::get<uint32_t>(inst.operands.at(2)));
break;
// Machine State - Internal Control Flow
Expand Down
Loading

1 comment on commit f330bff

@AztecBot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: f330bff Previous: 308154b Ratio
Goblin::merge(t) 234278266 ns/iter 198813418 ns/iter 1.18

This comment was automatically generated by workflow using github-action-benchmark.

CC: @ludamad @codygunton

Please sign in to comment.