-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Nvidia MSM proof of concept (serial) #480
Open
Vindaar
wants to merge
22
commits into
master
Choose a base branch
from
nvidiaMsmPoc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Otherwise we run into problems if we have two execs in the same scope.
A failure in the check from the destructor almost certainly means that we destroyed early, due to an exception. We don't want to hide the exception, hence we don't quit.
Also adds `storePtr` if user really wants to store a pointer
Easy to introduce bugs by thinking one stores, when in fact one just copies the reference.
- for safer handling of multiple EC points in different coordinates - separate logic of elements of Fp (`Field`) from those of Fr (`FieldScalar`)
Dealing with ValueRef and the fact that pointers are now opaque in LLVM is extremely annoying. So here are 2 types that wrap the LLVM values with their respective underlying types which also provide easier load / write access.
It _wraps around_ a full if statement.
This implementation is a bit of a proof of concept and playground to investigate how easily we can generate code on the LLVM target with the help of Nim macros.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements the bucket method on the LLVM target. In principle it is just a direct port of the reference implementation. However, to make it look mostly identical, I added helper macros for for loops and if statements.
In addition, due to the somewhat tricky nature of dealing with LLVM types (especially with respect to pointer types), I added
MutableValue
andConstantValue
helpers as well as multiple further array types to deal with the different data types part of the calculation.While I haven't run any benchmarks (or anything resembling a real MSM, only tested with 2 inputs), this is obviously not going to be fast given that it runs entirely in serial.
This was a (to me at least) useful implementation to see how usable one can make the LLVM IR from Nim macros for more complicated code. At the very least it is noticeable that the more complicated the code becomes, the more helper boilerplate code one needs to write to keep it similar to the CPU implementations.