Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v4.0.0-rc.2' into v4.0.0-rc.2
Browse files Browse the repository at this point in the history
  • Loading branch information
umadayal committed Dec 5, 2024
2 parents 5e546ac + 43792f1 commit 9bb49f4
Show file tree
Hide file tree
Showing 11 changed files with 1,236 additions and 621 deletions.
14 changes: 9 additions & 5 deletions crates/core/machine/include/bb31_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class bb31_t {

inline bb31_t() {}

inline bb31_t(const uint32_t a) { val = a; }
inline constexpr bb31_t(const uint32_t a) { val = a; }

inline bb31_t(const uint32_t* p) { val = *p; }

Expand All @@ -57,7 +57,7 @@ class bb31_t {

static inline const bb31_t two() { return from_canonical_u32(2); }

static inline uint32_t to_monty(uint32_t x) {
static inline constexpr uint32_t to_monty(uint32_t x) {
return (((uint64_t)x << MONTY_BITS) % MOD);
}

Expand All @@ -71,6 +71,10 @@ class bb31_t {
return x_sub_u_hi + corr;
}

static inline uint32_t from_monty(uint32_t x) {
return monty_reduce((uint64_t)x);
}

static inline bb31_t from_canonical_u32(uint32_t x) {
return bb31_t(to_monty(x));
}
Expand Down Expand Up @@ -483,9 +487,9 @@ class bb31_t {
static const uint32_t NBITS = 31;
static const uint32_t MOD = 0x78000001;

inline bb31_t() {}
inline constexpr bb31_t() {}

inline bb31_t(uint32_t a) : val(a) {}
inline constexpr bb31_t(uint32_t a) : val(a) {}

inline constexpr bb31_t(int a) : val(((uint64_t)a << 32) % MOD) {}

Expand All @@ -495,7 +499,7 @@ class bb31_t {

static inline const bb31_t two() { return bb31_t(to_monty(2)); }

static inline uint32_t to_monty(uint32_t x) {
static inline constexpr uint32_t to_monty(uint32_t x) {
return (((uint64_t)x << MONTY_BITS) % MOD);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cuda/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl SP1CudaProver {
pub fn new() -> Result<Self, Box<dyn StdError>> {
let container_name = "sp1-gpu";
let image_name = std::env::var("SP1_GPU_IMAGE")
.unwrap_or_else(|_| "public.ecr.aws/succinct-labs/moongate:v4.0.0-rc.1".to_string());
.unwrap_or_else(|_| "public.ecr.aws/succinct-labs/moongate:v4.0.0-rc2".to_string());

let cleaned_up = Arc::new(AtomicBool::new(false));
let cleanup_name = container_name;
Expand Down
1 change: 1 addition & 0 deletions crates/recursion/core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ mod sys {
.include_item("Poseidon2Instr")
.include_item("Poseidon2PreprocessedColsSkinny")
.include_item("Poseidon2PreprocessedColsWide")
.include_item("OUTPUT_ROUND_IDX")
.with_namespace("sp1_recursion_core_sys")
.with_crate(crate_dir)
.generate()
Expand Down
20 changes: 7 additions & 13 deletions crates/recursion/core/cpp/extern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,14 @@ extern void poseidon2_skinny_instr_to_row_babybear(
*reinterpret_cast<Poseidon2PreprocessedColsSkinny<bb31_t>*>(cols));
}

extern "C" void poseidon2_wide_event_to_row_babybear(
const BabyBearP3* input, BabyBearP3* external_rounds_state,
BabyBearP3* internal_rounds_state, BabyBearP3* internal_rounds_s0,
BabyBearP3* external_sbox, BabyBearP3* internal_sbox,
BabyBearP3* output_state) {
poseidon2_wide::event_to_row<bb31_t>(
reinterpret_cast<const bb31_t*>(input),
reinterpret_cast<bb31_t*>(external_rounds_state),
reinterpret_cast<bb31_t*>(internal_rounds_state),
reinterpret_cast<bb31_t*>(internal_rounds_s0),
reinterpret_cast<bb31_t*>(external_sbox),
reinterpret_cast<bb31_t*>(internal_sbox),
reinterpret_cast<bb31_t*>(output_state));
extern "C" void poseidon2_wide_event_to_row_babybear(const BabyBearP3* input,
BabyBearP3* input_row,
bool sbox_state) {
poseidon2_wide::event_to_row<bb31_t>(reinterpret_cast<const bb31_t*>(input),
reinterpret_cast<bb31_t*>(input_row), 0,
1, sbox_state);
}

extern void poseidon2_wide_instr_to_row_babybear(
const Poseidon2SkinnyInstr<BabyBearP3>* instr,
Poseidon2PreprocessedColsWide<BabyBearP3>* cols) {
Expand Down
Loading

0 comments on commit 9bb49f4

Please sign in to comment.