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

MSM - supporting all window sizes #534

Merged
merged 16 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
14 changes: 4 additions & 10 deletions icicle/include/api/bls12_377.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@

extern "C" cudaError_t bls12_377_g2_precompute_msm_bases_cuda(
bls12_377::g2_affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bls12_377::g2_affine_t* output_bases);

extern "C" cudaError_t bls12_377_g2_msm_cuda(
const bls12_377::scalar_t* scalars, const bls12_377::g2_affine_t* points, int msm_size, msm::MSMConfig& config, bls12_377::g2_projective_t* out);

extern "C" cudaError_t bls12_377_precompute_msm_bases_cuda(
bls12_377::affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bls12_377::affine_t* output_bases);

extern "C" cudaError_t bls12_377_msm_cuda(
Expand Down
14 changes: 4 additions & 10 deletions icicle/include/api/bls12_381.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@

extern "C" cudaError_t bls12_381_g2_precompute_msm_bases_cuda(
bls12_381::g2_affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bls12_381::g2_affine_t* output_bases);

extern "C" cudaError_t bls12_381_g2_msm_cuda(
const bls12_381::scalar_t* scalars, const bls12_381::g2_affine_t* points, int msm_size, msm::MSMConfig& config, bls12_381::g2_projective_t* out);

extern "C" cudaError_t bls12_381_precompute_msm_bases_cuda(
bls12_381::affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bls12_381::affine_t* output_bases);

extern "C" cudaError_t bls12_381_msm_cuda(
Expand Down
14 changes: 4 additions & 10 deletions icicle/include/api/bn254.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@

extern "C" cudaError_t bn254_g2_precompute_msm_bases_cuda(
bn254::g2_affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bn254::g2_affine_t* output_bases);

extern "C" cudaError_t bn254_g2_msm_cuda(
const bn254::scalar_t* scalars, const bn254::g2_affine_t* points, int msm_size, msm::MSMConfig& config, bn254::g2_projective_t* out);

extern "C" cudaError_t bn254_precompute_msm_bases_cuda(
bn254::affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bn254::affine_t* output_bases);

extern "C" cudaError_t bn254_msm_cuda(
Expand Down
14 changes: 4 additions & 10 deletions icicle/include/api/bw6_761.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@

extern "C" cudaError_t bw6_761_g2_precompute_msm_bases_cuda(
bw6_761::g2_affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bw6_761::g2_affine_t* output_bases);

extern "C" cudaError_t bw6_761_g2_msm_cuda(
const bw6_761::scalar_t* scalars, const bw6_761::g2_affine_t* points, int msm_size, msm::MSMConfig& config, bw6_761::g2_projective_t* out);

extern "C" cudaError_t bw6_761_precompute_msm_bases_cuda(
bw6_761::affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
bw6_761::affine_t* output_bases);

extern "C" cudaError_t bw6_761_msm_cuda(
Expand Down
7 changes: 2 additions & 5 deletions icicle/include/api/grumpkin.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@

extern "C" cudaError_t grumpkin_precompute_msm_bases_cuda(
grumpkin::affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
grumpkin::affine_t* output_bases);

extern "C" cudaError_t grumpkin_msm_cuda(
Expand Down
7 changes: 2 additions & 5 deletions icicle/include/api/templates/curves/msm.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
extern "C" cudaError_t ${CURVE}_precompute_msm_bases_cuda(
${CURVE}::affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
${CURVE}::affine_t* output_bases);

extern "C" cudaError_t ${CURVE}_msm_cuda(
Expand Down
7 changes: 2 additions & 5 deletions icicle/include/api/templates/curves/msm_g2.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
extern "C" cudaError_t ${CURVE}_g2_precompute_msm_bases_cuda(
${CURVE}::g2_affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
int msm_size,
msm::MSMConfig& config,
${CURVE}::g2_affine_t* output_bases);

extern "C" cudaError_t ${CURVE}_g2_msm_cuda(
Expand Down
9 changes: 1 addition & 8 deletions icicle/include/msm/msm.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,7 @@ namespace msm {
*
*/
template <typename A, typename P>
cudaError_t precompute_msm_bases(
A* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
A* output_bases);
cudaError_t precompute_msm_bases(A* bases, int msm_size, msm::MSMConfig& config, A* output_bases);

} // namespace msm

Expand Down
8 changes: 6 additions & 2 deletions icicle/src/msm/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
build_msm:
mkdir -p work
nvcc -o work/test_msm -std=c++17 -arch=sm_80 -I. -I../../include tests/msm_test.cu

test_msm:
mkdir -p work
nvcc -o work/test_msm -std=c++17 -I. -I../../include tests/msm_test.cu
work/test_msm
nvcc -o work/test_msm -std=c++17 -arch=sm_80 -I. -I../../include tests/msm_test.cu
work/test_msm
11 changes: 2 additions & 9 deletions icicle/src/msm/extern.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ namespace msm {
* @return `cudaSuccess` if the execution was successful and an error code otherwise.
*/
extern "C" cudaError_t CONCAT_EXPAND(CURVE, precompute_msm_bases_cuda)(
affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
affine_t* output_bases)
affine_t* bases, int msm_size, MSMConfig& config, affine_t* output_bases)
{
return precompute_msm_bases<affine_t, projective_t>(
bases, bases_size, precompute_factor, _c, are_bases_on_device, ctx, output_bases);
return precompute_msm_bases<affine_t, projective_t>(bases, msm_size, config, output_bases);
}

/**
Expand Down
11 changes: 2 additions & 9 deletions icicle/src/msm/extern_g2.cu
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ namespace msm {
* @return `cudaSuccess` if the execution was successful and an error code otherwise.
*/
extern "C" cudaError_t CONCAT_EXPAND(CURVE, g2_precompute_msm_bases_cuda)(
g2_affine_t* bases,
int bases_size,
int precompute_factor,
int _c,
bool are_bases_on_device,
device_context::DeviceContext& ctx,
g2_affine_t* output_bases)
g2_affine_t* bases, int msm_size, MSMConfig& config, g2_affine_t* output_bases)
{
return precompute_msm_bases<g2_affine_t, g2_projective_t>(
bases, bases_size, precompute_factor, _c, are_bases_on_device, ctx, output_bases);
return precompute_msm_bases<g2_affine_t, g2_projective_t>(bases, msm_size, config, output_bases);
}

/**
Expand Down
Loading
Loading