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

Improve LLVM IR ECC doubling (Nvidia & AMD GPU backends) #511

Open
mratsim opened this issue Jan 8, 2025 · 1 comment
Open

Improve LLVM IR ECC doubling (Nvidia & AMD GPU backends) #511

mratsim opened this issue Jan 8, 2025 · 1 comment

Comments

@mratsim
Copy link
Owner

mratsim commented Jan 8, 2025

Port #510 to

# "dbl-2009-l" doubling formula - https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
#
# Cost: 2M + 5S + 6add + 3*2 + 1*3 + 1*8.
# Source: 2009.04.01 Lange.
# Explicit formulas:
#
# A = X₁²
# B = Y₁²
# C = B²
# D = 2*((X₁+B)²-A-C)
# E = 3*A
# F = E²
# X₃ = F-2*D
# Y₃ = E*(D-X₃)-8*C
# Z₃ = 2*Y₁*Z₁
#
A.square(P.x)
B.square(P.y)
C.square(B)
B += P.x
# aliasing: we don't use P.x anymore
B.square()
B -= A
B -= C
B.double() # D = 2*((X₁+B)²-A-C)
A *= 3 # E = 3*A
rA.x.square(A) # F = E²
rA.x -= B
rA.x -= B # X₃ = F-2*D
B -= rA.x # (D-X₃)
A *= B # E*(D-X₃)
C *= 8
rA.z.prod(P.z, P.y)
rA.z.double() # Z₃ = 2*Y₁*Z₁
# aliasing: we don't use P.y, P.z anymore
rA.y.diff(A, C) # Y₃ = E*(D-X₃)-8*C
asy.br.retVoid()

@shreyas-londhe
Copy link

Hi @mratsim I’m interested in working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants