Skip to content

Conversation

@hero78119
Copy link
Collaborator

@hero78119 hero78119 commented Jan 8, 2026

This is preparation of #1220 to support single circuit subscribe to multi riscv opcodes

Change summary

  • Reworked opcode dispatch to use reusable record buffers instead of empty vector per shard. Introduce new dispatcher with circuit registration and error check.
  • simplify emulator emit steps -> single vector -> then dispatcher multi vector to new flow emulator emit steps -> multi vector, save one redundant allocation
  • simplify rv32im assign_opcode logic. e.g. assign_opcode!(ADD, AddInstruction<E>, add_config); -> assign_opcode!(AddInstruction<E>, add_config); and dispatch deal with routing for us
  • Updated every instruction implementation.
  • Removed the obsolete DummyInstruction scaffolding and trimmed tests/module exports to the ECALL-specific LargeEcallDummy, keeping DummyConfig only where it feeds those circuits.

Benchmark

test with 23817600 block, e2e remain no change

Component / Stage Before (Time / %) After (Time / %) Δ Change
Total block 140s · 0.12% / 100% 140s · 0.15% / 100% ~ same
app.prove (total) 137s · 0.15% / 97.68% 137s · 0.15% / 97.65% ~ same

remain no change which is expected. Because 1st shard we still need to allocated vector, while shard > 0 pipeline gpu proving time is dominated

For detail breakdown assign_opcode_circuit

Shard Id Before (s) After (s) Δ (s)
0 2.0319 1.8792 -0.1527
1 1.7117 1.5331 -0.1786
2 1.6976 1.5342 -0.1634
3 1.7091 1.5433 -0.1658
4 1.4510 1.3409 -0.1101
Avg 1.7203 1.5661 -0.1542 (~9.0%)

around 10% improvement

@hero78119 hero78119 marked this pull request as draft January 8, 2026 00:54
@hero78119 hero78119 force-pushed the feat/dispatch_and_alloc branch 2 times, most recently from 85c935c to 0d0c837 Compare January 8, 2026 03:04
@hero78119 hero78119 marked this pull request as ready for review January 8, 2026 03:09
@hero78119 hero78119 changed the title WIP refactor opcode circuit dispatching and vector allocation refactor opcode circuit dispatching and vector allocation Jan 8, 2026
@hero78119 hero78119 force-pushed the feat/dispatch_and_alloc branch from 2ed8baf to 71fa8bc Compare January 8, 2026 07:01
better empty handling

remove DispatchBucket and replace by vector

refactor on insn usage in instruction

fmt

remove ecall dummy

refactor indent

misc: naming cosmetics

step streaming to dispatcher directly

fmt & cleanup

minimize code change line

inline streaming injection
@hero78119 hero78119 force-pushed the feat/dispatch_and_alloc branch from 9ffbfc8 to 0fc3f75 Compare January 8, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants