Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
77c43d1
repr(C) StepRecord
Velaciela Mar 4, 2026
ac2bf54
fix
Velaciela Mar 4, 2026
f550783
witgen: add
Velaciela Mar 3, 2026
5a10916
witgen: lw
Velaciela Mar 3, 2026
07360f8
witgen: integration
Velaciela Mar 3, 2026
9b673ca
minor
Velaciela Mar 3, 2026
35154b1
fmt
Velaciela Mar 3, 2026
2d82306
minor
Velaciela Mar 3, 2026
65985ff
dev-local
Velaciela Mar 3, 2026
0f96033
GPU: AOS StepRecord
Velaciela Mar 4, 2026
4fc7368
SHARD_STEPS_DEVICE
Velaciela Mar 4, 2026
72dd155
batch-1234
Velaciela Mar 5, 2026
273cf7c
batch-5,12
Velaciela Mar 5, 2026
31697bf
batch-6-shift
Velaciela Mar 5, 2026
707ea1d
batch-8,9-slt
Velaciela Mar 5, 2026
3fcc70e
test: orrectness
Velaciela Mar 5, 2026
7191624
batch-10,11-branch
Velaciela Mar 5, 2026
1b6f346
batch-13-JALR
Velaciela Mar 6, 2026
107f72f
batch-14-SW
Velaciela Mar 6, 2026
4ac98ab
batch-15-SH,SB
Velaciela Mar 6, 2026
3b9e4b5
batch-16-LH,LB
Velaciela Mar 6, 2026
32c0acb
batch-17-MUL
Velaciela Mar 6, 2026
cb48e7a
batch-18-DIV
Velaciela Mar 6, 2026
6c43c6a
dev: non-witgen-overlap
Velaciela Mar 6, 2026
4ba08c0
test coverage: compare all column
Velaciela Mar 6, 2026
e943735
test coverage: edge cases
Velaciela Mar 6, 2026
bcdc2a3
gpu witgen: col-major
Velaciela Mar 6, 2026
1e21d37
phase5
Velaciela Mar 8, 2026
8307ba1
shard-1
Velaciela Mar 12, 2026
a24c51c
phase6-2: dispatch all 22 GPU kinds with shard metadata + enable all …
Velaciela Mar 12, 2026
45a359e
fa_sort
Velaciela Mar 12, 2026
e539505
perf-preflight
Velaciela Mar 13, 2026
12cd5ee
shardram: ec
Velaciela Mar 13, 2026
4cd7281
api
Velaciela Mar 13, 2026
2974a8a
debug
Velaciela Mar 13, 2026
018ad73
perf
Velaciela Mar 13, 2026
39078ce
profile
Velaciela Mar 13, 2026
a8cc5a3
batch_continuation_ec
Velaciela Mar 17, 2026
1fe145b
try-perf
Velaciela Mar 17, 2026
2d7f3e9
perf-minor
Velaciela Mar 17, 2026
6a21816
shardram-1
Velaciela Mar 17, 2026
1d27ae1
profile
Velaciela Mar 18, 2026
c4ab9ff
shard-1
Velaciela Mar 18, 2026
be58c5e
shard-2
Velaciela Mar 18, 2026
8fe9d32
minor: LB LH
Velaciela Mar 23, 2026
23f04f0
keccak
Velaciela Mar 23, 2026
5868490
fix-1
Velaciela Mar 23, 2026
1deb849
fix-2
Velaciela Mar 23, 2026
7c8d16a
fix-3
Velaciela Mar 23, 2026
ed9eb6e
minor
Velaciela Mar 23, 2026
cc0d7ee
part-a
Velaciela Mar 23, 2026
aa34af5
part-b
Velaciela Mar 23, 2026
e298511
part-b: fix
Velaciela Mar 23, 2026
033d729
part-c
Velaciela Mar 23, 2026
b54af50
part-c: fix
Velaciela Mar 23, 2026
7ee32ed
simplify: macro-1,2
Velaciela Mar 23, 2026
6daebf4
simplify: macro-3
Velaciela Mar 23, 2026
78a51d2
simplify: naming
Velaciela Mar 23, 2026
b690229
gpu: hal.witgen
Velaciela Mar 24, 2026
130cc4a
path: ceno_zkvm/src/instructions/gpu
Velaciela Mar 24, 2026
211c875
naming: side_effects to lk_shardram
Velaciela Mar 24, 2026
6595860
path: gpu/host_ops to gpu/utils
Velaciela Mar 24, 2026
bcf8e0c
naming: ceno_zkvm/src/instructions/gpu
Velaciela Mar 24, 2026
bc6f3eb
lints, fmt
Velaciela Mar 24, 2026
f7dc9b4
macro: test
Velaciela Mar 24, 2026
6ca050b
config, dispatch
Velaciela Mar 24, 2026
aadf86b
fmt, lints
Velaciela Mar 24, 2026
3c719dc
shard_ram: funcs
Velaciela Mar 25, 2026
bd18f1d
default: disable gpu witgen
Velaciela Mar 25, 2026
4ac6a6f
e2e: pipeline
Velaciela Mar 25, 2026
4dba098
README.md
Velaciela Mar 25, 2026
e7bb55b
invasive_changes.md
Velaciela Mar 25, 2026
e2b8ae7
revert: local path
Velaciela Mar 25, 2026
02950b8
minor
Velaciela Mar 25, 2026
1fe56b8
remove: next_accesses_vec
Velaciela Mar 27, 2026
411a62b
remove: sorted_next_accesses from ShardContextBuilder and ShardContext
Velaciela Mar 27, 2026
2513a2f
move: PackedNextAccessEntry to GPU codebase
Velaciela Mar 27, 2026
204e290
remove: gpu_ec_records from ShardContext
Velaciela Mar 27, 2026
f963620
minor
Velaciela Mar 27, 2026
a14c909
remove: bench
Velaciela Mar 27, 2026
327b0ed
remove: gpu_ec_records_to_shard_ram_inputs from structs.rs
Velaciela Mar 27, 2026
50b4411
refactor: move GPU shard_ram impl to gpu/chips/shard_ram.rs
Velaciela Mar 27, 2026
4f4d4f4
move: debug funcs
Velaciela Mar 27, 2026
c3ed4db
cleanup: build_shard_ram_inputs
Velaciela Mar 27, 2026
1cb5504
gpu_batch_continuation_ec
Velaciela Mar 27, 2026
f176997
minimize diff
Velaciela Mar 27, 2026
f271c93
debug compare: shard_ram
Velaciela Mar 27, 2026
b15f4c2
DebugCompareReport
Velaciela Mar 27, 2026
e536c5c
minor: func path
Velaciela Mar 27, 2026
1a991ec
[follow up on #1259] resolve conflict with master branch (#1286)
hero78119 Apr 1, 2026
6849838
Merge branch 'master' into feat/gpu-witnessgen
Velaciela Apr 1, 2026
9ff421d
avoid to_vec()
Velaciela Mar 25, 2026
56af0d7
[follow up #1259] misc: build error (#1297)
hero78119 Apr 7, 2026
48a3541
minor: chip scheduler
Velaciela Apr 8, 2026
7090881
refactor: drop witgen GPU caches between shards and assert zero residue
Velaciela Apr 8, 2026
beb98a2
fixed_mles: as view
Velaciela Apr 8, 2026
dabed5a
env variable: default 0
Velaciela Apr 9, 2026
c8a5a69
zkvm gpu: keep witness device-resident and enforce col-major commit i…
hero78119 Apr 13, 2026
e1c1082
update gkr-backend
hero78119 Apr 13, 2026
f026b64
align structural witness with normal witness
hero78119 Apr 13, 2026
c46a574
fix build error
hero78119 Apr 13, 2026
aebf3b2
assert gpu vram release at the end of create_proof
hero78119 Apr 13, 2026
9c98a33
set gpu device_backing even rmm generate in cpu
hero78119 Apr 13, 2026
8ae8010
transient gpu polygroup when cache level is none
hero78119 Apr 14, 2026
490993a
truncate to make rmm size match
hero78119 Apr 14, 2026
e9a98c9
update comment
hero78119 Apr 15, 2026
0db05c3
Refactor GPU witness replay and cache-none proving flow
hero78119 Apr 16, 2026
33006fd
Defer cache-none GPU witness materialization
hero78119 Apr 16, 2026
e166b25
gpu skip assign shard meta info on non initial pass
hero78119 Apr 16, 2026
854027d
update estimated memory formula
hero78119 Apr 16, 2026
890500d
WIP fix estimate memory and cuda slice blowup problem
hero78119 Apr 16, 2026
3693654
e2e pass local without OOM
hero78119 Apr 16, 2026
fdb277e
more debug log
hero78119 Apr 17, 2026
fcd98f2
wip: replayable shard_ram chip
hero78119 Apr 17, 2026
2cbc477
log pcs data
hero78119 Apr 17, 2026
bcf9d26
fix cuda slice clone
hero78119 Apr 17, 2026
b18c781
keccak chip proof twice materilized and reduce peak memory
hero78119 Apr 17, 2026
b33c4ac
log in sequential mode
hero78119 Apr 17, 2026
b41baea
log to target shard stale object issue
hero78119 Apr 17, 2026
1bf0485
trim memory pool
hero78119 Apr 17, 2026
3842098
log cuda memory and task id
hero78119 Apr 17, 2026
68aef1d
shard ram circuit optimisation
hero78119 Apr 17, 2026
993566f
add missing reset booking
hero78119 Apr 17, 2026
a056638
increase over-estimated headroom to 10MB
hero78119 Apr 18, 2026
24357d9
relax mem estimation headroom
hero78119 Apr 18, 2026
5c02072
include ec temp in shard ram circuit vram estimation
hero78119 Apr 18, 2026
4e3c9c8
reserve extra booking room for keccak
hero78119 Apr 18, 2026
6e7f31a
better documentation
hero78119 Apr 18, 2026
ae3ba76
explicit drop and sync
hero78119 Apr 18, 2026
0bfd617
update and reflect right peak memory computation
hero78119 Apr 18, 2026
e7b6e5e
fix memory estimation
hero78119 Apr 18, 2026
5bfe1fa
more log to trace memory problem
hero78119 Apr 18, 2026
29057ae
optimize structural witness and avoid in reply then drop
hero78119 Apr 19, 2026
dc6f7e9
cache step indices in gpu
hero78119 Apr 19, 2026
319f7f4
seq mode OOM
hero78119 Apr 20, 2026
95589d2
logging more vram data
hero78119 Apr 20, 2026
a1b7199
wip reserve more mem before pcs
hero78119 Apr 20, 2026
3f64eaa
new way of memory pool reserve
hero78119 Apr 20, 2026
282cbc2
sequential mode in single worker
hero78119 Apr 20, 2026
2db2e3c
shard ram circuit fix implementation to skip structural witness
hero78119 Apr 20, 2026
25f8969
adjust default CENO_GPU_LARGE_TASK_BOOKING_MARGIN_MB to 3072
hero78119 Apr 20, 2026
256c96d
merge with master
hero78119 Apr 20, 2026
ee7997c
update memory estimation after new rotation/ecc wiring
hero78119 Apr 20, 2026
cfdab05
follow up 1299: fix gpu build
hero78119 Apr 20, 2026
a72e4ac
add gkr output class
hero78119 Apr 20, 2026
2390d58
merge bug fix
hero78119 Apr 20, 2026
280f9b9
align with master branch for non-gpu witgen path
hero78119 Apr 21, 2026
326e517
fix non-witgen tower record life cycle issue
hero78119 Apr 21, 2026
bfa0f41
Merge branch 'master' into feat/gpu-witnessgen
hero78119 Apr 21, 2026
0fca79f
Fix clippy and GPU e2e regressions
hero78119 Apr 21, 2026
87ef07f
rollback patch in Cargo.toml
hero78119 Apr 21, 2026
e1152be
update cargo lock
hero78119 Apr 21, 2026
0ca12b7
taplo fmt
hero78119 Apr 21, 2026
23dc474
update gkr dependency
hero78119 Apr 21, 2026
2cc59b4
misc: fix function signature
hero78119 Apr 21, 2026
ee985f5
misc: do not mutable rmm after set device backing
hero78119 Apr 21, 2026
932ceb8
Refine GPU replay docs and estimates
hero78119 Apr 21, 2026
90f54dc
Hoist GPU instruction module gating
hero78119 Apr 21, 2026
1c24d97
Clean clone usage and document review guidance
hero78119 Apr 21, 2026
34f2256
Merge branch 'master' into feat/gpu-witnessgen
hero78119 Apr 22, 2026
f3949b5
simplify proving flow and remove unnessesary sync barrier
hero78119 Apr 22, 2026
8b269a5
Merge branch 'master' into feat/gpu-witnessgen
hero78119 Apr 22, 2026
aa4c087
merge with master
hero78119 Apr 22, 2026
18984df
Merge branch 'feat/gpu-witnessgen' of github.com:scroll-tech/ceno int…
hero78119 Apr 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ If there are no findings, state that explicitly and mention residual risks or te
- Panic and invariant handling on potentially untrusted proof/input data (`unwrap`, `expect`, indexing, assertions) — treat panics on proof-derived data in verifier code paths as liveness / DoS findings, not style.
- Determinism and concurrency risks (parallel iteration order assumptions, shared mutable state).

## Clone review heuristic

- Treat `.clone()` as suspicious in hot paths or large data flows, but distinguish cheap handle clones from deep data copies.
- Call out clones that are immediately dereferenced or destructured when a borrow would do instead, for example `option.clone().unwrap()` or `vec.clone().try_into()`.
- Do not flag `Arc`/`Rc` clones by default when they are used to shorten a borrow and unblock later mutable access; these are often intentional and semantically cheap.
- If a clone exists to avoid borrow-checker conflicts, mention that explicitly in the review rather than treating it as an obvious inefficiency.

## Review checklist

Work through `./.github/pr-review-checklist.md` for any PR touching prover/verifier or proof-system code. That file is the canonical, category-by-category checklist (transcript / Fiat–Shamir, sumcheck layer plumbing, PCS openings, determinism, verifier robustness, feature-gate parity, scope) and is shared with `CLAUDE.md` and human reviewers.
Expand All @@ -79,4 +86,3 @@ When proposing or reviewing behavior changes, prefer targeted tests near the aff
- Concise, direct, and technical.
- Use actionable bullet points.
- Keep summaries brief and focus on concrete findings.

23 changes: 12 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ version = "0.1.0"
ceno_crypto_primitives = { git = "https://github.com/scroll-tech/ceno-patch.git", package = "ceno_crypto_primitives", branch = "main" }
ceno_syscall = { git = "https://github.com/scroll-tech/ceno-patch.git", package = "ceno_syscall", branch = "main" }

ff_ext = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "ff_ext", tag = "v1.0.0-alpha.22" }
mpcs = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "mpcs", tag = "v1.0.0-alpha.22" }
multilinear_extensions = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "multilinear_extensions", tag = "v1.0.0-alpha.22" }
p3 = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "p3", tag = "v1.0.0-alpha.22" }
poseidon = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "poseidon", tag = "v1.0.0-alpha.22" }
sp1-curves = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "sp1-curves", tag = "v1.0.0-alpha.22" }
sumcheck = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "sumcheck", tag = "v1.0.0-alpha.22" }
transcript = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "transcript", tag = "v1.0.0-alpha.22" }
whir = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "whir", tag = "v1.0.0-alpha.22" }
witness = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "witness", tag = "v1.0.0-alpha.22" }
ff_ext = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "ff_ext", tag = "v1.0.0-alpha.24" }
mpcs = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "mpcs", tag = "v1.0.0-alpha.24" }
multilinear_extensions = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "multilinear_extensions", tag = "v1.0.0-alpha.24" }
p3 = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "p3", tag = "v1.0.0-alpha.24" }
poseidon = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "poseidon", tag = "v1.0.0-alpha.24" }
sp1-curves = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "sp1-curves", tag = "v1.0.0-alpha.24" }
sumcheck = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "sumcheck", tag = "v1.0.0-alpha.24" }
transcript = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "transcript", tag = "v1.0.0-alpha.24" }
whir = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "whir", tag = "v1.0.0-alpha.24" }
witness = { git = "https://github.com/scroll-tech/gkr-backend.git", package = "witness", tag = "v1.0.0-alpha.24" }

