mirror of
https://github.com/pseXperiments/icicle.git
synced 2026-01-09 21:17:56 -05:00
This PR adds support of the m31 Field --------- Co-authored-by: Jeremy Felder <jeremy.felder1@gmail.com>
98 lines
3.7 KiB
C
98 lines
3.7 KiB
C
// WARNING: This file is auto-generated by a script.
|
|
// Any changes made to this file may be overwritten.
|
|
// Please modify the code generation script instead.
|
|
// Path to the code generation script: scripts/gen_c_api.py
|
|
|
|
#pragma once
|
|
#ifndef GRUMPKIN_API_H
|
|
#define GRUMPKIN_API_H
|
|
|
|
#include <cuda_runtime.h>
|
|
#include "gpu-utils/device_context.cuh"
|
|
#include "curves/params/grumpkin.cuh"
|
|
#include "msm/msm.cuh"
|
|
#include "vec_ops/vec_ops.cuh"
|
|
#include "poseidon/poseidon.cuh"
|
|
#include "poseidon/tree/merkle.cuh"
|
|
|
|
extern "C" cudaError_t grumpkin_precompute_msm_bases_cuda(
|
|
grumpkin::affine_t* bases,
|
|
int msm_size,
|
|
msm::MSMConfig& config,
|
|
grumpkin::affine_t* output_bases);
|
|
|
|
extern "C" cudaError_t grumpkin_msm_cuda(
|
|
const grumpkin::scalar_t* scalars, const grumpkin::affine_t* points, int msm_size, msm::MSMConfig& config, grumpkin::projective_t* out);
|
|
|
|
extern "C" bool grumpkin_eq(grumpkin::projective_t* point1, grumpkin::projective_t* point2);
|
|
|
|
extern "C" void grumpkin_to_affine(grumpkin::projective_t* point, grumpkin::affine_t* point_out);
|
|
|
|
extern "C" void grumpkin_generate_projective_points(grumpkin::projective_t* points, int size);
|
|
|
|
extern "C" void grumpkin_generate_affine_points(grumpkin::affine_t* points, int size);
|
|
|
|
extern "C" cudaError_t grumpkin_affine_convert_montgomery(
|
|
grumpkin::affine_t* d_inout, size_t n, bool is_into, device_context::DeviceContext& ctx);
|
|
|
|
extern "C" cudaError_t grumpkin_projective_convert_montgomery(
|
|
grumpkin::projective_t* d_inout, size_t n, bool is_into, device_context::DeviceContext& ctx);
|
|
|
|
extern "C" void grumpkin_generate_scalars(grumpkin::scalar_t* scalars, int size);
|
|
|
|
extern "C" cudaError_t grumpkin_scalar_convert_montgomery(
|
|
grumpkin::scalar_t* d_inout, size_t n, bool is_into, device_context::DeviceContext& ctx);
|
|
|
|
extern "C" cudaError_t grumpkin_mul_cuda(
|
|
grumpkin::scalar_t* vec_a, grumpkin::scalar_t* vec_b, int n, vec_ops::VecOpsConfig& config, grumpkin::scalar_t* result);
|
|
|
|
extern "C" cudaError_t grumpkin_add_cuda(
|
|
grumpkin::scalar_t* vec_a, grumpkin::scalar_t* vec_b, int n, vec_ops::VecOpsConfig& config, grumpkin::scalar_t* result);
|
|
|
|
extern "C" cudaError_t grumpkin_accumulate_cuda(
|
|
grumpkin::scalar_t* vec_a, grumpkin::scalar_t* vec_b, int n, vec_ops::VecOpsConfig& config);
|
|
|
|
extern "C" cudaError_t grumpkin_sub_cuda(
|
|
grumpkin::scalar_t* vec_a, grumpkin::scalar_t* vec_b, int n, vec_ops::VecOpsConfig& config, grumpkin::scalar_t* result);
|
|
|
|
extern "C" cudaError_t grumpkin_transpose_matrix_cuda(
|
|
const grumpkin::scalar_t* input,
|
|
uint32_t row_size,
|
|
uint32_t column_size,
|
|
grumpkin::scalar_t* output,
|
|
device_context::DeviceContext& ctx,
|
|
bool on_device,
|
|
bool is_async);
|
|
|
|
extern "C" cudaError_t grumpkin_bit_reverse_cuda(
|
|
const grumpkin::scalar_t* input, uint64_t n, vec_ops::BitReverseConfig& config, grumpkin::scalar_t* output);
|
|
|
|
|
|
extern "C" cudaError_t grumpkin_create_optimized_poseidon_constants_cuda(
|
|
int arity,
|
|
int full_rounds_half,
|
|
int partial_rounds,
|
|
const grumpkin::scalar_t* constants,
|
|
device_context::DeviceContext& ctx,
|
|
poseidon::PoseidonConstants<grumpkin::scalar_t>* poseidon_constants);
|
|
|
|
extern "C" cudaError_t grumpkin_init_optimized_poseidon_constants_cuda(
|
|
int arity, device_context::DeviceContext& ctx, poseidon::PoseidonConstants<grumpkin::scalar_t>* constants);
|
|
|
|
extern "C" cudaError_t grumpkin_poseidon_hash_cuda(
|
|
grumpkin::scalar_t* input,
|
|
grumpkin::scalar_t* output,
|
|
int number_of_states,
|
|
int arity,
|
|
const poseidon::PoseidonConstants<grumpkin::scalar_t>& constants,
|
|
poseidon::PoseidonConfig& config);
|
|
|
|
extern "C" cudaError_t grumpkin_build_poseidon_merkle_tree(
|
|
const grumpkin::scalar_t* leaves,
|
|
grumpkin::scalar_t* digests,
|
|
uint32_t height,
|
|
int arity,
|
|
poseidon::PoseidonConstants<grumpkin::scalar_t>& constants,
|
|
merkle::TreeBuilderConfig& config);
|
|
|
|
#endif |