Skip to content

Feat/hkzg gpu optim#10

Merged
nikkolasg merged 118 commits intomainfrom
feat/hkzg_gpu_optim
Feb 19, 2026
Merged

Feat/hkzg gpu optim#10
nikkolasg merged 118 commits intomainfrom
feat/hkzg_gpu_optim

Conversation

@nikkolasg
Copy link
Contributor

No description provided.

Copy link

@Zyouell Zyouell left a comment

Choose a reason for hiding this comment

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

Great job on the GPU stuff. Just a couple of things on my end to do with if we are still using some of the functions defined for GPU.

/// Evaluate a polynomial (given as a coefficient slice) at a point using Horner's method.
/// Equivalent to `DensePolynomial::eval_as_univariate` but operates on `&[F]` directly,
/// avoiding the need to wrap data in a `DensePolynomial`.
fn eval_as_univariate(coeffs: &[Fr], r: &Fr) -> Fr {
Copy link

Choose a reason for hiding this comment

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

This isn't actually using Horner's method to evaluate the poly. Horners method would be:

let mut output = coeffs[coeffs.len() - 1];
for z in coeffs.iter().rev().skip(1) {
    output *= r;
    output += z;
}

output

Copy link
Contributor

@nicholas-mainardi nicholas-mainardi left a comment

Choose a reason for hiding this comment

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

LGTM! Just few minor comments on CPU code duplication and on tests

let (pk, _): (HyperKZGProverKey<Bn254>, HyperKZGVerifierKey<Bn254>) = srs.trim(n);

let cpu_commit = msm::batch_poly_msm::<G1Affine>(pk.g1_powers(), &[&poly]).unwrap()[0];
let gpu_commit = HyperKZG::<Bn254>::commit(&pk, &poly).unwrap().0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this is using the GPU variant? Shouldn't we use HyperKZGGpu here rather than HyperKZG?

nikkolasg and others added 3 commits February 19, 2026 15:45
Signed-off-by: Nicolas Gailly <nikkolasg@users.noreply.github.com>
@nikkolasg nikkolasg merged commit f8ae70a into main Feb 19, 2026
2 checks passed
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.

4 participants