We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Functions like the multiplication by non-residue that return a result out-of-place
constantine/constantine/tower_field_extensions/tower_instantiation.nim
Lines 150 to 172 in d12d5fa
Leads to a strange codegen with lots of vector moves for seemingly no reason:
For example cyclotomic square
static N_INLINE(tyObject_Fp2__MFvpv7bDjIeajDmaQmXLqw, star___o52jw9bogfvItM7F9a68XWlgtower_instantiation)(tyObject_Fp2__MFvpv7bDjIeajDmaQmXLqw* a) { tyObject_Fp2__MFvpv7bDjIeajDmaQmXLqw result; tyObject_Fp__6V3eX5xO0FJcHzFOqwm7OQ T1_; tyObject_Fp__6V3eX5xO0FJcHzFOqwm7OQ T2_; tyObject_Fp__6V3eX5xO0FJcHzFOqwm7OQ T3_; tyObject_Fp__6V3eX5xO0FJcHzFOqwm7OQ T4_; T1_ = star___yJ9aCkgoEpeRaoS807VHwUAfinite_fields((&(*a).c0)); T2_ = star___yJ9aCkgoEpeRaoS807VHwUAfinite_fields((&(*a).c1)); diff__Z7a6tu9cQAhfKCAfcix2P3wfinite_fields((&result.c0), (&T1_), (&T2_)); T3_ = star___yJ9aCkgoEpeRaoS807VHwUAfinite_fields((&(*a).c0)); T4_ = star___yJ9aCkgoEpeRaoS807VHwUAfinite_fields((&(*a).c1)); sum__Z7a6tu9cQAhfKCAfcix2P3w_2finite_fields((&result.c1), (&T3_), (&T4_)); return result; } static N_INLINE(tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw, star___OcuTitixyJms2mXbB9aCuPAtower_instantiation)(tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw* a) { tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw result; result.c0 = star___o52jw9bogfvItM7F9a68XWlgtower_instantiation((&(*a).c1)); result.c1 = (*a).c0; return result; } static N_INLINE(void, stareq___6OjlbVANr8u6scRjSEiGYgtower_instantiation)(tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw* a) { (*a) = star___OcuTitixyJms2mXbB9aCuPAtower_instantiation((&(*a))); } static N_INLINE(void, conj__EqP0FRP809b11RLAQ9aKjS3g_2quadratic_extensions)(tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw* r, tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw a) { (*r).c0 = a.c0; neg__x7zdGkRtGC9aRJX1AWI4vLQ_2((&(*r).c1), (&a.c1)); } static N_INLINE(void, conjneg__EqP0FRP809b11RLAQ9aKjS3g_3quadratic_extensions)(tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw* r, tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw a) { neg__x7zdGkRtGC9aRJX1AWI4vLQ_2((&(*r).c0), (&a.c0)); (*r).c1 = a.c1; } N_LIB_PRIVATE N_NIMCALL(void, cyclotomic_square__by9bcdzqxL9cY5C41np9cjq4A)(tyObject_Fp12__QVujeBSVHotGpxbWmrGv8g* r, tyObject_Fp12__QVujeBSVHotGpxbWmrGv8g* a) { tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw A; tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw B; tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw C; tyObject_Fp4__y9ageSyvuUFHaz5K14C7aAw D; A = (*a).c0; square__EqP0FRP809b11RLAQ9aKjS3gquadratic_extensions((&(*r).c0), (*a).c0); double__s51k9b9cjHcx6E0aaLWZMeMw((&D), (&(*r).c0)); pluseq___eP9cp8bg6sFMQLe5QrnauTQ((&(*r).c0), (&D)); conjneg__I9boL26O9beHJCpZO8IIfU2A_2quadratic_extensions((&A)); double__JTO6FynOLekzb0lIHQZ4cA((&A)); pluseq___eP9cp8bg6sFMQLe5QrnauTQ((&(*r).c0), (&A)); square__EqP0FRP809b11RLAQ9aKjS3gquadratic_extensions((&B), (*a).c2); stareq___6OjlbVANr8u6scRjSEiGYgtower_instantiation((&B)); double__s51k9b9cjHcx6E0aaLWZMeMw((&D), (&B)); pluseq___eP9cp8bg6sFMQLe5QrnauTQ((&B), (&D)); conj__EqP0FRP809b11RLAQ9aKjS3g_2quadratic_extensions((&(*r).c1), (*a).c1); double__JTO6FynOLekzb0lIHQZ4cA((&(*r).c1)); pluseq___eP9cp8bg6sFMQLe5QrnauTQ((&(*r).c1), (&B)); square__EqP0FRP809b11RLAQ9aKjS3gquadratic_extensions((&C), (*a).c1); double__s51k9b9cjHcx6E0aaLWZMeMw((&D), (&C)); pluseq___eP9cp8bg6sFMQLe5QrnauTQ((&C), (&D)); conjneg__EqP0FRP809b11RLAQ9aKjS3g_3quadratic_extensions((&(*r).c2), (*a).c2); double__JTO6FynOLekzb0lIHQZ4cA((&(*r).c2)); pluseq___eP9cp8bg6sFMQLe5QrnauTQ((&(*r).c2), (&C)); }
The text was updated successfully, but these errors were encountered:
part of the bad codegen was due to #146 / nim-lang/Nim#16897 which was fixed in nim-lang/Nim@91ace21
However I still confirm that out-of-place functions should be avoided as they also generate bad codegen with extension fields
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Functions like the multiplication by non-residue that return a result out-of-place
constantine/constantine/tower_field_extensions/tower_instantiation.nim
Lines 150 to 172 in d12d5fa
Leads to a strange codegen with lots of vector moves for seemingly no reason:
For example cyclotomic square
The text was updated successfully, but these errors were encountered: