-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for NTT, Update configs initialisation, fix module visibility
- Loading branch information
1 parent
097ba53
commit 98226ea
Showing
30 changed files
with
1,140 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ Cargo.lock | |
*DS_Store* | ||
*.csv | ||
.env | ||
test_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,38 @@ | ||
[package] | ||
name = "ingo-blaze" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
version = "0.3.0" | ||
edition = "2021" | ||
authors = [ "Ingonyama" ] | ||
authors = ["Ingonyama"] | ||
description = "Library for ZK acceleration on Xilinx FPGAs." | ||
edition = "2021" | ||
homepage = "https://www.ingonyama.com" | ||
name = "ingo-blaze" | ||
repository = "https://github.com/ingonyama-zk/blaze" | ||
version = "0.4.0" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
libc = "0.2.126" | ||
ark-algebra-intro = "0.3.0" | ||
ark-ec = "0.3.0" | ||
ark-std = "0.3.0" | ||
ark-ff = "0.3.0" | ||
anyhow = "1.0.68" | ||
ark-bls12-377 = "0.3.0" | ||
ark-bn254 = "0.3.0" | ||
ark-bls12-381 = "0.3.0" | ||
ark-bn254 = "0.3.0" | ||
ark-ec = "0.3.0" | ||
ark-ff = "0.3.0" | ||
ark-std = "0.3.0" | ||
criterion = "0.4.0" | ||
csv = "1.1" | ||
dotenv = "0.15.0" | ||
env_logger = "0.10.0" | ||
libc = "0.2.126" | ||
log = "0.4.0" | ||
packed_struct = "0.10" | ||
anyhow = "1.0.68" | ||
csv = "1.1" | ||
serde = { version = "1", features = ["derive"] } | ||
num = "0.4" | ||
strum = "0.24" | ||
strum_macros = "0.24" | ||
num-bigint = "0.4" | ||
num-traits = "0.2.15" | ||
packed_struct = "0.10" | ||
rand = "0.8.5" | ||
criterion = "0.4.0" | ||
lazy_static = "1.4.0" | ||
bindgen = "0.64.0" | ||
dotenv = "0.15.0" | ||
rayon = "1.6.1" | ||
serde_json = { version = "1.0" } | ||
serde-hex = "0.1.0" | ||
strum = "0.24" | ||
strum_macros = "0.24" | ||
thiserror = "1.0" | ||
num-bigint = "0.4" | ||
num-traits = "0.2.15" | ||
|
||
[[bench]] | ||
harness = false | ||
name = "ntt_bench" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use std::{env, fs::File, io::Read}; | ||
|
||
use criterion::*; | ||
use ingo_blaze::{driver_client::*, ingo_ntt::*}; | ||
use log::info; | ||
|
||
fn bench_ntt_calc(c: &mut Criterion) { | ||
env_logger::try_init().expect("Invalid logger initialisation"); | ||
let id = env::var("ID").unwrap_or_else(|_| 0.to_string()); | ||
let fname = env::var("FNAME").unwrap(); | ||
let mut f = File::open(fname).expect("no file found"); | ||
let mut in_vec: Vec<u8> = Default::default(); | ||
let _ = f.read_to_end(&mut in_vec); | ||
|
||
let buf_host = 0; | ||
let buf_kernel = 0; | ||
|
||
info!("Create Driver API instance"); | ||
let dclient = DriverClient::new(&id, DriverConfig::driver_client_cfg(CardType::C1100)); | ||
let driver = NTTClient::new(NTT::Ntt, dclient); | ||
log::info!("Starting set NTT data"); | ||
let _ = driver.set_data(NTTInput { | ||
buf_host, | ||
data: in_vec, | ||
}); | ||
log::info!("Successfully set NTT data"); | ||
let _ = driver.driver_client.initialize_cms(); | ||
let _ = driver.driver_client.reset_sensor_data(); | ||
|
||
let mut group = c.benchmark_group("NTT computation"); | ||
|
||
log::info!("Starting NTT"); | ||
group.bench_function("NTT", |b| { | ||
b.iter(|| { | ||
let _ = driver.initialize(NttInit {}); | ||
let _ = driver.start_process(Some(buf_kernel)); | ||
let _ = driver.wait_result(); | ||
let _ = driver.driver_client.reset(); | ||
}) | ||
}); | ||
group.finish(); | ||
log::info!("Finishing NTT"); | ||
|
||
log::info!("Try to get NTT result"); | ||
let res = driver.result(Some(buf_kernel)).unwrap(); | ||
log::info!("NTT result: {:?}", res.unwrap().len()); | ||
} | ||
|
||
criterion_group! { | ||
name = benches; | ||
config = Criterion::default().sample_size(10); | ||
targets = bench_ntt_calc | ||
} | ||
criterion_main!(benches); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
So mu