From 1db1b0e2397317dc8adae0d4925cb6e9dfa9612a Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Sat, 2 Mar 2024 16:36:34 -0700 Subject: [PATCH 1/4] taskpool 0.0.4 has some odd compilation issues, 0.0.5 seems to have fixed something --- groth16.nimble | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/groth16.nimble b/groth16.nimble index a6566ea..dc11911 100644 --- a/groth16.nimble +++ b/groth16.nimble @@ -7,5 +7,5 @@ skipDirs = @["groth16/example"] binDir = "build" namedBin = {"cli/cli_main": "nim-groth16"}.toTable() -requires "https://github.com/status-im/nim-taskpools" +requires "https://github.com/status-im/nim-taskpools >= 0.0.5" requires "https://github.com/mratsim/constantine#5f7ba18f2ed351260015397c9eae079a6decaee1" \ No newline at end of file From d7c7629518ffbe9e728309e0eadc93c18af33b2e Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Sat, 2 Mar 2024 16:43:36 -0700 Subject: [PATCH 2/4] change configs --- cli/nim.cfg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cli/nim.cfg b/cli/nim.cfg index b20433f..0c0e19a 100644 --- a/cli/nim.cfg +++ b/cli/nim.cfg @@ -1,2 +1,5 @@ --path:".." ---threads:on \ No newline at end of file +--threads:on +--gc:orc +--release +# --debug From 4de5347c955844449c520224c068f0f9a70808db Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Sat, 2 Mar 2024 16:43:52 -0700 Subject: [PATCH 3/4] print addresses of seqs --- groth16/prover.nim | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/groth16/prover.nim b/groth16/prover.nim index 0f226fb..7b74892 100644 --- a/groth16/prover.nim +++ b/groth16/prover.nim @@ -107,6 +107,7 @@ func multiplyByPowers( xs: seq[Fr], eta: Fr ): seq[Fr] = # interpolates a polynomial, shift the variable by `eta`, and compute the shifted values func shiftEvalDomain( values: seq[Fr], D: Domain, eta: Fr ): seq[Fr] = + echo "task: abc.values: ", values.unsafeAddr.pointer.repr let poly : Poly = polyInverseNTT( values , D ) let cs : seq[Fr] = poly.coeffs var ds : seq[Fr] = multiplyByPowers( cs, eta ) @@ -128,16 +129,13 @@ proc computeQuotientPointwise( nthreads: int, abc: ABC ): Poly = let invZ1 = invFr( smallPowFr(eta,n) - oneFr ) var pool = Taskpool.new(num_threads = nthreads) - GCref(abc.valuesAz) - GCref(abc.valuesBz) - GCref(abc.valuesCz) + echo "main: abc.valuesAz: ", abc.valuesAz.unsafeAddr.pointer.repr + echo "main: abc.valuesBz: ", abc.valuesBz.unsafeAddr.pointer.repr + echo "main: abc.valuesCz: ", abc.valuesCz.unsafeAddr.pointer.repr var A1fv : FlowVar[seq[Fr]] = pool.spawn shiftEvalDomain( abc.valuesAz, D, eta ) var B1fv : FlowVar[seq[Fr]] = pool.spawn shiftEvalDomain( abc.valuesBz, D, eta ) var C1fv : FlowVar[seq[Fr]] = pool.spawn shiftEvalDomain( abc.valuesCz, D, eta ) pool.syncAll() - GCunref(abc.valuesAz) - GCunref(abc.valuesBz) - GCunref(abc.valuesCz) let A1 = sync A1fv let B1 = sync B1fv let C1 = sync C1fv From 0b7e5b912c2b51cf995f67c4484595fab4b57194 Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Sat, 2 Mar 2024 16:44:54 -0700 Subject: [PATCH 4/4] print addresses of seqs --- groth16/prover.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/groth16/prover.nim b/groth16/prover.nim index 7b74892..c1d2fca 100644 --- a/groth16/prover.nim +++ b/groth16/prover.nim @@ -107,7 +107,7 @@ func multiplyByPowers( xs: seq[Fr], eta: Fr ): seq[Fr] = # interpolates a polynomial, shift the variable by `eta`, and compute the shifted values func shiftEvalDomain( values: seq[Fr], D: Domain, eta: Fr ): seq[Fr] = - echo "task: abc.values: ", values.unsafeAddr.pointer.repr + echo "task: abc.values: ", values[0].unsafeAddr.pointer.repr let poly : Poly = polyInverseNTT( values , D ) let cs : seq[Fr] = poly.coeffs var ds : seq[Fr] = multiplyByPowers( cs, eta ) @@ -129,9 +129,9 @@ proc computeQuotientPointwise( nthreads: int, abc: ABC ): Poly = let invZ1 = invFr( smallPowFr(eta,n) - oneFr ) var pool = Taskpool.new(num_threads = nthreads) - echo "main: abc.valuesAz: ", abc.valuesAz.unsafeAddr.pointer.repr - echo "main: abc.valuesBz: ", abc.valuesBz.unsafeAddr.pointer.repr - echo "main: abc.valuesCz: ", abc.valuesCz.unsafeAddr.pointer.repr + echo "main: abc.valuesAz: ", abc.valuesAz[0].unsafeAddr.pointer.repr + echo "main: abc.valuesBz: ", abc.valuesBz[0].unsafeAddr.pointer.repr + echo "main: abc.valuesCz: ", abc.valuesCz[0].unsafeAddr.pointer.repr var A1fv : FlowVar[seq[Fr]] = pool.spawn shiftEvalDomain( abc.valuesAz, D, eta ) var B1fv : FlowVar[seq[Fr]] = pool.spawn shiftEvalDomain( abc.valuesBz, D, eta ) var C1fv : FlowVar[seq[Fr]] = pool.spawn shiftEvalDomain( abc.valuesCz, D, eta )