test(DON'T MERGE): develop-v2.1.0-rv64#2719
Conversation
resolves int-6773
fix described in anthropics/claude-code-action#944 (comment) also switch to OAuth
I hope this works, but the idea is that stuff merged to develop-v2.0.0-beta will then rebase develop-v2.0.0-rc.1 On main, we do not include develop-v2.0.0-rc.1, so merge to main should set a chain of rebases main -> develop-v2.0.0-beta -> develop-v2.0.0-rc.1
Resolves INT-6673. When any dimension has size of 1, the T6 odometer carry constraint degenerates because "wrap" and "stay" produce the same diff (0), breaking the completeness guarantee of lexicographic enumeration. Add an assert in the Chip constructor to reject this configuration, and a test to verify it panics. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This resolves INT-6777
## Summary - Removed `openvm/` prefix from source paths across 8 documentation files (21 occurrences) - Updated stale `v2-proof-system` repository reference in `docs/crates/recursion/README.md` to reflect the current openvm repo - Updated `stark-backend` path in `docs/crates/recursion/verifier-mapping.md` to link to the [stark-backend GitHub repo](https://github.com/openvm-org/stark-backend) Fixes issues identified in #2553 (comment) ## Test plan - [x] Verified no remaining `openvm/crates/recursion/src/` prefixes exist - [x] Verified no remaining `v2-proof-system` references exist - [x] Verified no remaining `stark-backend/crates/` local path references exist 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Jonathan Wang <jonathanpwang@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This resolves INT-6814
This resolves INT-6828. Now `Eq3bAir` propagates the `row_idx` by the correct amount for each AIR. Note that there is no need for this air to know `air_idx` or anything other than the number of interactions and the `n_lift` for this air, so no new columns are added (but we now do the interaction with proof shape air on the last row of the air instead of the first one).
…2563) ## Summary - Add a `changes` detection job using `dorny/paths-filter@v3` to skip the `lint-cuda` job when no CUDA-related files (`*.cu`, `*.cuh`, `**/cuda/**`, `**/cuda*.rs`, etc.) are modified - Request at least 8 CPUs on the GPU runner (`/cpu=8`) for faster builds - The workflow file and CUDA cache action are also included as triggers so changes to CI itself still run the CUDA lint ## Test plan - [ ] Open a PR that doesn't touch any CUDA files and verify `lint-cuda` is skipped - [ ] Open a PR that touches a `.cu` or `.cuh` file and verify `lint-cuda` runs --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Resolves INT-7566. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves INT-7563.
…, mulh, divrem, jal_lui, jalr, auipc (#2741) Resolves INT-7550. --------- Co-authored-by: Tuanlinh12312 <136139181+Tuanlinh12312@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves INT-7551.
Resolves INT-7553. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves INT-7552. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves INT-7564, INT-7528.
Resolves INT-7554. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Resolves INT-7530.
# fix(v2.1-rv64): convert more rv32 references to rv64
Follow-up cleanup that gets the lint job and the `sha2_bench`
bench-prove run green on the rv64 branch, plus a few non-AOT polish
items called out in review.
## Lint fixes
- `extensions/riscv/circuit/src/auipc/tests.rs` — gate
`RV64_REGISTER_NUM_LIMBS` behind `#[cfg(feature = "cuda")]`; it's only
used inside the CUDA test, so the CPU lint job hit `unused_imports`.
- `crates/continuations/src/tests/e2e.rs` — rename stale
`Rv32DeferralBuilder` / `Rv32DeferralConfig` → `Rv64DeferralBuilder` /
`Rv64DeferralConfig` (3 sites). Fixes the CUDA lint job's `E0432`.
- `crates/sdk/src/tests.rs` — `SdkVmConfig::riscv32()` → `::riscv64()`
plus doc-comment.
- `benchmarks/prove/src/lib.rs` — drop unused `clap::command` import.
- `extensions/riscv/circuit/src/{mul,mul_w,jalr,mulh}/tests.rs` — error
string `"failed to create Rv32IM executor"` → `"Rv64IM executor"`.
## Rename
- `Rv32ModularArithmeticOpcode` → `Rv64ModularArithmeticOpcode` (81
references across `extensions/algebra/{transpiler,circuit}`). Pure
rename, no semantic change.
## Cleanup
- Remove `tmp_convert_to_u8s` and its `// TEMP[jpw]` marker from
`extensions/riscv/circuit/src/adapters/mod.rs` — `pub fn` with zero
in-tree callers.
- `crates/toolchain/openvm/src/io/mod.rs` — replace hardcoded `8` in
`read_vec_by_len` with `openvm_platform::WORD_SIZE`.
## Bug fix
- `crates/toolchain/openvm/src/serde/serializer.rs` — `to_vec` was
calling `Vec::<u64>::with_capacity(size_of_val(value))`, conflating
bytes with u64 elements and over-allocating 8×. Switched to
`size_of_val(value).div_ceil(size_of::<u64>())`. Heap waste only, no
correctness impact.
## Benchmark ELF rebuilds
Rebuilt 16 benchmark guest ELFs as 64-bit RISC-V (the committed binaries
were still 32-bit, which made `sha2_bench` fail with `Error: Not a
64-bit ELF` after the transpiler tightened its check): base64_json,
bincode, bubblesort, ecrecover, fibonacci, fibonacci_iterative,
fibonacci_recursive, keccak256, keccak256_iter, kitchen-sink, pairing,
quicksort, rkyv, sha2_bench, sha256, sha256_iter.
Not rebuilt — `regex`, `revm_transfer`, `revm_snailtracer` — their
dependency closures (`regex-automata`, `tracing-core 0.1.x`) use atomic
CAS methods that the `riscv64im-unknown-none-elf` target doesn't expose.
The existing `portable-atomic` polyfill in `openvm-platform` works for
crates that opt in via a feature flag (`bytes`, `spin`), but neither
failing crate exposes one. Tracking as a separate item.
## Verification
- `cargo +nightly fmt --all -- --check` clean.
- `cargo clippy --workspace --all-targets --tests --features "<CI
feature set>" -- -D warnings` clean.
- `cargo check --workspace --all-targets --tests` clean.
Resolves INT-6048. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Towards INT-6339. AUIPC was zero-extending `pc + (imm << 12)` into the upper 32 bits of rd, but the RV64 spec requires sign extension, causing riscv test `rv64ui-p-auipc` to fail. Add `is_sign_extend` column to constrain the MSB of the 32-bit result and fill the upper 4 bytes accordingly. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Ayush Shukla <ayush@axiom.xyz>
Resolves INT-7594. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves INT-7610. ## Summary - **Consolidate constants**: Replace bigint's local `CONST_BLOCK_SIZE` with `program::DEFAULT_BLOCK_SIZE`. Remove 59 unused/stale constants from `constants.h` (RV32 legacy, dead sha256/mod_builder/keccak256 entries). - **Remove trace height asserts**: Remove redundant `assert((height & (height - 1)) == 0)` and `assert(height >= d_records.len())` from all 24 CUDA kernel entry points — these invariants are guaranteed by the Rust caller. - **Remove compile-time constants from kernel arguments**: Remove `bitwise_num_bits` parameter from 51 files (CUDA kernels + Rust FFI), hardcoding `RV64_CELL_BITS` into `BitwiseOperationLookup`. Remove `pc_step` from program tracegen, using `DEFAULT_PC_STEP` directly. - **Extract divrem helpers**: Add `limbs_to_u64`/`u64_to_limbs` helpers in `divrem.cuh` to replace inline limb conversion loops. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…named files Upstream #2771 (e11f786) introduced the ColumnsAir trait as required for all AIRs and added StructReflection to corresponding Cols structs. During the rebase, the -X theirs strategy dropped these additions for files our rv64 branch had renamed (Rv32* -> Rv64*) or otherwise modified. Re-applies the derive macros and #[columns_via(...)] attributes so the workspace builds against develop-v2.0.0-rc.1.
…tor script (#2780) ## Summary - Replaces the glibc-derived `memcpy.s` / `memset.s` in `crates/toolchain/openvm/src/` with musl-libc equivalents (MIT-licensed; matches the v2.0.0 lineage). - Adds `scripts/generate_libc_intrinsics.sh` to regenerate both files deterministically from upstream sources. - Fixes an LLVM jump-table label collision that prevented guest binaries with dense user code from linking under fat LTO. ## Why Two problems with the current state: 1. **Licensing**: the existing files were compiled from glibc (LGPL-2.1+) but checked in without a license header or attribution. musl-libc (MIT) is permissive and was the original source used in the v2.0.x branch (`develop-v2.0.0-rc.1`), so switching back is both more permissive and continuity-preserving. 2. **Symbol collision under fat LTO**: the glibc-derived `memcpy.s` defined an orphan jump table `.LJTI0_0` (without a function prefix). LLVM emits the same name for the first jump table of "function 0" in any translation unit, so user code that happens to lower a `match` into a jump table — combined with `lto = "fat"` merging crates into a single LLVM module — causes: ``` error: symbol '.LJTI0_0' is already defined ``` The musl-derived equivalents have no jump table (at `-O3 -funroll-loops`, musl's memcpy unrolls fully), and the generator script prefixes every per-TU local label (`.LBB0_*`, `.LJTI0_*`, `.Lfunc_end0`) with the function name to make any future drift impossible. ## What's in the PR | File | Purpose | |---|---| | `scripts/generate_libc_intrinsics.sh` | Fetches musl sources at a pinned ref, strips `#include` lines, compiles with the recipe `clang -target riscv64 -march=rv64im -O3 -funroll-loops`, applies local-label prefixing, strips `.ident`, normalizes `.file`, and embeds musl `COPYRIGHT` in the file header. Accepts `--musl-ref <tag\|branch\|sha>` and `--clang <path>` with sensible defaults. Idempotent. | | `crates/toolchain/openvm/src/memcpy.s` | Regenerated from musl v1.2.6 (`9fa28ece75d8a2191de7c5bb53bed224c5947417`). | | `crates/toolchain/openvm/src/memset.s` | Regenerated from musl v1.2.6 (`9fa28ece75d8a2191de7c5bb53bed224c5947417`). | | `crates/toolchain/openvm/README.md` | Pointer to the generator. | ## Reproduce ```bash scripts/generate_libc_intrinsics.sh git diff --exit-code crates/toolchain/openvm/src/memcpy.s crates/toolchain/openvm/src/memset.s ``` Should produce no diff on a fresh checkout. The `.ident` directive is stripped during generation, so output bytes are independent of the clang distribution (Homebrew vs Debian vs Apple Clang); the only per-clang-version variation that remains is the `.attribute 5` ISA string (e.g. `"rv64im"` on clang ≤14 vs the canonical `"rv64i2p1_m2p0_zmmul1p0"` on clang ≥16) — same ISA, different recording. ## Test plan - [x] `scripts/generate_libc_intrinsics.sh` reruns produce byte-identical output (idempotent). - [x] Both regenerated files contain no orphan `.LJTI0_*` / `.LBB0_*` / `.Lfunc_end0` labels — every local label is function-prefixed. - [ ] CI on this PR (build, lint, riscv-test-vector, extension-tests). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
723e24c to
16f0404
Compare
|
Claude finished @shuklaayush's task in 5m 42s —— View job Review #19 — RV32→RV64 Migration AuditHEAD: Checklist
SummaryNo new commits since Review #18. HEAD remains at Non-AOT Code: CLEAN ✅All 20+ bugs discovered and fixed across Reviews #1–#18 remain resolved. Verified across:
|
Note: cells_used metrics omitted because CUDA tracegen does not expose unpadded trace heights. Commit: 16f0404 |
93afded to
307dc7e
Compare
f08f0fe to
0110850
Compare
… build system (#2765) ## Summary Integrate the built-in Rust target `riscv64im-unknown-openvm-elf` (`target_os = "openvm"`) into the OpenVM build system and guest crates, enabling `std` support for guest programs. The target itself was added to the OpenVM Rust fork in [openvm-org/rust#3](openvm-org/rust#3). Prebuilt toolchain tarballs are published on the fork's [Releases](https://github.com/openvm-org/rust/releases) page — install via `cargo openvm toolchain install` (this PR) or the CI helper script. ### Changes - **Build system** (`crates/toolchain/build/src/lib.rs`): - Set `DEFAULT_RUSTC_TARGET = "riscv64im-unknown-openvm-elf"` (overridable via `OPENVM_TARGET`). - Set `DEFAULT_RUSTUP_TOOLCHAIN_NAME = "openvm-nightly-2026-01-18"` (overridable via `OPENVM_RUST_TOOLCHAIN`); guest builds invoke `cargo +<toolchain> build --target <target>` directly, using the prebuilt `std`/`core`/`alloc`/`panic_abort` rlibs that ship in the toolchain. - Add `ensure_openvm_toolchain_linked()` — verifies the linked toolchain has the guest target's prebuilt rlibs in its sysroot before invoking cargo. - **Guest runtime** (`crates/toolchain/openvm/`): - New `pal_abi.rs`: provides `sys_write`, `sys_panic`, `sys_rand`, `sys_halt`, `sys_argc`/`sys_argv`, `sys_getenv`, `sys_read`, and `sys_alloc_aligned` symbols that the upstream `std` PAL declares. Bridges to OpenVM's custom RISC-V instructions via `openvm_riscv_guest`. `sys_rand` uses a byte-level ABI (`*mut u8, nbytes: usize`) with a `hint_buffer_bytes` helper that handles non-dword-aligned tails via a stack scratch buffer; `sys_getenv` returns `usize::MAX` per the upstream "unset" contract. - Simplify the `entry!` macro: a single `cfg(openvm_intrinsics)` branch emits `#[no_mangle] fn main()` for both `std` and `no_std` guests. The custom `_start` defined via `global_asm!` (now using `asm_const` for `STACK_TOP`) replaces std's default entry. - **Platform** (`crates/toolchain/platform/`): - Update `target_os = "none"` cfg gates to `any(target_os = "none", target_os = "openvm")` so target-gated deps (e.g. `libm`) resolve under either form. - Change `fileno` constants from `u32` to `i32` to match POSIX `RawFd` / the PAL's `sys_write(fd: i32, …)` signature. Drop unused `JOURNAL` fd. - **CLI** (`crates/cli/src/commands/toolchain.rs`): - New `cargo openvm toolchain {install, uninstall, list}` subcommand. `install` downloads the prebuilt tarball from openvm-org/rust Releases for the host triple, extracts it under `~/.openvm/toolchains/`, and runs `rustup toolchain link`. Supports `--version <tag>` and `--force`; idempotent re-installs skip the relink via an `is_link_to` check. - **CI helper** (`ci/install-openvm-toolchain.sh`): - Bash equivalent of `cargo openvm toolchain install` for repo workflows. Linux/macOS host detection, idempotent installs (skips the download when the target's rlib dir already exists). Wired into the `extension-tests`, `continuations`, `sdk.cuda`, `guest-lib-tests`, `riscv`, and `cli` workflows. - **Guest programs (~100 files)**: - Update `no_main` cfg gate to `cfg_attr(any(target_os = "none", target_os = "openvm"), no_main)`. - Update 45 guest `Cargo.toml`s' `unexpected_cfgs` check-cfg to include `cfg(openvm_intrinsics)` and `cfg(target_os, values("openvm"))` so stable-rustc host checks recognise the new `target_os` value. - **`riscv-guest`** (`extensions/riscv/guest/src/io.rs`): - New `hint_buffer_bytes(*mut u8, nbytes)` — byte-granular wrapper over the dword-granular `hint_buffer_chunked`, with a stack scratch dword for the trailing `0..8` bytes. - Mark `hint_buffer_chunked` `unsafe fn` (raw pointer write) and add SAFETY blocks at the three callers in `crates/toolchain/openvm/src/io/{mod,read}.rs`; existing callers in `moduli-macros` codegen and the pairing libs were already inside `unsafe` blocks. ## Test plan ### Install the toolchain ```bash cargo openvm toolchain install # or `bash ci/install-openvm-toolchain.sh` ``` This downloads `rust-toolchain-<host>.tar.gz` from the [openvm-org/rust release](https://github.com/openvm-org/rust/releases/tag/openvm-nightly-2026-01-18) and links it as `openvm-nightly-2026-01-18`. ### Test results - `cargo nextest run -p openvm-riscv-integration-tests --run-ignored all` — local pass. - Guest builds: `cargo openvm build` on `examples/algebra` (moduli-macros path) and `examples/pairing` (direct `hint_buffer_chunked` callers) compile clean against the linked toolchain. - CI: all guest-touching workflows (`extension-tests`, `continuations`, `sdk.cuda`, `guest-lib-tests`, `riscv`, `cli`) install the toolchain via the script and pass on this branch. - Benchmarks show no regression. - [x] Toolchain install path works end-to-end via both the CLI and the bash helper - [x] Guest builds succeed with `cargo openvm build` - [x] CI passes (all non-CUDA-gated checks) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Resolves INT-7635, INT-7654 --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Ayush Shukla <ayush@axiom.xyz>
No description provided.