icicle
icicle copied to clipboard
[BUG]: Inconsistent results for BN256 G1 MSMs
Description
When using the provided example script to compute the same MSM multiple times (with the same size, scalars, and points) on BN256, the results for G1 vary and sometimes yield points that are not on the curve.
Reproduce
Change https://github.com/ingonyama-zk/icicle/blob/6134cfe17703bd6156837481d7ad7ab7325f1355/examples/rust/msm/src/main.rs#L55-L56 to
for i in 0..10 {
let log_size = 10;
Expected Behavior
The 10 MSMs over G1 and G2, respectively, return consistent values.
Observed Behavior
The 10 MSMs over G1 return different values, sometimes points not on the curve. The 10 MSMs over G2 return consistent values.
Environment
OS + Version: Ubuntu 22.04.1
Cargo Version: 1.77.2
GPU type: NVIDIA A10G
Additional context
- The first G1 MSM execution always appears to return the correct result; results become inconsistent from the second iteration onward.
- The example script does not destroy the
g2_stream
, but only doing so does not solve the issue; - Setting configs'
is_async
tofalse
solves the issue. - Moving the G1
stream.synchronize()
https://github.com/ingonyama-zk/icicle/blob/6134cfe17703bd6156837481d7ad7ab7325f1355/examples/rust/msm/src/main.rs#L132-L134 to after the G1 MSM and before the G2 MSM execution solves the issue. - When using
log_size = 16
results seem to be consistent, even if none of the above fixes is implemented; - The bug does not appear to be present when using
bls12377
.