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

[FEATURE] Add Baby Bear Field #92

Closed
wants to merge 27 commits into from

Conversation

enpsi20481
Copy link
Contributor

@enpsi20481 enpsi20481 commented Sep 13, 2024

  • Add Baby Bear field to arith package as an import from Plonky3
  • Add the degree 3 extension of Baby Bear
  • Add the degree 4 extension of Baby Bear
  • Add SIMD support
    • AVX512
    • Neon

@enpsi20481 enpsi20481 marked this pull request as ready for review September 19, 2024 14:48
@enpsi20481
Copy link
Contributor Author

Unsure how to deal with the avx512f target feature. The x86 build imports its BabyBear SIMD implementation from Plonky3, where it is gated behind "target-feature=+avx512f" so arith only builds on x86 with that feature activated, e.g. RUST_FLAGS="-C target-feature=+avx512f".

It's cumbersome to always pass in that flag so I added a .cargo/config.toml to turn it on, but then arith will not build on an aarch target. Currently I've left the config.toml file there with that line commented out so that it is easy to toggle the feature depending on the platform, but I am not sure this is the best solution

arith/Cargo.toml Outdated Show resolved Hide resolved
let a = a.v;
let b = b.v;
let mut res = [BabyBear::default(); 3];
res[0] = a[0] * b[0] + w * (a[1] * b[2] + a[2] * b[1]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nits: W is two so we should use double() for performance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, done

arith/src/extension_field/baby_bear_ext3.rs Outdated Show resolved Hide resolved
arith/src/extension_field/baby_bear_ext3x16.rs Outdated Show resolved Hide resolved
arith/src/extension_field/baby_bear_ext3x16.rs Outdated Show resolved Hide resolved
@enpsi20481 enpsi20481 closed this Sep 26, 2024
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