-
Notifications
You must be signed in to change notification settings - Fork 121
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
Poseidon2 perf improvement #758
base: main
Are you sure you want to change the base?
Conversation
// Multiplication by partial (sparse) matrix. | ||
partial_matrix_diagonal_m1_mul_by_vector(tmp_fields, partial_matrix_diagonal_m1, tmp_fields); | ||
S prepared_element; | ||
#pragma unroll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is T known at compile time? if not, unrolling won't be made anyway
Can unroll the smallest value of T...
return element * element * element * element * element * element * element * element * element * element * | ||
element; | ||
default: { | ||
// Danny TODO: How to stop here if there is an illegal alpha? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO return eIcicileError and add the return to the api
// Note that in order to increase the performance the partial matrix diagonal values | ||
// are actually partial matrix diagonal values minus 1. | ||
void partial_matrix_diagonal_m1_mul_by_vector(const S* vec_in, const S* matrix_in, S* result) const | ||
S sbox_el(S element, const int alpha) const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name unclear, sbox_element?
S sbox_el(S element, const int alpha) const | |
eIcicleError sbox_element(S element, const int alpha, S to_return) const |
@@ -145,341 +142,437 @@ namespace icicle { | |||
break; | |||
default: | |||
ICICLE_LOG_ERROR | |||
<< "cpu_poseidon2_init_default_constants: T (width) must be one of [2, 3, 4, 8, 12, 16, 20, 24]\n"; | |||
<< "cuda_poseidon2_init_default_constants: T (width) must be one of [2, 3, 4, 8, 12, 16, 20, 24]"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is cuda here?
Poseidon2 CPU perf improvement by 17% for sponge and 10% for non-sponge.
Changes are only in CPU backend file and the tests file.
This PR...
Linked Issues
Resolves #
(optional) CUDA backend branch
cuda-backend-branch: main # specify the branch here