Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cryptography_cuda reference, fix AVX2 issues #36

Merged
merged 21 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [Unreleased]

## [0.2.3] - 2024-04-16

- Code refactoring ([#1558](https://github.com/0xPolygonZero/plonky2/pull/1558))
- Simplify types: remove option from CTL filters ([#1567](https://github.com/0xPolygonZero/plonky2/pull/1567))
- Add stdarch_x86_avx512 feature ([#1566](https://github.com/0xPolygonZero/plonky2/pull/1566))

## [0.2.2] - 2024-03-21

### Changed
- Fix CTLs with exactly two looking tables ([#1555](https://github.com/0xPolygonZero/plonky2/pull/1555))
- Make Starks without constraints provable ([#1552](https://github.com/0xPolygonZero/plonky2/pull/1552))

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["field", "maybe_rayon", "plonky2", "starky", "util", "gen", "u32", "e
resolver = "2"

[workspace.dependencies]
cryptography_cuda = { git = "ssh://[email protected]/okx/cryptography_cuda.git", rev = "173510160183f3299f4765b30bd4f2c1685353f9" }
cryptography_cuda = { git = "ssh://[email protected]/okx/cryptography_cuda.git", rev = "2a7c42d29ee72d7c2c2da9378ae816384c43cdec" }
ahash = { version = "0.8.7", default-features = false, features = [
"compile-time-rng",
] } # NOTE: Be sure to keep this version the same as the dependency in `hashbrown`.
Expand Down
9 changes: 2 additions & 7 deletions field/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
[package]
name = "plonky2_field"
description = "Finite field arithmetic"
version = "0.2.0"
authors = [
"Daniel Lubarov <[email protected]>",
"William Borgeaud <[email protected]>",
"Jacqueline Nabaglo <[email protected]>",
"Hamish Ivey-Law <[email protected]>",
]
version = "0.2.2"
authors = ["Daniel Lubarov <[email protected]>", "William Borgeaud <[email protected]>", "Jacqueline Nabaglo <[email protected]>", "Hamish Ivey-Law <[email protected]>"]
edition.workspace = true
license.workspace = true
homepage.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions field/src/fft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ fn fft_dispatch_cpu<F: Field>(
zero_factor: Option<usize>,
root_table: Option<&FftRootTable<F>>,
) {
/*
if root_table.is_some() {
return fft_classic(input, zero_factor.unwrap_or(0), root_table.unwrap());
} else {
Expand All @@ -68,6 +69,11 @@ fn fft_dispatch_cpu<F: Field>(

return fft_classic(input, zero_factor.unwrap_or(0), computed.as_ref());
};
*/
let computed_root_table = root_table.is_none().then(|| fft_root_table(input.len()));
let used_root_table = root_table.or(computed_root_table.as_ref()).unwrap();

fft_classic(input, zero_factor.unwrap_or(0), used_root_table);
}

#[inline]
Expand Down
1 change: 1 addition & 0 deletions field/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(missing_debug_implementations)]
#![feature(specialization)]
#![cfg_attr(target_arch = "x86_64", feature(stdarch_x86_avx512))]
#![cfg_attr(not(test), no_std)]
#![cfg(not(test))]
extern crate alloc;
Expand Down
2 changes: 0 additions & 2 deletions maybe_rayon/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![cfg_attr(not(std), no_std)]

#[cfg(not(feature = "parallel"))]
extern crate alloc;

Expand Down
10 changes: 3 additions & 7 deletions plonky2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
[package]
name = "plonky2"
description = "Recursive SNARKs based on PLONK and FRI"
version = "0.2.0"
authors = [
"Daniel Lubarov <[email protected]>",
"William Borgeaud <[email protected]>",
"Nicholas Ward <[email protected]>",
]
version = "0.2.2"
authors = ["Daniel Lubarov <[email protected]>", "William Borgeaud <[email protected]>", "Nicholas Ward <[email protected]>"]
readme = "README.md"
edition.workspace = true
license.workspace = true
Expand Down Expand Up @@ -45,7 +41,7 @@ once_cell = { version = "1.18.0" }
papi-bindings = { version = "0.5.2" }

# Local dependencies
plonky2_field = { version = "0.2.0", path = "../field", default-features = false }
plonky2_field = { version = "0.2.2", path = "../field", default-features = false }
plonky2_maybe_rayon = { version = "0.2.0", path = "../maybe_rayon", default-features = false }
plonky2_util = { version = "0.2.0", path = "../util", default-features = false }
cryptography_cuda = { workspace = true, optional = true }
Expand Down
85 changes: 0 additions & 85 deletions plonky2/build.rs

This file was deleted.

Binary file removed plonky2/poseidon_bn128/libposeidon-permute-c.a
Binary file not shown.
94 changes: 0 additions & 94 deletions plonky2/poseidon_bn128/libposeidon-permute-c.h

This file was deleted.

1 change: 0 additions & 1 deletion plonky2/poseidon_bn128/wrapper.h

This file was deleted.

1 change: 0 additions & 1 deletion plonky2/src/gates/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use alloc::{
vec,
vec::Vec,
};
use core::usize;

use itertools::Itertools;
use keccak_hash::keccak;
Expand Down
1 change: 0 additions & 1 deletion plonky2/src/gates/lookup_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use alloc::{
vec,
vec::Vec,
};
use core::usize;
#[cfg(feature = "std")]
use std::sync::Arc;

Expand Down
3 changes: 3 additions & 0 deletions plonky2/src/hash/arch/x86_64/goldilocks_avx2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub fn reduce_avx_128_64(c_h: &__m256i, c_l: &__m256i) -> __m256i {
}

// Here we suppose c_h < 2^32
#[allow(dead_code)]
#[inline(always)]
pub fn reduce_avx_96_64(c_h: &__m256i, c_l: &__m256i) -> __m256i {
unsafe {
Expand Down Expand Up @@ -162,6 +163,7 @@ pub fn mult_avx(a: &__m256i, b: &__m256i) -> __m256i {
}

// Multiply two 64bit numbers with the assumption that the product does not averflow.
#[allow(dead_code)]
#[inline]
pub unsafe fn mul64_no_overflow(a: &__m256i, b: &__m256i) -> __m256i {
let r = _mm256_mul_epu32(*a, *b);
Expand Down Expand Up @@ -282,6 +284,7 @@ where
}
}

#[allow(dead_code)]
#[inline(always)]
pub fn sbox_avx_m256i(s0: &__m256i, s1: &__m256i, s2: &__m256i) -> (__m256i, __m256i, __m256i) {
// x^2
Expand Down
Loading
Loading