-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* zal: export MSM and threadpool to C DLL * fix LTO spurious warnings when building library * fix appType staticLib vs staticlib * fix threadpool * shorter EC FFI * zal: now compiles with halo2curves and can call Nim * zal: Pass tests * zal: add benches Halo2curves vs Constantine * CI: add constantine-rust / ZAL to CI * CI: can't use variables for shell * CI: display rust version * Rust: force clang for building (Rust regression following #309 removal of rustBuild in .nimble) * LLVM (hence llvm-config) isn't installed in Github Actions CI * documentation of compile options * reduce rust verbosity * cargo in CI, spray and pray * don't update Rust twice * if using clang, Nim expects llvm-ar for static libraries archiver * Expose full LLVM on MacOS, no Rust for i386, CPU features * fix HW info * the light at the end of the CI tunnel * ensure autoloading kernel32.dll threading API * Keep stack guard pages on Windows * MacOS CI: some agents don't support ADX instructions and SIGILL
- Loading branch information
Showing
53 changed files
with
2,011 additions
and
1,011 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ build/ | |
*.so.* | ||
*.dylib | ||
*.a | ||
*.lib | ||
*.la | ||
*.dll | ||
*.exe | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Constantine | ||
# Copyright (c) 2018-2019 Status Research & Development GmbH | ||
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy | ||
# Licensed and distributed under either of | ||
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT). | ||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0). | ||
# at your option. This file may not be copied, modified, or distributed except according to those terms. | ||
|
||
import | ||
../constantine/math/config/curves, | ||
../constantine/curves_primitives_parallel, | ||
../constantine/platforms/allocs, | ||
../constantine/threadpool | ||
|
||
export curves_primitives_parallel | ||
|
||
template genParallelBindings_EC_ShortW_NonAffine*(ECP, ECP_Aff, ScalarField: untyped) = | ||
# For some unknown reason {.push noconv.} | ||
# would overwrite the threadpool {.nimcall.} | ||
# in the parallel for-loop `generateClosure` | ||
# | ||
# Similarly, exportc breaks the threadpool generated closure | ||
# hence instead of push/pop we create a pragma alias | ||
|
||
when appType == "lib": | ||
{.pragma: libExport, dynlib, exportc, raises: [].} # No exceptions allowed | ||
else: | ||
{.pragma: libExport, exportc, raises: [].} # No exceptions allowed | ||
|
||
# -------------------------------------------------------------------------------------- | ||
proc `ctt _ ECP _ multi_scalar_mul_big_coefs_vartime_parallel`( | ||
tp: Threadpool, | ||
r: var ECP, | ||
coefs: ptr UncheckedArray[BigInt[ECP.F.C.getCurveOrderBitwidth()]], | ||
points: ptr UncheckedArray[ECP_Aff], | ||
len: csize_t) {.libExport.} = | ||
tp.multiScalarMul_vartime_parallel(r.addr, coefs, points, cast[int](len)) | ||
|
||
proc `ctt _ ECP _ multi_scalar_mul_fr_coefs_vartime_parallel`( | ||
tp: Threadpool, | ||
r: var ECP, | ||
coefs: ptr UncheckedArray[ScalarField], | ||
points: ptr UncheckedArray[ECP_Aff], | ||
len: csize_t) {.libExport.} = | ||
|
||
let n = cast[int](len) | ||
let coefs_fr = allocHeapArrayAligned(matchingOrderBigInt(ECP.F.C), n, alignment = 64) | ||
|
||
syncScope: | ||
tp.parallelFor i in 0 ..< n: | ||
captures: {coefs, coefs_fr} | ||
coefs_fr[i].fromField(coefs[i]) | ||
tp.multiScalarMul_vartime_parallel(r.addr, coefs_fr, points, n) | ||
|
||
freeHeapAligned(coefs_fr) |
Oops, something went wrong.