anyhow = { version = "1.0", default-features = false }
bincode = "1"
Expand Down
2 changes: 1 addition & 1 deletion ceno_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ openvm-stark-sdk.workspace = true

ff_ext.workspace = true
gkr_iop = { path = "../gkr_iop" }
mpcs.workspace = true
mpcs = { workspace = true, features = ["whir"] }

[build-dependencies]
vergen-git2 = { version = "9.1.0", features = ["build", "cargo", "rustc", "emit_and_set"] }
Expand Down
4 changes: 3 additions & 1 deletion ceno_emul/src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ pub type Word = u32;
pub type SWord = i32;
pub type Addr = u32;
pub type Cycle = u64;
pub type RegIdx = usize;
pub type RegIdx = u8;

#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct ByteAddr(pub u32);

#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(C)]
pub struct WordAddr(pub u32);

impl From<ByteAddr> for WordAddr {
Expand Down
41 changes: 22 additions & 19 deletions ceno_emul/src/disassemble/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::rv32im::{InsnKind, Instruction};
use crate::{
addr::RegIdx,
rv32im::{InsnKind, Instruction},
};
use itertools::izip;
use rrs_lib::{
InstructionProcessor,
Expand All @@ -19,9 +22,9 @@ impl Instruction {
pub const fn from_r_type(kind: InsnKind, dec_insn: &RType, raw: u32) -> Self {
Self {
kind,
rd: dec_insn.rd,
rs1: dec_insn.rs1,
rs2: dec_insn.rs2,
rd: dec_insn.rd as RegIdx,
rs1: dec_insn.rs1 as RegIdx,
rs2: dec_insn.rs2 as RegIdx,
imm: 0,
raw,
}
Expand All @@ -32,8 +35,8 @@ impl Instruction {
pub const fn from_i_type(kind: InsnKind, dec_insn: &IType, raw: u32) -> Self {
Self {
kind,
rd: dec_insn.rd,
rs1: dec_insn.rs1,
rd: dec_insn.rd as RegIdx,
rs1: dec_insn.rs1 as RegIdx,
imm: dec_insn.imm,
rs2: 0,
raw,
Expand All @@ -45,8 +48,8 @@ impl Instruction {
pub const fn from_i_type_shamt(kind: InsnKind, dec_insn: &ITypeShamt, raw: u32) -> Self {
Self {
kind,
rd: dec_insn.rd,
rs1: dec_insn.rs1,
rd: dec_insn.rd as RegIdx,
rs1: dec_insn.rs1 as RegIdx,
imm: dec_insn.shamt as i32,
rs2: 0,
raw,
Expand All @@ -59,8 +62,8 @@ impl Instruction {
Self {
kind,
rd: 0,
rs1: dec_insn.rs1,
rs2: dec_insn.rs2,
rs1: dec_insn.rs1 as RegIdx,
rs2: dec_insn.rs2 as RegIdx,
imm: dec_insn.imm,
raw,
}
Expand All @@ -72,8 +75,8 @@ impl Instruction {
Self {
kind,
rd: 0,
rs1: dec_insn.rs1,
rs2: dec_insn.rs2,
rs1: dec_insn.rs1 as RegIdx,
rs2: dec_insn.rs2 as RegIdx,
imm: dec_insn.imm,
raw,
}
Expand Down Expand Up @@ -231,7 +234,7 @@ impl InstructionProcessor for InstructionTranspiler {
fn process_jal(&mut self, dec_insn: JType) -> Self::InstructionResult {
Instruction {
kind: InsnKind::JAL,
rd: dec_insn.rd,
rd: dec_insn.rd as RegIdx,
rs1: 0,
rs2: 0,
imm: dec_insn.imm,
Expand All @@ -242,8 +245,8 @@ impl InstructionProcessor for InstructionTranspiler {
fn process_jalr(&mut self, dec_insn: IType) -> Self::InstructionResult {
Instruction {
kind: InsnKind::JALR,
rd: dec_insn.rd,
rs1: dec_insn.rs1,
rd: dec_insn.rd as RegIdx,
rs1: dec_insn.rs1 as RegIdx,
rs2: 0,
imm: dec_insn.imm,
raw: self.word,
Expand All @@ -265,7 +268,7 @@ impl InstructionProcessor for InstructionTranspiler {
// See [`InstructionTranspiler::process_auipc`] for more background on the conversion.
Instruction {
kind: InsnKind::ADDI,
rd: dec_insn.rd,
rd: dec_insn.rd as RegIdx,
rs1: 0,
rs2: 0,
imm: dec_insn.imm,
Expand All @@ -276,7 +279,7 @@ impl InstructionProcessor for InstructionTranspiler {
{
Instruction {
kind: InsnKind::LUI,
rd: dec_insn.rd,
rd: dec_insn.rd as RegIdx,
rs1: 0,
rs2: 0,
imm: dec_insn.imm,
Expand Down Expand Up @@ -311,7 +314,7 @@ impl InstructionProcessor for InstructionTranspiler {
// real world scenarios like a `reth` run.
Instruction {
kind: InsnKind::ADDI,
rd: dec_insn.rd,
rd: dec_insn.rd as RegIdx,
rs1: 0,
rs2: 0,
imm: dec_insn.imm.wrapping_add(pc as i32),
Expand All @@ -322,7 +325,7 @@ impl InstructionProcessor for InstructionTranspiler {
{
Instruction {
kind: InsnKind::AUIPC,
rd: dec_insn.rd,
rd: dec_insn.rd as RegIdx,
rs1: 0,
rs2: 0,
imm: dec_insn.imm,
Expand Down
2 changes: 1 addition & 1 deletion ceno_emul/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub use syscalls::{
BN254_FP_MUL, BN254_FP2_ADD, BN254_FP2_MUL, KECCAK_PERMUTE, PubIoCommitSpec, SECP256K1_ADD,
SECP256K1_DECOMPRESS, SECP256K1_DOUBLE, SECP256K1_SCALAR_INVERT, SECP256R1_ADD,
SECP256R1_DECOMPRESS, SECP256R1_DOUBLE, SECP256R1_SCALAR_INVERT, SHA_EXTEND,
STATE_CONTINUATION, SyscallSpec, UINT256_MUL,
STATE_CONTINUATION, SyscallSpec, SyscallWitness, UINT256_MUL,
bn254::{
BN254_FP_WORDS, BN254_FP2_WORDS, BN254_POINT_WORDS, Bn254AddSpec, Bn254DoubleSpec,
Bn254Fp2AddSpec, Bn254Fp2MulSpec, Bn254FpAddSpec, Bn254FpMulSpec,
Expand Down
4 changes: 2 additions & 2 deletions ceno_emul/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl Platform {
/// Virtual address of a register.
pub const fn register_vma(index: RegIdx) -> Addr {
// Register VMAs are aligned, cannot be confused with indices, and readable in hex.
(index << 8) as Addr
(index as Addr) << 8
}

/// Register index from a virtual address (unchecked).
Expand Down Expand Up @@ -199,7 +199,7 @@ mod tests {
// Registers do not overlap with ROM or RAM.
for reg in [
Platform::register_vma(0),
Platform::register_vma(VMState::<PreflightTracer>::REG_COUNT - 1),
Platform::register_vma((VMState::<PreflightTracer>::REG_COUNT - 1) as RegIdx),
] {
assert!(!p.is_rom(reg));
assert!(!p.is_ram(reg));
Expand Down
18 changes: 10 additions & 8 deletions ceno_emul/src/rv32im.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ use super::addr::{ByteAddr, RegIdx, WORD_SIZE, Word, WordAddr};
pub const fn encode_rv32(kind: InsnKind, rs1: u32, rs2: u32, rd: u32, imm: i32) -> Instruction {
Instruction {
kind,
rs1: rs1 as usize,
rs2: rs2 as usize,
rd: rd as usize,
rs1: rs1 as RegIdx,
rs2: rs2 as RegIdx,
rd: rd as RegIdx,
imm,
raw: 0,
}
Expand All @@ -43,9 +43,9 @@ pub const fn encode_rv32(kind: InsnKind, rs1: u32, rs2: u32, rd: u32, imm: i32)
pub const fn encode_rv32u(kind: InsnKind, rs1: u32, rs2: u32, rd: u32, imm: u32) -> Instruction {
Instruction {
kind,
rs1: rs1 as usize,
rs2: rs2 as usize,
rd: rd as usize,
rs1: rs1 as RegIdx,
rs2: rs2 as RegIdx,
rd: rd as RegIdx,
imm: imm as i32,
raw: 0,
}
Expand Down Expand Up @@ -113,6 +113,7 @@ pub enum TrapCause {
}

#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
#[repr(C)]
pub struct Instruction {
pub kind: InsnKind,
pub rs1: RegIdx,
Expand Down Expand Up @@ -162,6 +163,7 @@ use InsnFormat::*;
ToPrimitive,
Default,
)]
#[repr(u8)]
#[allow(clippy::upper_case_acronyms)]
pub enum InsnKind {
#[default]
Expand Down Expand Up @@ -425,7 +427,7 @@ fn step_compute<M: EmuContext>(ctx: &mut M, kind: InsnKind, insn: &Instruction)
if !new_pc.is_aligned() {
return ctx.trap(TrapCause::InstructionAddressMisaligned);
}
ctx.store_register(insn.rd_internal() as usize, out)?;
ctx.store_register(insn.rd_internal() as RegIdx, out)?;
ctx.set_pc(new_pc);
Ok(true)
}
Expand Down Expand Up @@ -502,7 +504,7 @@ fn step_load<M: EmuContext>(ctx: &mut M, kind: InsnKind, decoded: &Instruction)
}
_ => unreachable!(),
};
ctx.store_register(decoded.rd_internal() as usize, out)?;
ctx.store_register(decoded.rd_internal() as RegIdx, out)?;
ctx.set_pc(ctx.get_pc() + WORD_SIZE);
Ok(true)
}
Expand Down
Loading
Loading