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 and ConstantValue 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.
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.